Skip to content

cotangent_laplacian_intrinsic

cotangent_laplacian_intrinsic(l_sq, F, n=None)

Builds the (pos. def.) cotangent Laplacian for a triangle mesh.

Parameters:

Name Type Description Default
l_sq (m,3) numpy array

squared halfedge lengths as computed by halfedge_lengths_squared

required
F (m,3) numpy int array

face index list of a triangle mesh

required

Returns:

Name Type Description
L (n,n) scipy csr_matrix

cotangent Laplacian

Examples:

TODO

Source code in src/gpytoolbox/cotangent_laplacian_intrinsic.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
36
37
38
39
40
41
42
43
def cotangent_laplacian_intrinsic(l_sq,F,n=None):
    """Builds the (pos. def.) cotangent Laplacian for a triangle mesh.

    Parameters
    ----------
    l_sq : (m,3) numpy array
        squared halfedge lengths as computed by halfedge_lengths_squared
    F : (m,3) numpy int array
        face index list of a triangle mesh

    Returns
    -------
    L : (n,n) scipy csr_matrix
        cotangent Laplacian

    Examples
    --------
    TODO

    """

    assert F.shape[1] == 3
    assert l_sq.shape == F.shape
    assert np.all(l_sq>=0)

    if n==None:
        n = np.max(F)+1

    C = cotangent_weights_intrinsic(l_sq,F)

    rows = np.concatenate((F[:,0], F[:,1], F[:,1], F[:,2], F[:,2], F[:,0],
        F[:,0], F[:,1], F[:,2]))
    cols = np.concatenate((F[:,1], F[:,0], F[:,2], F[:,1], F[:,0], F[:,2],
        F[:,0], F[:,1], F[:,2]))
    data = np.concatenate((-C[:,2], -C[:,2], -C[:,0], -C[:,0], -C[:,1], -C[:,1],
        C[:,1]+C[:,2], C[:,2]+C[:,0], C[:,0]+C[:,1]))
    L = sp.sparse.csr_matrix((data, (rows,cols)), shape=(n,n))

    return L