capytaine.meshes.geometry module

capytaine.meshes.geometry.clustering(faces: ndarray[tuple[Any, ...], dtype[integer]]) List[ndarray[tuple[Any, ...], dtype[integer]]][source]

Clustering of vertices per connected faces.

Parameters:

faces (NDArray[np.integer]) – Mesh faces. Expecting a numpy array of shape N_faces x N_vertices_per_face.

Returns:

Groups of connected vertices.

Return type:

list[NDArray[np.integer]]

capytaine.meshes.geometry.compute_distance_between_points(a, b)[source]

Compute Euclidean distance between two points in n-dimensional space.

Parameters:

a, b (array_like) – Coordinate arrays (length 3 or more).

Returns:

Euclidean distance.

Return type:

float

capytaine.meshes.geometry.compute_faces_areas(vertices, faces)[source]
capytaine.meshes.geometry.compute_faces_centers(vertices, faces)[source]
capytaine.meshes.geometry.compute_faces_normals(vertices, faces)[source]
capytaine.meshes.geometry.compute_faces_radii(vertices, faces)[source]
capytaine.meshes.geometry.compute_gauss_legendre_2_quadrature(vertices, faces)[source]
capytaine.meshes.geometry.connected_components(mesh)[source]

Returns a list of meshes that each corresponds to the a connected component in the original mesh. Assumes the mesh is mostly conformal without duplicate vertices.

capytaine.meshes.geometry.connected_components_of_waterline(mesh, z=0.0)[source]
capytaine.meshes.geometry.faces_in_group(faces: ndarray[tuple[Any, ...], dtype[integer]], group: ndarray[tuple[Any, ...], dtype[integer]]) ndarray[tuple[Any, ...], dtype[bool]][source]

Identification of faces with vertices within group.

Parameters:
  • faces (NDArray[np.integer]) – Mesh faces. Expecting a numpy array of shape N_faces x N_vertices_per_face.

  • group (NDArray[np.integer]) – Group of connected vertices

Returns:

Mask of faces containing vertices from the group

Return type:

NDArray[np.bool]

capytaine.meshes.geometry.get_vertices_face(face, vertices)[source]