Skip to content

angle_defect

angle_defect(V, F, use_small_angle_approx=True)

Returns the angle defect at each vertex (except at boundary vertices, where it is 0.). The angle defect is a proxy for integrated Gaussian curvature.

Parameters:

Name Type Description Default
V (n,d) numpy array

vertex list of a triangle mesh

required
F (m,3) numpy int array

face index list of a triangle mesh

required
use_small_angle_approx bool, optional (default True)

If True, uses a different, more more stable formula for small angles.

True

Returns:

Name Type Description
k (n,) numpy array

angle defect at each vertex.

Examples:

V,F = gpy.read_obj("mesh.obj")
k = gpy.angle_defect(V,F)
Source code in src/gpytoolbox/angle_defect.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def angle_defect(V,F,
    use_small_angle_approx=True):
    """Returns the angle defect at each vertex (except at boundary vertices,
    where it is `0`.).
    The angle defect is a proxy for integrated Gaussian curvature.

    Parameters
    ----------
    V : (n,d) numpy array
        vertex list of a triangle mesh
    F : (m,3) numpy int array
        face index list of a triangle mesh
    use_small_angle_approx : bool, optional (default True)
        If True, uses a different, more more stable formula for small angles.

    Returns
    -------
    k : (n,) numpy array
        angle defect at each vertex.

    Examples
    --------
    ```python
    V,F = gpy.read_obj("mesh.obj")
    k = gpy.angle_defect(V,F)
    ```
    """

    l_sq = halfedge_lengths_squared(V,F)
    return angle_defect_intrinsic(l_sq,F,n=V.shape[0],
        use_small_angle_approx=use_small_angle_approx)