geometry#

Numba-compiled computational geometry routines needed for regridding operations.

Functions

area_triangle(vertex_1, vertex_2)

Compute the signed area of the triangle formed by two vertices and the origin.

bounding_boxes_intersect_2d(x_p1, y_p1, ...)

Test if two bounding boxes, \(p\) and \(q\), intersect.

bounding_boxes_intersect_3d(x_p1, y_p1, ...)

Test if two bounding boxes, \(p\) and \(q\), intersect.

line_equation_2d(x, y, x1, y1, x2, y2)

Test if a given point lies above, on, or below a line specified by two endpoints.

line_intersects_triangle(tuv)

Check whether a given line segment intersects with a triangle.

line_triangle_intersection(line, tuv)

Compute the 3D point where a line intersects a triangle using the Parametric form described in the Line-plane intersection Wikipedia article.

line_triangle_intersection_parameters(line, ...)

Compute the parameters \(t,u,v\) describing the point of intersection between a line and triangle in 3D.

point_is_inside_box_2d(point, box)

Check if a given query point is contained within a 2D box specified by two opposite corners.

point_is_inside_box_3d(point, box)

Check if a given query point is contained within a 3D box specified by two opposite corners.

point_is_inside_polygon(x, y, vertices_x, ...)

Check if a given point is inside or on the boundary of a polygon specified by its vertices.

point_is_inside_polyhedron(point, polyhedron)

Check if the given point is inside or on the boundary of a polyhedron defined by a sequence of triangles.

solid_angle(point, triangle[, epsilon])

Calculate the solid angle subtended by a triangle with respect to a query point.

two_line_segment_intersection(p1, p2, t)

Compute the point of intersection between two line segments.

two_line_segment_intersection_parameters(p1, ...)

Computes the parameters (\(t\) and \(u\)) associated with the intersection of two 2D line segments, \(p\) and \(q\).

two_line_segments_intersect(t, u)

Check whether two line segments intersect.

volume_tetrahedron(vertex_1, vertex_2, vertex_3)

Compute the signed volume of the tetrahedron formed by three vertices and the origin