|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Half-edge class for navigating a DCEL mesh. More...
#include <EBGeometry_DCEL_Edge.hpp>

Public Types | |
| using | Vec3 = Vec3T< T > |
| Alias for vector type. | |
| using | Vertex = VertexT< T, Meta > |
| Alias for vertex type. | |
| using | Edge = EdgeT< T, Meta > |
| Alias for edge type. | |
| using | Face = FaceT< T, Meta > |
| Alias for face type. | |
| using | VertexPtr = std::shared_ptr< Vertex > |
| Alias for vertex pointer type. | |
| using | EdgePtr = std::shared_ptr< Edge > |
| Alias for edge pointer type. | |
| using | FacePtr = std::shared_ptr< Face > |
| Alias for face pointer type. | |
Public Member Functions | |
| EdgeT () noexcept=default | |
| Default constructor. Sets all pointers to zero and vectors to zero vectors. | |
| EdgeT (const Edge &a_otherEdge) noexcept | |
| Copy constructor. | |
| EdgeT (Edge &&a_otherEdge)=default | |
| Move constructor. | |
| EdgeT (const VertexPtr &a_vertex) noexcept | |
| Partial constructor. Calls the default constructor but sets the starting vertex. | |
| ~EdgeT ()=default | |
| Destructor (does nothing) | |
| Edge & | operator= (const Edge &a_otherEdge) noexcept |
| Copy assignment operator. | |
| Edge & | operator= (Edge &&a_otherEdge)=default |
| Move assignment operator. | |
| size_t | size () const noexcept |
| Get size (in bytes) of this object. | |
| void | define (const VertexPtr &a_vertex, const EdgePtr &a_pairEdge, const EdgePtr &a_nextEdge) noexcept |
| Define function. Sets the starting vertex, edges, and normal vectors. | |
| void | reconcile () noexcept |
| Reconcile internal logic. | |
| void | flipNormal () noexcept |
| Flip surface normal. | |
| void | setVertex (const VertexPtr &a_vertex) noexcept |
| Set the starting vertex. | |
| void | setPairEdge (const EdgePtr &a_pairEdge) noexcept |
| Set the pair edge. | |
| void | setNextEdge (const EdgePtr &a_nextEdge) noexcept |
| Set the next edge. | |
| void | setFace (const FacePtr &a_face) noexcept |
| Set the pointer to this half-edge's face. | |
| void | setMetaData (const Meta &a_metaData) noexcept |
| Set the meta-data. | |
| VertexPtr | getVertex () noexcept |
| Get the starting vertex. | |
| VertexPtr | getVertex () const noexcept |
| Get the starting vertex (const overload). | |
| VertexPtr | getOtherVertex () noexcept |
| Get the end vertex. | |
| VertexPtr | getOtherVertex () const noexcept |
| Get the end vertex (const overload). | |
| EdgePtr | getPairEdge () noexcept |
| Get the pair edge. | |
| EdgePtr | getPairEdge () const noexcept |
| Get the pair edge (const overload). | |
| EdgePtr | getNextEdge () noexcept |
| Get the next edge. | |
| EdgePtr | getNextEdge () const noexcept |
| Get the next edge (const overload). | |
| Vec3T< T > | computeNormal () const noexcept |
| Compute the normal vector as the average of the face normals on both sides of this edge. | |
| Vec3T< T > & | getNormal () noexcept |
| Get modifiable normal vector. | |
| const Vec3T< T > & | getNormal () const noexcept |
| Get the stored normal vector. | |
| FacePtr | getFace () noexcept |
| Get this half-edge's face. | |
| FacePtr | getFace () const noexcept |
| Get this half-edge's face (const overload). | |
| Meta & | getMetaData () noexcept |
| Get meta-data. | |
| const Meta & | getMetaData () const noexcept |
| Get meta-data. | |
| T | signedDistance (const Vec3 &a_x0) const noexcept |
| Get the signed distance from a_x0 to this half-edge. | |
| T | unsignedDistance2 (const Vec3 &a_x0) const noexcept |
| Get the squared unsigned distance from a_x0 to this half-edge. | |
Protected Member Functions | |
| T | projectPointToEdge (const Vec3 &a_x0) const noexcept |
| Returns the parametric projection of a_x0 onto this edge. | |
| Vec3T< T > | getX2X1 () const noexcept |
| Get the vector pointing along this edge (from start to end vertex). | |
Protected Attributes | |
| Vec3 | m_normal = Vec3::zeros() |
| Normal vector. | |
| std::weak_ptr< Vertex > | m_vertex |
| Starting vertex. | |
| std::weak_ptr< Edge > | m_pairEdge |
| Pair edge. See m_vertex for why this is a weak_ptr. | |
| std::weak_ptr< Edge > | m_nextEdge |
| Next edge. See m_vertex for why this is a weak_ptr. | |
| std::weak_ptr< Face > | m_face |
| Enclosing polygon face. See m_vertex for why this is a weak_ptr. | |
| Meta | m_metaData {} |
| Meta-data attached to this edge. | |
Half-edge class for navigating a DCEL mesh.
Class which represents a half-edge in a double-edge connected list (DCEL).
| T | Floating-point precision type. |
| Meta | User-defined metadata type. |
This class is used in DCEL functionality which stores polygonal surfaces in a mesh. The information contain in an EdgeT object contains the necessary object for logically circulating the inside of a polygon face. This means that a polygon face has a double-connected list of half-edges which circulate the interior of the face. The EdgeT object is such a half-edge; it represents the outgoing half-edge from a vertex, located such that it can be logically represented as a half edge on the "inside" of a polygon face. It contains pointers to the polygon face, vertex, and next half edge It also contains a pointer to the "pair" half edge, i.e. the corresponding half-edge on the other face that shares this edge. Since this class is used with DCEL functionality and signed distance fields, this class also has a signed distance function and thus a "normal vector".
| T | Floating-point precision. |
| Meta | Meta-data type stored per edge. |
|
noexcept |
Copy constructor.
Copies the normal vector and all four topology pointers (vertex, pair edge, next edge, face) from the other half-edge. Meta-data (m_metaData) is deliberately NOT copied – it default-constructs instead; use setMetaData() afterwards if it needs to be populated. Rationale: same as VertexT's copy constructor – these pointers are back-references into a specific mesh's topology (the objects they point to still reference the original edge, not this copy), so copying them wholesale is not topologically meaningful in general, but is occasionally useful (e.g. duplicating an edge's geometric/adjacency snapshot). operator=(const Edge&) has identical semantics.
| [in] | a_otherEdge | Other edge. |
|
default |
Move constructor.
Unlike the copy constructor, this transfers the entire state (including m_metaData) from a_otherEdge, since moving relocates a single object's identity. Defaulted (memberwise move) rather than hand-written: explicitly defaulting is required here since the presence of a user-declared copy constructor would otherwise suppress the implicitly-generated move constructor. Not marked noexcept since Meta is an unconstrained template parameter whose move constructor is not guaranteed to be noexcept.
| [in,out] | a_otherEdge | Other edge. |
|
noexcept |
Partial constructor. Calls the default constructor but sets the starting vertex.
| [in] | a_vertex | Starting vertex. |
|
inlinenoexcept |
Compute the normal vector as the average of the face normals on both sides of this edge.
|
inlinenoexcept |
Define function. Sets the starting vertex, edges, and normal vectors.
| [in] | a_vertex | Starting vertex |
| [in] | a_pairEdge | Pair half-edge |
| [in] | a_nextEdge | Next half-edge |
|
inlinenoexcept |
Get this half-edge's face (const overload).
|
inlinenoexcept |
Get this half-edge's face.
|
inlinenoexcept |
Get meta-data.
|
inlinenoexcept |
Get meta-data.
|
inlinenoexcept |
Get the next edge (const overload).
|
inlinenoexcept |
Get the next edge.
|
inlinenoexcept |
Get the stored normal vector.
|
inlinenoexcept |
Get modifiable normal vector.
|
inlinenoexcept |
Get the end vertex (const overload).
|
inlinenoexcept |
Get the end vertex.
|
inlinenoexcept |
Get the pair edge (const overload).
|
inlinenoexcept |
Get the pair edge.
|
inlinenoexcept |
Get the starting vertex (const overload).
|
inlinenoexcept |
Get the starting vertex.
Returns a shared_ptr obtained by locking the internal weak_ptr (see the class-level
note on ownership). Returns nullptr if the vertex has been destroyed, which should not happen while the owning mesh is alive.
|
inlineprotectednoexcept |
Get the vector pointing along this edge (from start to end vertex).
|
noexcept |
Copy assignment operator.
Has the same semantics as the copy constructor (including that m_metaData is not copied; use setMetaData() afterwards if it needs to be populated). See the copy constructor's documentation for details.
| [in] | a_otherEdge | Other edge. |
|
default |
Move assignment operator.
Has the same full-state-transfer semantics as the move constructor (defaulted memberwise move; see its documentation for why this must be defaulted explicitly).
| [in,out] | a_otherEdge | Other edge. |
|
inlineprotectednoexcept |
Returns the parametric projection of a_x0 onto this edge.
Parametrizes the edge as x(t) = x1 + (x2-x1)*t and computes t such that x(t) is the closest point to a_x0. Returns t in (-inf, +inf); the point is on the segment when t in [0,1].
| [in] | a_x0 | Query point. |
|
inlinenoexcept |
Reconcile internal logic.
Computes normal.
|
inlinenoexcept |
Set the pointer to this half-edge's face.
| [in] | a_face | Face to associate with this half-edge. |
|
inlinenoexcept |
Set the meta-data.
| [in] | a_metaData | Meta-data. |
|
inlinenoexcept |
Set the next edge.
| [in] | a_nextEdge | Next edge |
|
inlinenoexcept |
Set the pair edge.
| [in] | a_pairEdge | Pair edge |
|
inlinenoexcept |
Set the starting vertex.
| [in] | a_vertex | Starting vertex |
|
inlinenoexcept |
Get the signed distance from a_x0 to this half-edge.
Checks whether a_x0 projects onto the edge segment or past one of the end vertices. If it projects to a vertex, the signed distance to that vertex is returned. Otherwise the sign is determined from the edge normal.
| [in] | a_x0 | Query point. |
|
inlinenoexcept |
Get size (in bytes) of this object.
|
inlinenoexcept |
Get the squared unsigned distance from a_x0 to this half-edge.
Clamps the projection parameter to [0,1] so the closest point is always on the segment, then returns the squared distance. Faster than signedDistance().
| [in] | a_x0 | Query point. |
Meta-data attached to this edge.
Value-initialized so that every constructor leaves it in a defined state: for a fundamental Meta type (e.g. short, int), a member with no initializer and no explicit mention in a constructor's member-initializer list is left indeterminate, not zero.
|
protected |
Starting vertex.
Stored as a weak_ptr: the vertex is owned by the mesh's own vertex list, and a plain shared_ptr here (mirrored by the sibling m_pairEdge/m_nextEdge/m_face links, and by FaceT::m_halfEdge and VertexT::m_outgoingEdge) would form a reference cycle across the half-edge/face/vertex graph that shared_ptr's reference counting can never collect.