Skip to content

doublearea

doublearea(V, F=None)

Construct the doublearea of each element of a line or triangle mesh.

Parameters:

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

vertex list of a polyline or triangle mesh

required
F numpy int array, optional (default

if None or (m,2), interpret input as ordered polyline; if (m,3) numpy int array, interpred as face index list of a triangle mesh

None

Returns:

Name Type Description
dblA (m,) numpy double array

vector of twice the (unsigned) area/length

See Also

doublearea_intrinsic.

Examples:

TO-DO

Source code in src/gpytoolbox/doublearea.py
 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
36
37
38
39
40
41
42
43
44
45
46
47
def doublearea(V,F=None):
    """Construct the doublearea of each element of a line or triangle mesh.

    Parameters
    ----------
    V : (n,d) numpy array
        vertex list of a polyline or triangle mesh
    F : numpy int array, optional (default: None)
        if None or (m,2), interpret input as ordered polyline;
        if (m,3) numpy int array, interpred as face index list of a triangle
        mesh

    Returns
    -------
    dblA : (m,) numpy double array
        vector of twice the (unsigned) area/length 

    See Also
    --------
    doublearea_intrinsic.

    Examples
    --------
    TO-DO
    """

    # if you didn't pass an F then this is a ordered polyline
    if (F is None):
        F = edge_indices(V.shape[0])

    simplex_size = F.shape[1]
    # Option 1: simplex size is two
    if simplex_size==2:
        # Then this is just finite difference with varying edge lengths
        A = np.linalg.norm(V[F[:,1],:] - V[F[:,0],:],axis=1)
        dblA = 2.0*A

    if simplex_size==3:
        l_sq = halfedge_lengths_squared(V,F)
        dblA = doublearea_intrinsic(l_sq,F)

    return dblA