capytaine.meshes.geometry module
Tools to describe geometric objects in 3D.
Based on meshmagick <https://github.com/LHEEA/meshmagick> by François Rongère.
-
class capytaine.meshes.geometry.Abstract3DObject[source]
Bases: ABC
Abstract class for 3d objects that can be transformed in 3d.
The child classes have to define mirror, rotate and translate,
then more routines such as translate_x and translated are automatically available.
-
abstract mirror(plane)[source]
-
mirrored(*args, **kwargs)[source]
-
abstract rotate(axis, angle)[source]
-
rotate_around_center_to_align_vectors(*args, inplace=True, name=None, **kwargs)[source]
-
rotate_x(*args, inplace=True, name=None, **kwargs)[source]
-
rotate_y(*args, inplace=True, name=None, **kwargs)[source]
-
rotate_z(*args, inplace=True, name=None, **kwargs)[source]
-
rotated(*args, **kwargs)[source]
-
rotated_around_center_to_align_vectors(*args, **kwargs)[source]
-
rotated_x(*args, **kwargs)[source]
-
rotated_y(*args, **kwargs)[source]
-
rotated_z(*args, **kwargs)[source]
-
abstract translate(vector)[source]
-
translate_point_to_point(*args, inplace=True, name=None, **kwargs)[source]
-
translate_x(*args, inplace=True, name=None, **kwargs)[source]
-
translate_y(*args, inplace=True, name=None, **kwargs)[source]
-
translate_z(*args, inplace=True, name=None, **kwargs)[source]
-
translated(*args, **kwargs)[source]
-
translated_point_to_point(*args, **kwargs)[source]
-
translated_x(*args, **kwargs)[source]
-
translated_y(*args, **kwargs)[source]
-
translated_z(*args, **kwargs)[source]
-
class capytaine.meshes.geometry.Axis(vector=(1, 0, 0), point=(0, 0, 0))[source]
Bases: Abstract3DObject
-
angle_with_respect_to(other_axis: Axis) → float[source]
Angle between two axes.
-
copy(name=None)[source]
-
is_orthogonal_to(other)[source]
-
is_parallel_to(other)[source]
-
mirror(*args, inplace=True, name=None, **kwargs)[source]
-
rotate(*args, inplace=True, name=None, **kwargs)[source]
-
rotate_points(points, angle)[source]
-
rotate_vectors(vectors, angle)[source]
-
rotation_matrix(theta)[source]
Rotation matrix around the vector according to Rodrigues’ formula.
-
translate(*args, inplace=True, name=None, **kwargs)[source]
-
class capytaine.meshes.geometry.ClippableMixin[source]
Bases: ABC
Abstract base class for object that can be clipped.
The child classes should implement a clip method, then this abstract
class will append the new methods clipped, keep_immersed_part and
immersed_part, all based on clip.
-
abstract clip(plane)[source]
-
clipped(plane, **kwargs)[source]
-
immersed_part(free_surface=0.0, *, sea_bottom=None, water_depth=None)[source]
-
keep_immersed_part(*args, inplace=True, name=None, **kwargs)[source]
-
class capytaine.meshes.geometry.Plane(normal=(0.0, 0.0, 1.0), point=(0.0, 0.0, 0.0))[source]
Bases: Abstract3DObject
3D plane, oriented by the direction of their normal.
-
property c
Distance from plane to origin.
-
copy(name=None)[source]
-
distance_to_point(points)[source]
Return the orthogonal distance of points with respect to the plane.
The distance is counted positively on one side of the plane and negatively on the other.
- Parameters:
points (ndarray) – Array of points coordinates
- Returns:
dist – Array of distances of points with respect to the plane
- Return type:
ndarray
-
get_edge_intersection(p0, p1)[source]
Returns the coordinates of the intersection point between the plane and the edge P0P1.
- Parameters:
-
- Returns:
I – Coordinates of intersection point
- Return type:
ndarray
-
is_orthogonal_to(other)[source]
-
mirror(*args, inplace=True, name=None, **kwargs)[source]
-
rotate(*args, inplace=True, name=None, **kwargs)[source]
-
property s
Distance from origin to plane along the normal
-
translate(*args, inplace=True, name=None, **kwargs)[source]
-
capytaine.meshes.geometry.inplace_transformation(inplace_function)[source]
Decorator for methods transforming 3D objects:
* Add the optional argument inplace to return a new object instead of doing the transformation in place.
* If the object has properties cached in an “__internals__” dict, they are deleted.
-
capytaine.meshes.geometry.orthogonal_vectors(vec1, vec2) → bool[source]
-
capytaine.meshes.geometry.parallel_vectors(vec1, vec2) → bool[source]
-
capytaine.meshes.geometry.parallel_vectors_with_same_direction(vec1, vec2) → bool[source]