Low-Level Geometry#

The low-level geometry functionality of iskra ✨. Functions in this module deal directly with low-level geometric constructs necessary to build up higher level algorithms. Except in a few select cases (like iskra.vertex_normals), the functions in this module are unaware of any mesh or mesh topology and operate directly on points, simplices, coordinate systems, or things like quaternions.

iskra.geometry.barycentric#

barycentric_coordinates(x, simplices[, eps])

Computes the barycentric coordinates of points on simplices.

barycentric_interpolate(values, bary)

Interpolate values onto a position given barycentric coordinates.

edge_barycentric_coordinates(x, edges[, eps])

Computes the barycentric coordinates of points on edges.

is_inside_pairwise(x, simplices[, eps])

Checks whether each of the points in x is in any of the simplices in simplices.

tetrahedron_barycentric_coordinates(x, tets)

Computes the barycentric coordinates of points in tetrahedra.

triangle_barycentric_coordinates(x, triangles)

Computes the barycentric coordinates of points on triangles.

iskra.geometry.distances#

clamped_length(x[, dim, keepdim, eps])

Computes the lengths of a set of vectors and then clamps them.

clamped_length_sqr(x[, dim, keepdim, eps])

Computes the _squared_ lengths of a set of vectors and then clamps them.

closest_edge(x, edges)

Finds the closest edges to a set of points.

closest_simplex(x, simplices)

Finds the closest simplex to a set of points.

closest_triangle(x, triangles)

Finds the closest triangles to a set of points.

edge_project(x, edges)

Projects a point onto the closest point on an edge.

edge_to_line(edges)

Computes the origin-normal representation of a line passing through edges.

hyperplane_project(x, origin, normal)

Projects points x onto (hyper)planes defined in the origin-normal form.

point_dist(x, y[, ord, keepdim])

Computes the distance between batches of vectors x_i and y_i.

point_dist_matrix(x, y[, ord])

point_edge_dist(x, edges)

Distance of a point to its closest point on an edge.

point_edge_dist_matrix(x, edges)

Pairwise distances between a set of points and a set of edges.

point_simplex_dist(x, simplices)

Distance of a point to its closest point on an tetrahedron.

point_simplex_dist_matrix(x, simplices)

Pairwise distances between a set of points and a set of simplices.

point_tetrahedron_dist(x, tetrahedra)

Distance of a point to its closest point on an tetrahedron.

point_tetrahedron_dist_matrix(x, tetrahedra)

Pairwise distances between a set of points and a set of tetrahedra.

point_triangle_dist(x, triangles)

Distance of a point to its closest point on an triangle.

point_triangle_dist_matrix(x, triangles)

Pairwise distances between a set of points and a set of edges.

simplex_codim(simplices)

Codimension of a set of simplices.

simplex_project(x, simplices)

Projects a point onto the closest point on a simplex.

tetrahedron_project(x, tetrahedra)

Projects a 3D point onto the closest point in a tetrahedron.

tetrahedron_udf(x, tetrahedra)

Unsigned distance function of a 3D point to the boundary of a tetrahedron.

triangle_project(x, triangles)

Projects a point onto the closest point on an triangle.

triangle_to_plane(triangles)

Computes the origin-normal representation of a plane passing through a triangle.

triangle_udf(x, triangles)

Unsigned distance function of a 2D point to the boundary of a triangle.

iskra.geometry.volume#

edge_lengths(edges)

Computes the lengths of a list of edges.

tetrahedron_volumes(tets)

Computes the volumes of a list of tetrahedra in 3D.

tetrahedron_volumes_intrinsic(edge_lengths, ...)

Computes the volume of tetrahedra from edge lengths alone.

triangle_areas(triangles)

Computes the areas of a list of triangles.

triangle_areas_intrinsic(edge_lengths, ...)

Computes the areas of a list of triangles from edge lengths alone.

volume_form(simplices)

Computes the generalized volumes of a list of simplices.

volume_form_intrinsic(edge_lengths, face_to_edge)

Computes the generalized volume of simplices from edge lengths alone.

iskra.geometry.angles#

interior_angles(triangles[, signed, ...])

Computes the interior angles in a triangle embedded in 3D.

iskra.geometry.bbox#

BBox(min, max)

iskra.geometry.coordinate_system#

normal_coordinate_system(n)

Build frame (tangent and binormal) from only a normal.

triangle_coordinate_system(triangles)

Build frame (normal, tangent and binormal) from triangles.

iskra.geometry.element_quality#

abs_tetrahedron_heights(vertices, tet_idcs)

triangle_altitudes(points)

iskra.geometry.normals#

edge_length_normals(edges)

Normals of line segments in 2D scaled by the edge length.

edge_normals(edges)

Normals of line segments in 2D.

face_normals(simplices)

Computes per-face normals.

triangle_area_normals(triangles)

Normals of triangles in 2D or 3D scaled by the triangle area.

triangle_normals(triangles)

Normals of triangles in 2D or 3D.

vertex_normals(verts, faces[, method])

Comptues per-vertex normals.

volume_face_normals(simplices)

Computes face normals weighted by the hypervolume of the element.