78 : m_origin(origin), m_end(end), m_length(length)
81 gsWarn <<
"Halfedge: Origin and end must be indices > 0 and length should be positiv or 0. One of the values is not correct:"
82 << std::endl <<
"origin: " << origin << std::endl <<
"end: " << end << std::endl
97 size_t getEnd()
const {
return m_end; }
111 {
return (m_end == nextHalfedge.
m_origin); }
119 {
return (m_origin == previousHalfedge.
m_end); }
127 {
return (m_origin == halfedge.
m_end && m_end == halfedge.
m_origin); }
170 bool isEmpty()
const {
return m_chainedHalfedges.empty(); }
183 bool isClosed()
const;
193 size_t getNumberOfVertices()
const;
212 std::vector<T> getHalfedgeLengths()
const;
222 const Halfedge &getFirstHalfedge()
const;
232 const Halfedge &getLastHalfedge()
const;
248 const std::list<size_t> getVertexIndices()
const;
272 T getShortestDistanceBetween(
size_t i,
size_t j, T precision)
const;
297 T getDistanceBetween(
size_t i,
size_t j)
const;
314 bool isVertexContained(
const size_t &vertexIndex)
const;
325 bool isAppendableAsPrev(
const Halfedge &previousHalfedge)
const;
336 bool isAppendableAsNext(
const Halfedge &nextHalfedge)
const;
346 void appendPrevHalfedge(
const Halfedge &prevHalfedge);
357 void appendNextHalfedge(
const Halfedge &nextHalfedge,
bool ignoreWarning =
false);
398 Boundary(
const std::vector<Halfedge> &halfedges);
410 for(
typename std::vector<Chain>::const_iterator it=m_boundary.begin(); it!=m_boundary.end(); ++it)
411 result += it->getNumberOfVertices();
425 for(
typename std::vector<Chain>::const_iterator it=m_boundary.begin(); it!=m_boundary.end(); ++it)
426 result += it->getLength();
439 std::vector<T> result;
440 for(
typename std::vector<Chain>::const_iterator it=m_boundary.begin(); it!=m_boundary.end(); ++it)
442 const std::vector<T> lengthsOneComp = it->getHalfedgeLengths();
443 result.insert(result.end(), lengthsOneComp.begin(), lengthsOneComp.end());
457 std::list<size_t> result;
458 for(
typename std::vector<Chain>::const_iterator it=m_boundary.begin(); it!=m_boundary.end(); ++it)
460 const std::list<size_t>& indicesOneComp = it->getVertexIndices();
461 result.insert(result.end(), indicesOneComp.begin(), indicesOneComp.end());
479 for(
typename std::vector<Chain>::const_iterator it=m_boundary.begin(); it!=m_boundary.end(); ++it)
481 T dist = it->getShortestDistanceBetween(i, j, precision);
502 for(
typename std::vector<Chain>::const_iterator it=m_boundary.begin(); it!=m_boundary.end(); ++it)
504 T dist = it->getDistanceBetween(i, j);
520 for(
typename std::vector<Chain>::const_iterator it=m_boundary.begin(); it!=m_boundary.end(); ++it)
521 if(it->isVertexContained(internVertexIndex))
536 const std::list<Halfedge> findNonTwinHalfedges(
const std::vector<Halfedge> &allHalfedges);
563 size_t getNumberOfVertices()
const;
571 size_t getNumberOfTriangles()
const;
579 size_t getNumberOfInnerVertices()
const;
587 size_t getNumberOfBoundaryVertices()
const;
596 const typename gsMesh<T>::gsVertexHandle &getVertex(
const size_t vertexIndex)
const;
634 std::vector<index_t> &corners)
const;
644 const std::vector<T> getBoundaryChordLengths()
const;
655 T getShortestBoundaryDistanceBetween(
size_t i,
size_t j)
const;
666 T getHalfedgeLength(
const size_t originVertexIndex,
const size_t endVertexIndex)
const;
680 const std::queue<Halfedge>
681 getOppositeHalfedges(
const size_t vertexIndex,
const bool innerVertex = 1)
const;
698 short_t isTriangleVertex(
size_t vertexIndex,
size_t triangleIndex)
const;
703 return m_boundary.getVertexIndices();
709 return findVertex(vertex->
x(), vertex->
y(), vertex->
z());
713 size_t findVertex(T x, T y, T z,
bool sorted =
false, real_t tol = 1e-6)
const;
718 return this->m_vertex[globIndex];
721 size_t unsorted(
const size_t index)
const
723 return m_inverseSorting[index];
735 bool isBoundaryVertex(
const size_t internVertexIndex)
const;
746 size_t getInternVertexIndex(
const typename gsMesh<T>::gsVertexHandle &vertex)
const;
763 getInternHalfedge(
const typename gsMesh<T>::gsFaceHandle &triangle,
size_t numberOfHalfedge)
const;
792 #ifndef GISMO_BUILD_LIB
793 #include GISMO_HPP_HEADER(gsHalfEdgeMesh.hpp)
Boundary()
Empty Constructor.
Definition: gsHalfEdgeMesh.h:383
std::list< Halfedge > m_chainedHalfedges
list of halfedges
Definition: gsHalfEdgeMesh.h:360
bool isTwin(const Halfedge &halfedge) const
Tells if halfedge is twin.
Definition: gsHalfEdgeMesh.h:126
#define short_t
Definition: gsConfig.h:35
T m_length
length of halfedge
Definition: gsHalfEdgeMesh.h:132
size_t getEnd() const
Get end vertex index.
Definition: gsHalfEdgeMesh.h:97
T getLength() const
Get length.
Definition: gsHalfEdgeMesh.h:422
bool isPrev(const Halfedge &nextHalfedge) const
Tells if halfedge can be added at end.
Definition: gsHalfEdgeMesh.h:110
const gsMesh< T >::gsVertexHandle & getVertexUnsorted(const size_t globIndex) const
Returns the handle to the vertex with index globIndex.
Definition: gsHalfEdgeMesh.h:716
size_t m_origin
index of origin vertex
Definition: gsHalfEdgeMesh.h:130
std::vector< Chain > m_boundary
boundary chains
Definition: gsHalfEdgeMesh.h:538
size_t findVertex(const typename gsMesh< T >::gsVertexHandle &vertex) const
Finds the vertex that has the same coordinates (up to a tolerance) as vertex.
Definition: gsHalfEdgeMesh.h:707
bool isEmpty() const
Tells whether chain is empty or not.
Definition: gsHalfEdgeMesh.h:170
size_t m_n
number of inner vertices in the mesh
Definition: gsHalfEdgeMesh.h:781
Class Representing a triangle mesh with 3D vertices.
Definition: gsMesh.h:31
#define gsWarn
Definition: gsDebug.h:50
size_t m_end
index of end vertex
Definition: gsHalfEdgeMesh.h:131
EIGEN_STRONG_INLINE onormal_expr< T > nv(const gsGeometryMap< T > &u)
The (outer pointing) boundary normal of a geometry map.
Definition: gsExpressions.h:4508
std::vector< index_t > m_sorting
vector that stores the internVertexIndices s. t. m_sorting[vertexIndex-1] = internVertexIndex ...
Definition: gsHalfEdgeMesh.h:784
size_t getNumberOfVertices() const
Get number of vertices.
Definition: gsHalfEdgeMesh.h:407
T x() const
Definition: gsVertex.h:108
T getLength() const
Get length of halfedge.
Definition: gsHalfEdgeMesh.h:103
Boundary m_boundary
boundary of the mesh
Definition: gsHalfEdgeMesh.h:780
Provides declaration of the Mesh class.
std::vector< index_t > m_inverseSorting
vector of indices s. t. m_inverseSorting[internVertexIndex] = vertexIndex
Definition: gsHalfEdgeMesh.h:783
const std::list< size_t > getVertexIndices() const
Get list of vertex indices in the chain.
Definition: gsHalfEdgeMesh.h:455
T getShortestDistanceBetween(const size_t &i, const size_t &j, T precision) const
Get distance between vertices.
Definition: gsHalfEdgeMesh.h:477
size_t getOrigin() const
Get origin vertex index.
Definition: gsHalfEdgeMesh.h:91
T y() const
Definition: gsVertex.h:110
Class that maintains directed halfedges in any dimension.
Definition: gsHalfEdgeMesh.h:64
Class that maintains chain of halfedges.
Definition: gsHalfEdgeMesh.h:156
const std::vector< T > getHalfedgeLengths() const
Get halfedge lengths.
Definition: gsHalfEdgeMesh.h:437
std::list< size_t > getBoundaryVertexIndices() const
Returns the vertex indices of the boundary.
Definition: gsHalfEdgeMesh.h:701
gsHalfEdgeMesh(size_t nv=0)
Default constructor.
Definition: gsHalfEdgeMesh.h:544
bool isVertexContained(const size_t &internVertexIndex) const
Tells if vertex is contained in boundary chain.
Definition: gsHalfEdgeMesh.h:518
T getDistanceBetween(const size_t &i, const size_t &j) const
Get distance between vertices.
Definition: gsHalfEdgeMesh.h:500
gsHalfEdgeMesh is a gsMesh implementation that handles Halfedges
Definition: gsHalfEdgeMesh.h:46
std::vector< Halfedge > m_halfedges
vector of halfedges
Definition: gsHalfEdgeMesh.h:779
Halfedge(const size_t origin=0, const size_t end=0, const T length=0)
This constructor sets the origin- and * end-point indices as well as length to preferred values...
Definition: gsHalfEdgeMesh.h:75
bool isNext(const Halfedge &previousHalfedge) const
Tells if halfedge can be added at beginning.
Definition: gsHalfEdgeMesh.h:118
T z() const
Definition: gsVertex.h:112
gsVertex class that represents a 3D vertex for a gsMesh.
Definition: gsVertex.h:26
Class that maintains boundary of triangle mesh.
Definition: gsHalfEdgeMesh.h:378