mymesh.curvature.CubicFit#
- mymesh.curvature.CubicFit(NodeCoords, SurfConn, NodeNeighborhoods, NodeNormals, jit=True, return_directions=False)[source]#
Mesh based curvatures by cubic surface fitting. Curvatures calculated in this way are sensitive to triangulation, with highly skewed triangles contributing error. From Goldfeather & Interrante (2004). [GI04]
If Principal Directions are returned (return_directions=True), the signs of the the directions vectors are not well defined and some may be flipped relative to other adjacent points. Despite this ambiguity, the directions are defined such that cross product of the maximum principal directions with the mininum principal directions (np.cross(MaxPrincipalDirection, MinPrincipalDirection)) are oriented consistently with the normal vectors of the surface.
- Parameters:
NodeCoords (list, np.ndarray) – List of nodal coordinates.
SurfConn (list, np.ndarray) – Nodal connectivity list for a surface mesh.
NodeNeighbors (list) – List of neighbors for each node. This can be obtained with utils.getNodeNeighbors or mesh.NodeNeighbors.
NodeNormals (list, np.ndarray) – Unit normal vectors for each node in a nx3 array. This can be obtained with utils.CalcFaceNormal and utils.Face2NodeNormal, or mesh.NodeNormals.
jit (bool) – If True, will attempt to use numba jit compilation for curvature calculation. In general, the jit version should perform noticeably faster than the alternative vectorized approach, which encounters overhead due to the non-rectangular nature of the neighborhoods list. Numba must be installed for this option to work, and mymesh.check_numba() should return True.
return_directions (bool, optional) – If True, will return the principal curvature directions as well as magnitudes
- Returns:
MaxPrincipal (list) – List of maximum principal curvatures for each node.
MinPrincipal (list) – List of minimum principal curvatures for each node.
MaxPrincipalDirection (np.ndarray, optional) – Unit vector associated with the maximum principal curvature. Returned if return_directions is True.
MinPrincipalDirection (np.ndarray, optional) – Unit vector associated with the minimum principal curvature. Returned if return_directions is True.