capytaine.meshes.abstract_meshes module¶
- class capytaine.meshes.abstract_meshes.AbstractMesh[source]¶
Bases:
SurfaceIntegralsMixin,ABC- abstractmethod clipped(*, origin, normal, name=None) AbstractMesh[source]¶
- abstractmethod copy() AbstractMesh[source]¶
- edges_faces_water_line()[source]¶
Extract the water line of the mesh.
- Returns:
A tuple (edges, faces) where the edges are the edges of the water line (pairs of vertex indices) and the faces are the corresponding faces of the mesh that contain these edges (quadruplet of vertex indices).
- Return type:
(np.ndarray, np.ndarray)
- property edges_waterline¶
Return an array with the edges of the water line as pairs of vertex indices with shape (nb_edges_waterline,2).
- abstractmethod extract_faces(faces_id, *, name=None) AbstractMesh[source]¶
- extract_wedge(n: int, axis: str = 'z') AbstractMesh[source]¶
Extract a wedge (angular sector) from the mesh for rotational symmetry.
Extracts a 1/n sector of the mesh by clipping at angular boundaries. This creates proper faces at the wedge boundaries for clean reconstruction.
- Parameters:
n (int) – The rotation order. The wedge will span 360/n degrees.
axis (str, optional) – Only “z” is currently supported.
- Returns:
A new mesh containing the wedge sector with proper boundary faces.
- Return type:
Examples
Extract 1/3 of a sphere (120-degree wedge):
>>> sphere = mesh_sphere(radius=1.0, resolution=(12, 12)) >>> wedge = sphere.extract_wedge(n=3) >>> wedge.nb_faces # Approximately 1/3 of sphere.nb_faces
- abstract property faces: ndarray¶
- abstract property faces_areas: ndarray¶
- abstract property faces_centers: ndarray¶
- abstract property faces_normals: ndarray¶
- abstract property faces_radiuses: ndarray¶
- property faces_water_line¶
Return an array with the faces of the water line as quadruplets of vertex indices with shape (nb_edges_waterline,4).
- immersed_part(free_surface=0.0, *, sea_bottom=None, water_depth=None) AbstractMesh[source]¶
Clip the mesh to keep only the part below the free surface.
- Parameters:
free_surface (float) – The \(z\) coordinate of the free surface (default: 0.0)
water_depth (Optional[float]) – The water depth, as a positive value (default: infinity)
- Returns:
A new Mesh instance that has been clipped.
- Return type:
- abstractmethod join_meshes(*, return_masks=False, name=None) AbstractMesh[source]¶
- property length_edges_water_line¶
Return an array with the lengths of the edges of the water line with shape (nb_edges_waterline,).
- abstractmethod merged() AbstractMesh[source]¶
- mirrored(plane: Literal['xOz', 'yOz'], *, name=None) AbstractMesh[source]¶
- property nb_edges_waterline: int¶
Number of edges in the water line.
- abstract property nb_faces: int¶
- abstract property nb_vertices: int¶
- pop_metadata(metadata_name) Tuple[AbstractMesh, ndarray][source]¶
- abstract property quadrature_points: ndarray¶
- rotated_such_that_vectors_are_aligned(a, b, *, eps=1e-08, name=None) AbstractMesh[source]¶
- abstractmethod rotated_with_matrix(R, *, name=None) AbstractMesh[source]¶
- rotated_x(angle: float, *, name=None) AbstractMesh[source]¶
Return a new Mesh rotated around the x-axis using the provided rotation angle in radians
- rotated_y(angle: float, *, name=None) AbstractMesh[source]¶
Return a new Mesh rotated around the y-axis using the provided rotation angle in radians
- rotated_z(angle: float, *, name=None) AbstractMesh[source]¶
Return a new Mesh rotated around the z-axis using the provided rotation angle in radians
- show_matplotlib(**kwargs)[source]¶
Equivalent to show(backend=”matplotlib”). See also
show_matplotlib()
- show_pyvista(**kwargs)[source]¶
Equivalent to show(backend=”pyvista”). See also
show_pyvista()
- abstractmethod translated(shift, *, name=None) AbstractMesh[source]¶
- translated_x(dx: float, *, name=None) AbstractMesh[source]¶
Return a new Mesh translated in the x-direction along dx.
- translated_y(dy: float, *, name=None) AbstractMesh[source]¶
Return a new Mesh translated in the y-direction along dy.
- translated_z(dz: float, *, name=None) AbstractMesh[source]¶
Return a new Mesh translated in the z-direction along dz.
- water_line_integral(data)[source]¶
Returns integral of given data along the water line.
- Parameters:
data (np.ndarray) – Values of the function to integrate, with shape (nb_edges_waterline,).
- Returns:
Value of the integral.
- Return type:
float
- with_metadata(**new_metadata) AbstractMesh[source]¶
- abstractmethod with_normal_vector_going_down(**kwargs) AbstractMesh[source]¶
- without_any_metadata() AbstractMesh[source]¶
- without_metadata(*metadata_names) AbstractMesh[source]¶
- property z_span: Tuple[float, float]¶