porepy.geometry.point_in_polyhedron_test module

This module implements a robust point in polyhedron test supporting non-convex polyhedra.

class PointInPolyhedronTest(vertices, connectivity, tol=1e-10)[source]

Bases: object

This class implements a robust point in polyhedron test supporting non-convex polyhedra.

The implementation is based on the reference: Robust inside-outside segmentation using generalized winding numbers (https://doi.org/10.1145/2461912.2461916)

Implementation requires consistent orientation of the triangulated surface.

Parameters
  • vertices (np.ndarray[Any, np.dtype[np.float64]]) –

    shape=(num_pt, 3)

    Triangulation vertices.

  • connectivity (np.ndarray[Any, np.dtype[np.int64]]) –

    shape=(num_triangles, 3)

    Triangulation connectivity map.

  • tol (float) –

    default=1e-10

    Geometric tolerance, used in comparison of points, areas and volumes.

solid_angle(R)[source]

Implements an analytical expression for the solid angle.

The solid angle is described by a plane triangle surface S at some arbitrary point P. It is the measure of the intersection of the three-dimensional unit sphere centered at P and the conic hull defined by the vectors in R.

The implementation is based on equation (6) in reference: Robust inside-outside segmentation using generalized winding numbers (https://doi.org/10.1145/2461912.2461916)

Raises

ValueError – If the origin [0,0,0] point coincides with a vertex, is collinear with the vertices, or is coplanar with the vertices.

Parameters

R (ndarray[Any, dtype[float64]]) –

shape=(num_pt, 3)

Translated triangle’s points at origin (0,0,0). The original triangle’s points need to be translated by subtracting the arbitrary point P.

Returns

The solid angle measured in steradians.

Return type

float

winding_number(point)[source]

Computes the winding number of a closed triangulated surface at given point.

Parameters

point (ndarray[Any, dtype[float64]]) –

shape=(1, 3)

The point being tested.

Returns

The winding number generalized to R^3. Its absolute value |wn| is 0 for points outside the polyhedron, 1 for points inside non-convex polyhedron and |wn| > 1 for points inside overlapping polyhedron.

Return type

float