EBGeometry  1.0
Public Types | Public Member Functions | Protected Attributes | List of all members
DCEL::VertexT< T, Meta > Class Template Reference

Vertex class. More...

#include <EBGeometry_DCEL_Vertex.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.
 
using EdgeIterator = EdgeIteratorT< T, Meta >
 Alias for edge iterator.
 

Public Member Functions

 VertexT ()
 Default constructor. More...
 
 VertexT (const Vec3 &a_position)
 Partial constructor. More...
 
 VertexT (const Vec3 &a_position, const Vec3 &a_normal)
 Constructor. More...
 
 VertexT (const Vertex &a_otherVertex)
 Full copy constructor. More...
 
virtual ~VertexT ()
 Destructor (does nothing)
 
void define (const Vec3 &a_position, const EdgePtr &a_edge, const Vec3 &a_normal) noexcept
 Define function. More...
 
void setPosition (const Vec3 &a_position) noexcept
 Set the vertex position. More...
 
void setNormal (const Vec3 &a_normal) noexcept
 Set the vertex normal vector. More...
 
void setEdge (const EdgePtr &a_edge) noexcept
 Set the reference to the outgoing edge. More...
 
void addFace (const FacePtr &a_face) noexcept
 Add a face to the polygon face list. More...
 
void normalizeNormalVector () noexcept
 Normalize the normal vector, ensuring its length is 1.
 
void computeVertexNormalAverage () noexcept
 Compute the vertex normal, using an average the normal vector in this vertex's face list (m_faces)
 
void computeVertexNormalAverage (const std::vector< FacePtr > &a_faces) noexcept
 Compute the vertex normal, using an average of the normal vectors in the input face list. More...
 
void computeVertexNormalAngleWeighted () noexcept
 Compute the vertex normal, using the pseudonormal algorithm which weights the normal with the subtended angle to each connected face. More...
 
void computeVertexNormalAngleWeighted (const std::vector< FacePtr > &a_faces) noexcept
 Compute the vertex normal, using the pseudonormal algorithm which weights the normal with the subtended angle to each connected face. More...
 
void flip () noexcept
 Flip the normal vector.
 
Vec3T< T > & getPosition () noexcept
 Return modifiable vertex position.
 
const Vec3T< T > & getPosition () const noexcept
 Return immutable vertex position.
 
Vec3T< T > & getNormal () noexcept
 Return modifiable vertex normal vector.
 
const Vec3T< T > & getNormal () const noexcept
 Return immutable vertex normal vector.
 
EdgePtrgetOutgoingEdge () noexcept
 Return modifiable pointer to outgoing edge.
 
const EdgePtrgetOutgoingEdge () const noexcept
 Return immutable pointer to outgoing edge.
 
std::vector< FacePtr > & getFaces () noexcept
 Get modifiable polygon face list for this vertex.
 
const std::vector< FacePtr > & getFaces () const noexcept
 Get immutable polygon face list for this vertex.
 
signedDistance (const Vec3 &a_x0) const noexcept
 Get the signed distance to this vertex. More...
 
unsignedDistance2 (const Vec3 &a_x0) const noexcept
 Get the squared unsigned distance to this vertex. More...
 
Meta & getMetaData () noexcept
 Get meta-data. More...
 
const Meta & getMetaData () const noexcept
 Get meta-data. More...
 

Protected Attributes

EdgePtr m_outgoingEdge
 Pointer to an outgoing edge from this vertex.
 
Vec3 m_position
 Vertex position.
 
Vec3 m_normal
 Vertex normal vector.
 
std::vector< FacePtrm_faces
 List of faces connected to this vertex (these must be "manually" added)
 
Meta m_metaData
 Meta-data for this vertex.
 

Detailed Description

template<class T, class Meta>
class DCEL::VertexT< T, Meta >

Vertex class.

Class which represents a vertex node in a double-edge connected list (DCEL).

This class is used in DCEL functionality which stores polygonal surfaces in a mesh. The VertexT class has a position, a normal vector, and a pointer to one of the outgoing edges from the vertex. For performance reasons we also include pointers to all the polygon faces that share this vertex.

Note
The normal vector is outgoing, i.e. a point x is "outside" the vertex if the dot product between n and (x - x0) is positive.

Constructor & Destructor Documentation

◆ VertexT() [1/4]

template<class T , class Meta >
DCEL::VertexT< T, Meta >::VertexT ( )

Default constructor.

This initializes the position and the normal vector to zero vectors, and the polygon face list is empty

◆ VertexT() [2/4]

template<class T , class Meta >
DCEL::VertexT< T, Meta >::VertexT ( const Vec3 a_position)

Partial constructor.

Parameters
[in]a_positionVertex position

This initializes the position to a_position and the normal vector to the zero vector. The polygon face list is empty.

◆ VertexT() [3/4]

