mesh_util
Short description
@author: Moritz F P Becker
- pyrid.geometry.mesh_util.closest_boundary_point(pos, AABB, System_AABB)[source]
Calculates the closest point on a boundary of an axis aligned bounding box (AABB) to a position vector.
- Parameters
- posfloat64[3]
Position vector.
- AABBfloat64[2,3]
Array containing the two vector points that represent the lower left and upper right corner of the AABB
- System_AABBfloat64[2,3]
Array containing the two vector points that represent the lower left and upper right corner of the AABB of the simulation box.
- Returns
- float64[3]
Point on the AABB boundary that is closest to the position vector.
- pyrid.geometry.mesh_util.mesh_volume(triangles, vertices)[source]
Calculates the volume of a mesh.
- Parameters
- trianglesint64[:,3]
List of vertex indices that make up the trinagles of the mesh
- verticesfloat64[:,3]
Vertices of the mesh
- Returns
- float64
Mesh volume
- pyrid.geometry.mesh_util.point_triangle_distance(p0, p1, p2, pos, pos_tri=None)[source]
Calculates the distance between a point and a triangle. Based on [9]: 3D Game Engine Design, Eberly D. H., Chapter: 14.3 Point to triangle. https://www.geometrictools.com/Documentation/DistancePoint3triangle3.pdf
- Parameters
- p0float64[3]
Vertex 1
- p1float64[3]
Vertex 2
- p2float64[3]
Vertex 3
- posfloat64[3]
position vector.
- Returns
- tuple(float64, int64)
Distance to triangle, triangle region
- pyrid.geometry.mesh_util.triangle_area(p0, p1, p2)[source]
Calculates the area of a triangle.
- Parameters
- p0float64[3]
Vertex 1
- p1float64[3]
Vertex 2
- p2float64[3]
Vertex 3
- Returns
- float64
Triangle area
- pyrid.geometry.mesh_util.triangle_centroid(p0, p1, p2)[source]
Calculates the centroid of a triangle.
- Parameters
- p0float64[3]
Vertex 1
- p1float64[3]
Vertex 2
- p2float64[3]
Vertex 3
- Returns
- float64
Triangle centroid
- pyrid.geometry.mesh_util.triangle_volume_signed(p0, p1, p2)[source]
Calculates the signed volume of a the tetraeder represented by a triangle and the coordinate system origin. PyRID uses the signed tetraeder volume to calculate the volume of a mesh.
- Parameters
- p0float64[3]
Vertex 1
- p1float64[3]
Vertex 2
- p2float64[3]
Vertex 3
- Returns
- float64
Signed tetraeder volume