|
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 > |
| Alias for vertex type. | |
| using | Edge = EdgeT< T > |
| Alias for edge type. | |
| using | Face = FaceT< T > |
| Alias for face type. | |
| using | Mesh = MeshT< T > |
| Alias for mesh type. | |
Public Member Functions | |
| EdgeT () noexcept=default | |
| Default constructor. Sets all topology indices to the unset sentinel and vectors to zero vectors. | |
| EdgeT (const Edge &a_otherEdge)=default | |
| Copy constructor. | |
| EdgeT (Edge &&a_otherEdge)=default | |
| Move constructor. | |
| EdgeT (const uint32_t a_vertexIndex) noexcept | |
| Partial constructor. Calls the default constructor but sets the starting vertex. | |
| ~EdgeT ()=default | |
| Destructor (does nothing) | |
| Edge & | operator= (const Edge &a_otherEdge)=default |
| Copy assignment operator. | |
| Edge & | operator= (Edge &&a_otherEdge)=default |
| Move assignment operator. | |
| size_t | size () const noexcept |
| Get the number of vertices spanned by a half-edge. | |
| void | define (const uint32_t a_vertexIndex, const uint32_t a_pairEdgeIndex, const uint32_t a_nextEdgeIndex) noexcept |
| Define function. Sets the starting vertex, pair/next edge indices. | |
| void | reconcile (const Mesh &a_mesh) noexcept |
| Reconcile internal logic. | |
| void | flipNormal () noexcept |
| Flip surface normal. | |
| void | setVertex (const uint32_t a_vertexIndex) noexcept |
| Set the index of the starting vertex. | |
| void | setPairEdge (const uint32_t a_pairEdgeIndex) noexcept |
| Set the index of the pair edge. | |
| void | setNextEdge (const uint32_t a_nextEdgeIndex) noexcept |
| Set the index of the next edge. | |
| void | setFace (const uint32_t a_faceIndex) noexcept |
| Set the index of this half-edge's face. | |
| uint32_t | getVertexIndex () const noexcept |
| Get the index of the starting vertex. | |
| uint32_t | getPairEdgeIndex () const noexcept |
| Get the index of the pair edge. | |
| uint32_t | getNextEdgeIndex () const noexcept |
| Get the index of the next edge. | |
| uint32_t | getFaceIndex () const noexcept |
| Get the index of this half-edge's face. | |
| Vertex & | getVertex (Mesh &a_mesh) noexcept |
| Get the starting vertex. | |
| const Vertex & | getVertex (const Mesh &a_mesh) const noexcept |
| Get the starting vertex (const overload). | |
| Vertex & | getOtherVertex (Mesh &a_mesh) noexcept |
| Get the end vertex. | |
| const Vertex & | getOtherVertex (const Mesh &a_mesh) const noexcept |
| Get the end vertex (const overload). | |
| Edge & | getPairEdge (Mesh &a_mesh) noexcept |
| Get the pair edge. | |
| const Edge & | getPairEdge (const Mesh &a_mesh) const noexcept |
| Get the pair edge (const overload). | |
| Edge & | getNextEdge (Mesh &a_mesh) noexcept |
| Get the next edge. | |
| const Edge & | getNextEdge (const Mesh &a_mesh) const noexcept |
| Get the next edge (const overload). | |
| Vec3T< T > | computeNormal (const Mesh &a_mesh) 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. | |
| Face & | getFace (Mesh &a_mesh) noexcept |
| Get this half-edge's face. | |
| const Face & | getFace (const Mesh &a_mesh) const noexcept |
| Get this half-edge's face (const overload). | |
| T | signedDistance (const Vec3 &a_x0, const Mesh &a_mesh) const noexcept |
| Get the signed distance from a_x0 to this half-edge. | |
| T | unsignedDistance2 (const Vec3 &a_x0, const Mesh &a_mesh) const noexcept |
| Get the squared unsigned distance from a_x0 to this half-edge. | |
Protected Member Functions | |
| T | projectPointToEdge (const Vec3 &a_x0, const Mesh &a_mesh) const noexcept |
| Returns the parametric projection of a_x0 onto this edge. | |
| Vec3T< T > | getX2X1 (const Mesh &a_mesh) const noexcept |
| Get the vector pointing along this edge (from start to end vertex). | |
Protected Attributes | |
| Vec3 | m_normal = Vec3::zeros() |
| Normal vector. | |
| uint32_t | m_vertex = UINT32_MAX |
| Index of the starting vertex. | |
| uint32_t | m_pairEdge = UINT32_MAX |
| Index of the pair edge. See m_vertex for the indexing convention. | |
| uint32_t | m_nextEdge = UINT32_MAX |
| Index of the next edge. See m_vertex for the indexing convention. | |
| uint32_t | m_face = UINT32_MAX |
| Index of the enclosing polygon face, into the owning mesh's face array, or UINT32_MAX if unset. | |
Half-edge class for navigating a DCEL mesh.
Class which represents a half-edge in a doubly-connected edge list (DCEL).
| T | Floating-point precision 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 stores the indices of the polygon face, vertex, and next half edge in the owning mesh's arrays. It also stores the index of 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. |
|
default |
Copy constructor.
Defaulted memberwise copy of every member – the normal vector, and all four topology indices (vertex, pair edge, next edge, face). This is what lets EdgeT be trivially copyable: std::is_trivially_copyable requires the copy constructor to be the implicit/defaulted one, so a user-provided body – even one that does nothing but a plain memberwise copy – would disqualify it. operator=(const Edge&) has identical semantics.
| [in] | a_otherEdge | Other edge. |
|
default |
Move constructor.
Defaulted memberwise move; equivalent to the copy constructor since every member is a plain value.
| [in,out] | a_otherEdge | Other edge. |
|
noexcept |
Partial constructor. Calls the default constructor but sets the starting vertex.
| [in] | a_vertexIndex | Index of the starting vertex in the owning mesh's vertex array. |
|
inlinenoexcept |
Compute the normal vector as the average of the face normals on both sides of this edge.
An edge with no pair edge (a hole) uses its own face's normal alone.
| [in] | a_mesh | Owning mesh, used to resolve the face/pair-edge indices. |
|
inlinenoexcept |
Define function. Sets the starting vertex, pair/next edge indices.
| [in] | a_vertexIndex | Index of the starting vertex in the owning mesh's vertex array. |
| [in] | a_pairEdgeIndex | Index of the pair half-edge in the owning mesh's edge array, or UINT32_MAX if unset. |
| [in] | a_nextEdgeIndex | Index of the next half-edge in the owning mesh's edge array, or UINT32_MAX if unset. |
|
inlinenoexcept |
Get this half-edge's face (const overload).
| [in] | a_mesh | Owning mesh, used to resolve the face index. |
|
inlinenoexcept |
Get this half-edge's face.
| [in] | a_mesh | Owning mesh, used to resolve the face index. |
|
inlinenoexcept |
Get the index of this half-edge's face.
|
inlinenoexcept |
Get the next edge (const overload).
| [in] | a_mesh | Owning mesh, used to resolve the next-edge index. |
|
inlinenoexcept |
Get the next edge.
| [in] | a_mesh | Owning mesh, used to resolve the next-edge index. |
|
inlinenoexcept |
Get the index of the next edge.
|
inlinenoexcept |
Get the stored normal vector.
|
inlinenoexcept |
Get modifiable normal vector.
|
inlinenoexcept |
Get the end vertex (const overload).
| [in] | a_mesh | Owning mesh, used to resolve the next-edge and vertex indices. |
|
inlinenoexcept |
Get the end vertex.
| [in] | a_mesh | Owning mesh, used to resolve the next-edge and vertex indices. |
|
inlinenoexcept |
Get the pair edge (const overload).
| [in] | a_mesh | Owning mesh, used to resolve the pair-edge index. |
|
inlinenoexcept |
Get the pair edge.
| [in] | a_mesh | Owning mesh, used to resolve the pair-edge index. |
|
inlinenoexcept |
Get the index of the pair edge.
|
inlinenoexcept |
Get the starting vertex (const overload).
| [in] | a_mesh | Owning mesh, used to resolve the vertex index. |
|
inlinenoexcept |
Get the starting vertex.
| [in] | a_mesh | Owning mesh, used to resolve the vertex index. |
|
inlinenoexcept |
Get the index of the starting vertex.
|
inlineprotectednoexcept |
Get the vector pointing along this edge (from start to end vertex).
| [in] | a_mesh | Owning mesh, used to resolve the vertex indices. |
|
default |
Copy assignment operator.
Defaulted memberwise copy; see the copy constructor's documentation.
| [in] | a_otherEdge | Other edge. |
|
default |
Move assignment operator.
Defaulted memberwise move; equivalent to copy assignment since every member is a plain value (see the copy constructor for why it must stay defaulted).
| [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. |
| [in] | a_mesh | Owning mesh, used to resolve the vertex indices. |
|
inlinenoexcept |
Reconcile internal logic.
Computes the normal vector.
| [in] | a_mesh | Owning mesh, used to resolve the face/pair-edge indices. |
|
inlinenoexcept |
Set the index of this half-edge's face.
| [in] | a_faceIndex | Index of the face in the owning mesh's face array, or UINT32_MAX to mark it unset. |
|
inlinenoexcept |
Set the index of the next edge.
| [in] | a_nextEdgeIndex | Index of the next edge in the owning mesh's edge array, or UINT32_MAX to mark it unset. |
|
inlinenoexcept |
Set the index of the pair edge.
| [in] | a_pairEdgeIndex | Index of the pair edge in the owning mesh's edge array, or UINT32_MAX to mark it unset. |
|
inlinenoexcept |
Set the index of the starting vertex.
| [in] | a_vertexIndex | Index of the starting vertex in the owning mesh's vertex array. |
|
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. |
| [in] | a_mesh | Owning mesh, used to resolve the vertex indices. |
|
inlinenoexcept |
Get the number of vertices spanned by a half-edge.
|
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. |
| [in] | a_mesh | Owning mesh, used to resolve the vertex indices. |
|
protected |
Index of the starting vertex.
Index into the owning DCEL::MeshT's vertex array, or UINT32_MAX if unset.