template<class T , class Meta >
DCEL::VertexT< T, Meta >::VertexT ( const Vec3 a_position,
const Vec3 a_normal 
)

Constructor.

Parameters
[in]a_positionVertex position
[in]a_normalVertex normal vector

This initializes the position to a_position and the normal vector to a_normal. The polygon face list is empty.

◆ VertexT() [4/4]

template<class T , class Meta >
DCEL::VertexT< T, Meta >::VertexT ( const Vertex a_otherVertex)

Full copy constructor.

Parameters
[in]a_otherVertexOther vertex

This copies the position, normal vector, and outgoing edge pointer from the other vertex. The polygon face list.

Member Function Documentation

◆ addFace()

template<class T , class Meta >
void DCEL::VertexT< T, Meta >::addFace ( const FacePtr a_face)
inlinenoexcept

Add a face to the polygon face list.

Parameters
[in]a_facePointer to face.

◆ computeVertexNormalAngleWeighted() [1/2]

template<class T , class Meta >
void DCEL::VertexT< T, Meta >::computeVertexNormalAngleWeighted ( )
inlinenoexcept

Compute the vertex normal, using the pseudonormal algorithm which weights the normal with the subtended angle to each connected face.

This calls the other version with a_faces = m_faces

Note
This computes the normal vector using the pseudnormal algorithm from Baerentzen and Aanes in "Signed distance computation using the angle weighted pseudonormal" (DOI: 10.1109/TVCG.2005.49)

◆ computeVertexNormalAngleWeighted() [2/2]

template<class T , class Meta >
void DCEL::VertexT< T, Meta >::computeVertexNormalAngleWeighted ( const std::vector< FacePtr > &  a_faces)
inlinenoexcept

Compute the vertex normal, using the pseudonormal algorithm which weights the normal with the subtended angle to each connected face.

Parameters
[in]a_facesFaces to use for computation.
Note
This computes the normal vector using the pseudnormal algorithm from Baerentzen and Aanes in "Signed distance computation using the angle weighted pseudonormal" (DOI: 10.1109/TVCG.2005.49)

◆ computeVertexNormalAverage()

template<class T , class Meta >
void DCEL::VertexT< T, Meta >::computeVertexNormalAverage ( const std::vector< FacePtr > &  a_faces)
inlinenoexcept

Compute the vertex normal, using an average of the normal vectors in the input face list.

Parameters
[in]a_facesFaces
Note
This computes the vertex normal as n = sum(normal(face))/num(faces)

◆ define()

template<class T , class Meta >
void DCEL::VertexT< T, Meta >::define ( const Vec3 a_position,
const EdgePtr a_edge,
const Vec3 a_normal 
)
inlinenoexcept

Define function.

Parameters
[in]a_positionVertex position
[in]a_edgePointer to outgoing edge
[in]a_normalVertex normal vector

This sets the position, normal vector, and edge pointer.

◆ getMetaData() [1/2]

template<class T , class Meta >
const Meta& DCEL::VertexT< T, Meta >::getMetaData ( ) const
inlinenoexcept

Get meta-data.

Returns
m_metaData

◆ getMetaData() [2/2]

template<class T , class Meta >
Meta& DCEL::VertexT< T, Meta >::getMetaData ( )
inlinenoexcept

Get meta-data.

Returns
m_metaData

◆ setEdge()

template<class T , class Meta >
void DCEL::VertexT< T, Meta >::setEdge ( const EdgePtr a_edge)
inlinenoexcept

Set the reference to the outgoing edge.

Parameters
[in]a_edgePointer to an outgoing edge

◆ setNormal()

template<class T , class Meta >
void DCEL::VertexT< T, Meta >::setNormal ( const Vec3 a_normal)
inlinenoexcept

Set the vertex normal vector.

Parameters
[in]a_normalVertex normal vector

◆ setPosition()

template<class T , class Meta >
void DCEL::VertexT< T, Meta >::setPosition ( const Vec3 a_position)
inlinenoexcept

Set the vertex position.

Parameters
[in]a_positionVertex position

◆ signedDistance()

template<class T , class Meta >
T DCEL::VertexT< T, Meta >::signedDistance ( const Vec3 a_x0) const
inlinenoexcept

Get the signed distance to this vertex.

Parameters
[in]a_x0Position in space.
Returns
The returned distance is |a_x0 - m_position| and the sign is given by the sign of m_normal * |a_x0 - m_position|.

◆ unsignedDistance2()

template<class T , class Meta >
T DCEL::VertexT< T, Meta >::unsignedDistance2 ( const Vec3 a_x0) const
inlinenoexcept

Get the squared unsigned distance to this vertex.

This is faster to compute than signedDistance, and might be preferred for some algorithms.

Returns
Returns the vector length of (a_x - m_position)

The documentation for this class was generated from the following files: