magnet.geometric_utils#

Geometric utilities module.

Contains functions used for geometric operations, e.g. volume, centroid and distance computations.

Functions

closest_to_face(face_verts, p)

Compute the point of a face closest to a given point.

closest_to_segment(x1, x2, p)

Compute the point of a segment closest to 1a given point.

closest_to_triangle(triangle_v, p)

Compute the point of a triangle closest to a given point.

convexHull_center(vertices)

Compute the centroid of the convex hull of a set of points.

linear_constrained_least_squares(C, d, Aeq, ...)

Solve linear constrained least squares problem.

maximum_sq_distance(points)

Compute the squared diameter of a set of points.

polygon_area_vector(v)

Compute area vector of a polygon in 3D space.

polygon_centroid(v)

Compute the centroid of a 2D polygon.

project(x1, x2, p)

Project a point onto a line.

shoelace_formula(v)

Compute the area of a 2D polygon.

tetrahedron_center(vertices)

Compute the baricenter of a simplex.

tetrahedron_volume(vertices)

Compute the volume of a simplex.