|
|
| FaceT ()=default |
| | Default constructor. Sets the half-edge index to the unset sentinel and the inside/outside algorithm to crossing number algorithm.
|
| |
| | FaceT (const uint32_t a_edgeIndex) |
| | Partial constructor. Calls default constructor but associates a half-edge.
|
| |
| | FaceT (const Face &a_otherFace)=default |
| | Copy constructor.
|
| |
| | FaceT (Face &&a_otherFace)=default |
| | Move constructor.
|
| |
|
| ~FaceT ()=default |
| | Destructor (does nothing)
|
| |
| Face & | operator= (const Face &a_otherFace)=default |
| | Copy assignment operator.
|
| |
| Face & | operator= (Face &&a_otherFace)=default |
| | Move assignment operator.
|
| |
| void | define (const Vec3 &a_normal, const uint32_t a_edgeIndex) noexcept |
| | Define function which sets the normal vector and half-edge index.
|
| |
| void | reconcile (const Mesh &a_mesh) |
| | Reconcile face. This will compute the normal vector, area, centroid, and the 2D embedding of the polygon.
|
| |
| void | computeProjectionDirections () noexcept |
| | Compute the 2D embedding of this polygon from the current normal vector and topology, without touching the normal vector, centroid, or area.
|
| |
|
void | flipNormal () noexcept |
| | Flip the normal vector.
|
| |
| void | setHalfEdge (const uint32_t a_halfEdgeIndex) noexcept |
| | Set the half edge index.
|
| |
| void | setInsideOutsideAlgorithm (InsideOutsideAlgorithm a_algorithm) noexcept |
| | Set the inside/outside algorithm when determining if a point projects to the inside or outside of the polygon.
|
| |
| uint32_t | getHalfEdgeIndex () const noexcept |
| | Get the index of the starting half-edge.
|
| |
| Vec3T< T > & | getCentroid () noexcept |
| | Get modifiable centroid.
|
| |
| const Vec3T< T > & | getCentroid () const noexcept |
| | Get immutable centroid.
|
| |
| T & | getCentroid (const size_t a_dir) noexcept |
| | Get modifiable centroid position in specified coordinate direction.
|
| |
| const T & | getCentroid (const size_t a_dir) const noexcept |
| | Get immutable centroid position in specified coordinate direction.
|
| |
| Vec3T< T > & | getNormal () noexcept |
| | Get modifiable normal vector.
|
| |
| const Vec3T< T > & | getNormal () const noexcept |
| | Get immutable normal vector.
|
| |
| T & | getArea () noexcept |
| | Get modifiable polygon area (computed during reconcile()).
|
| |
| const T & | getArea () const noexcept |
| | Get immutable polygon area (computed during reconcile()).
|
| |
| T | signedDistance (const Vec3 &a_x0, const Mesh &a_mesh) const noexcept |
| | Compute the signed distance to a point.
|
| |
| T | rayCrossing (const Vec3 &a_origin, const Vec3 &a_direction, T a_tMin, T a_tMax, const Mesh &a_mesh) const noexcept |
| | Where a ray crosses the face, from either side.
|
| |
| T | unsignedDistance2 (const Vec3 &a_x0, const Mesh &a_mesh) const noexcept |
| | Compute the unsigned squared distance to a point.
|
| |
| std::vector< Vec3T< T > > | getAllVertexCoordinates (const Mesh &a_mesh) const |
| | Return the coordinates of all the vertices on this polygon.
|
| |
| std::vector< uint32_t > | gatherVertexIndices (const Mesh &a_mesh) const |
| | Return the indices of all the vertices on this polygon.
|
| |
| std::vector< uint32_t > | gatherEdgeIndices (const Mesh &a_mesh) const |
| | Return the indices of all the half-edges on this polygon.
|
| |
| Vec3T< T > | getSmallestCoordinate (const Mesh &a_mesh) const noexcept |
| | Get the lower-left-most coordinate of this polygon face.
|
| |
| Vec3T< T > | getHighestCoordinate (const Mesh &a_mesh) const noexcept |
| | Get the upper-right-most coordinate of this polygon face.
|
| |
|
| void | computeCentroid (const Mesh &a_mesh) |
| | Compute the centroid position of this polygon.
|
| |
| void | computeNormal (const Mesh &a_mesh) |
| | Compute the unit normal vector of this polygon (Newell's method).
|
| |
| void | computeArea (const Mesh &a_mesh) |
| | Compute the area of this polygon and cache it in m_area.
|
| |
| void | normalizeNormalVector () noexcept |
| | Normalize the normal vector, ensuring it has a length of 1.
|
| |
| Vec3T< T > | projectPointIntoFacePlane (const Vec3 &a_p) const noexcept |
| | Compute the projection of a point onto the polygon face plane.
|
| |
| bool | isPointInsideFace (const Vec3 &a_p, const Mesh &a_mesh) const noexcept |
| | Check if a point projects to inside or outside the polygon face.
|
| |
| Vec2T< T > | projectPoint (const Vec3 &a_point) const noexcept |
| | Project a 3D point to this face's 2D embedding by dropping one coordinate.
|
| |
| int | computeWindingNumber (const Vec2T< T > &a_point, const Mesh &a_mesh) const noexcept |
| | Compute the winding number of this polygon's boundary around a projected 2D point.
|
| |
| size_t | computeCrossingNumber (const Vec2T< T > &a_point, const Mesh &a_mesh) const noexcept |
| | Compute the crossing number of a +x ray from a projected 2D point with this polygon.
|
| |
| T | computeSubtendedAngle (const Vec2T< T > &a_point, const Mesh &a_mesh) const noexcept |
| | Compute the total subtended angle of this polygon's edges around a projected 2D point.
|
| |
template<class T>
class EBGeometry::DCEL::FaceT< T >
Face class for navigating a DCEL mesh.
Class which represents a polygon face in a doubly-connected edge list (DCEL).
- Template Parameters
-
| T | Floating-point precision type. |
This class is a polygon face in a DCEL mesh. It stores the index of one of the half-edges that circulate the inside of the polygon face, as well as having a normal vector, a centroid, and an area. This class supports signed distance computations. These computations require algorithms that compute e.g. the winding number of the polygon, or the number of times a ray cast passes through it. Thus, one of its central features is that it can be embedded in 2D by projecting it along the cardinal direction of its normal vector.
- Note
- To compute the distance from a point to the face one must determine if the point projects "inside" or "outside" the polygon. There are several algorithms for this, and by default this class uses a crossing number algorithm.
-
m_halfEdge is an index into the owning DCEL::MeshT's own edge array, resolved by passing that mesh to the accessors below (see EdgeT for why indices rather than pointers are used). Every other member is a plain value (Vec3, T, uint32_t, an enum), so FaceT itself is trivially copyable – it can be memcpy'd or mirrored to a different address space with no pointer patching, as long as it is interpreted against the same mesh's arrays on the other side.
-
A face's id is its index in the owning mesh's face array; the mesh SDFs report it from getClosestFace(). Per-face data such as a material lives in the caller's own array, indexed by it.
-
Methods that stream through the half-edge loop via EdgeIterator with no allocation (define, reconcile's helpers other than computeCentroid/computeNormal/computeArea, computeProjectionDirections, flipNormal, setHalfEdge/setInsideOutsideAlgorithm, normalizeNormalVector, the getters, projectPointIntoFacePlane/projectPoint, computeWindingNumber/computeCrossingNumber/computeSubtendedAngle, isPointInsideFace, signedDistance, rayCrossing, unsignedDistance2, getSmallestCoordinate/getHighestCoordinate) are annotated EBGEOMETRY_HOST_DEVICE. computeCentroid/computeNormal/computeArea (and therefore reconcile, which calls all three) and gatherVertexIndices/gatherEdgeIndices/getAllVertexCoordinates all materialize a std::vector, so they remain EBGEOMETRY_HOST.
- Template Parameters
-
| T | Floating-point precision type. |
Where a ray crosses the face, from either side.
The ray is a_origin + t * a_direction. The face is taken to be planar and convex, as the mesh SDFs require: the ray meets the face's plane at one t, and that point is inside the face if it is on the inner side of every edge (which side that is, the loop's orientation about the normal says). The edge tests are widened by the rounding error of that point, a distance of a few ulps of the coordinates and of t, so that a ray through an edge or vertex shared by two faces crosses at least one of them however far it comes from; a point counted that way must also be that close to the edge's extent, so that a sliver is not crossed far beyond its corners. A ray in the face's plane, or a face of zero area, crosses nothing. The plane is the one through the face's centroid with its normal: for a face that is not quite planar, a ray nearly in it can cross at a t that differs from the vertices' by the face's deviation from planarity.
- Parameters
-
| [in] | a_origin | Ray origin. |
| [in] | a_direction | Ray direction. |
| [in] | a_tMin | Start of the interval. |
| [in] | a_tMax | End of the interval. |
| [in] | a_mesh | Owning mesh, used to resolve the half-edge loop. |
- Returns
- The distance along the ray of the crossing in [a_tMin, a_tMax], or +infinity if there is none.