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]¶
- 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¶
- 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]¶
- abstractmethod merged() AbstractMesh[source]¶
- mirrored(plane: Literal['xOz', 'yOz'], *, name=None) AbstractMesh[source]¶
- 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.
- 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]¶