DGtal
1.5.beta
|
Aim: Represents a triangulated surface. The topology is stored with a half-edge data structure. This object stored the positions of vertices in space. If you need further data attached to the surface, you may use property maps (see TriangulatedSurface::makeVertexMap
).
More...
#include <DGtal/shapes/TriangulatedSurface.h>
Data Structures | |
struct | IndexedPropertyMap |
struct | VertexMap |
Public Types | |
typedef TPoint | Point |
typedef TriangulatedSurface< TPoint > | Self |
typedef HalfEdgeDataStructure::Size | Size |
typedef HalfEdgeDataStructure::Index | Index |
typedef HalfEdgeDataStructure::VertexIndex | VertexIndex |
typedef HalfEdgeDataStructure::EdgeIndex | EdgeIndex |
typedef HalfEdgeDataStructure::FaceIndex | FaceIndex |
typedef HalfEdgeDataStructure::Triangle | Triangle |
typedef std::vector< Point > | PositionsStorage |
typedef std::vector< Triangle > | TriangleStorage |
typedef VertexIndex | Vertex |
typedef std::set< Vertex > | VertexSet |
typedef EdgeIndex | Edge |
typedef IntegerSequenceIterator< VertexIndex > | ConstIterator |
typedef HalfEdgeDataStructure::HalfEdgeIndex | Arc |
typedef HalfEdgeDataStructure::FaceIndex | Face |
typedef std::vector< Arc > | ArcRange |
typedef std::vector< Face > | FaceRange |
typedef std::vector< Vertex > | VertexRange |
typedef IndexedPropertyMap< Point > | PositionsMap |
Public Member Functions | |
BOOST_STATIC_CONSTANT (Face, INVALID_FACE=HALF_EDGE_INVALID_INDEX) | |
~TriangulatedSurface () | |
TriangulatedSurface () | |
void | clear () |
Clears everything. More... | |
bool | build () |
VertexIndex | addVertex (const Point &vdata) |
FaceIndex | addTriangle (VertexIndex v0, VertexIndex v1, VertexIndex v2) |
HalfEdgeDataStructure & | heds () |
const HalfEdgeDataStructure & | heds () const |
Size | nbArcs () const |
Size | nbVertices () const |
Size | nbEdges () const |
Size | nbFaces () const |
long | Euler () const |
PositionsMap | positions () |
template<typename AnyData > | |
IndexedPropertyMap< AnyData > | makeVertexMap () const |
template<typename AnyData > | |
IndexedPropertyMap< AnyData > | makeVertexMap (AnyData value) const |
template<typename AnyData > | |
IndexedPropertyMap< AnyData > | makeEdgeMap () const |
template<typename AnyData > | |
IndexedPropertyMap< AnyData > | makeEdgeMap (AnyData value) const |
template<typename AnyData > | |
IndexedPropertyMap< AnyData > | makeFaceMap () const |
template<typename AnyData > | |
IndexedPropertyMap< AnyData > | makeFaceMap (AnyData value) const |
Point & | position (Vertex v) |
const Point & | position (Vertex v) const |
Size | size () const |
Size | bestCapacity () const |
Size | degree (const Vertex &v) const |
template<typename OutputIterator > | |
void | writeNeighbors (OutputIterator &it, const Vertex &v) const |
template<typename OutputIterator , typename VertexPredicate > | |
void | writeNeighbors (OutputIterator &it, const Vertex &v, const VertexPredicate &pred) const |
ConstIterator | begin () const |
ConstIterator | end () const |
ArcRange | outArcs (const Vertex &v) const |
ArcRange | inArcs (const Vertex &v) const |
FaceRange | facesAroundVertex (const Vertex &v) const |
Vertex | head (const Arc &a) const |
Vertex | tail (const Arc &a) const |
Arc | opposite (const Arc &a) const |
Arc | next (const Arc &a) const |
Arc | arc (const Vertex &t, const Vertex &h) const |
Face | faceAroundArc (const Arc &a) const |
FaceRange | facesAroundArc (const Arc &a) const |
VertexRange | verticesAroundFace (const Face &f) const |
ArcRange | arcsAroundFace (const Face &f) const |
bool | isVertexBoundary (const Vertex &v) const |
bool | isArcBoundary (const Arc &v) const |
FaceRange | allFaces () const |
ArcRange | allArcs () const |
VertexRange | allVertices () const |
ArcRange | allBoundaryArcs () const |
VertexRange | allBoundaryVertices () const |
VertexRange | verticesOfFacesAroundArc (const Arc a) const |
bool | isFlippable (const Arc a) const |
void | flip (const Arc a) |
Vertex | split (const Arc a, const Point &data) |
bool | isMergeable (const Arc a) const |
Vertex | merge (const Arc a, const Point &data) |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Protected Types | |
typedef HalfEdgeDataStructure::HalfEdge | HalfEdge |
Protected Attributes | |
bool | isHEDSValid |
Indicates if the half-edge structure has been created/updated. More... | |
HalfEdgeDataStructure | myHEDS |
The half-edge data structure that stores the topology of the mesh. More... | |
PositionsStorage | myPositions |
Stores the information for each Vertex. More... | |
TriangleStorage | myTriangles |
Stores the triangles. More... | |
Aim: Represents a triangulated surface. The topology is stored with a half-edge data structure. This object stored the positions of vertices in space. If you need further data attached to the surface, you may use property maps (see TriangulatedSurface::makeVertexMap
).
Description of template class 'TriangulatedSurface'
Except for a few operations, this data structure is rather static. The user must add vertices and triangles, and when finished, call 'build()'.
Model of CUndirectedSimpleGraph: the vertices and edges of the triangulated surface form indeed a graph structure.
TPoint | a type defining the position in space of vertices. |
Definition at line 85 of file TriangulatedSurface.h.
typedef HalfEdgeDataStructure::HalfEdgeIndex DGtal::TriangulatedSurface< TPoint >::Arc |
Definition at line 111 of file TriangulatedSurface.h.
typedef std::vector<Arc> DGtal::TriangulatedSurface< TPoint >::ArcRange |
Definition at line 113 of file TriangulatedSurface.h.
typedef IntegerSequenceIterator< VertexIndex > DGtal::TriangulatedSurface< TPoint >::ConstIterator |
Definition at line 108 of file TriangulatedSurface.h.
typedef EdgeIndex DGtal::TriangulatedSurface< TPoint >::Edge |
Definition at line 107 of file TriangulatedSurface.h.
typedef HalfEdgeDataStructure::EdgeIndex DGtal::TriangulatedSurface< TPoint >::EdgeIndex |
Definition at line 93 of file TriangulatedSurface.h.
typedef HalfEdgeDataStructure::FaceIndex DGtal::TriangulatedSurface< TPoint >::Face |
Definition at line 112 of file TriangulatedSurface.h.
typedef HalfEdgeDataStructure::FaceIndex DGtal::TriangulatedSurface< TPoint >::FaceIndex |
Definition at line 94 of file TriangulatedSurface.h.
typedef std::vector<Face> DGtal::TriangulatedSurface< TPoint >::FaceRange |
Definition at line 114 of file TriangulatedSurface.h.
|
protected |
Definition at line 214 of file TriangulatedSurface.h.
typedef HalfEdgeDataStructure::Index DGtal::TriangulatedSurface< TPoint >::Index |
Definition at line 91 of file TriangulatedSurface.h.
typedef TPoint DGtal::TriangulatedSurface< TPoint >::Point |
Definition at line 88 of file TriangulatedSurface.h.
typedef IndexedPropertyMap< Point > DGtal::TriangulatedSurface< TPoint >::PositionsMap |
Definition at line 211 of file TriangulatedSurface.h.
typedef std::vector<Point> DGtal::TriangulatedSurface< TPoint >::PositionsStorage |
Definition at line 96 of file TriangulatedSurface.h.
typedef TriangulatedSurface<TPoint> DGtal::TriangulatedSurface< TPoint >::Self |
Definition at line 89 of file TriangulatedSurface.h.
typedef HalfEdgeDataStructure::Size DGtal::TriangulatedSurface< TPoint >::Size |
Definition at line 90 of file TriangulatedSurface.h.
typedef HalfEdgeDataStructure::Triangle DGtal::TriangulatedSurface< TPoint >::Triangle |
Definition at line 95 of file TriangulatedSurface.h.
typedef std::vector<Triangle> DGtal::TriangulatedSurface< TPoint >::TriangleStorage |
Definition at line 97 of file TriangulatedSurface.h.
typedef VertexIndex DGtal::TriangulatedSurface< TPoint >::Vertex |
Definition at line 100 of file TriangulatedSurface.h.
typedef HalfEdgeDataStructure::VertexIndex DGtal::TriangulatedSurface< TPoint >::VertexIndex |
Definition at line 92 of file TriangulatedSurface.h.
typedef std::vector<Vertex> DGtal::TriangulatedSurface< TPoint >::VertexRange |
Definition at line 115 of file TriangulatedSurface.h.
typedef std::set<Vertex> DGtal::TriangulatedSurface< TPoint >::VertexSet |
Definition at line 101 of file TriangulatedSurface.h.
|
inline |
|
inline |
Constructor.
Definition at line 227 of file TriangulatedSurface.h.
FaceIndex DGtal::TriangulatedSurface< TPoint >::addTriangle | ( | VertexIndex | v0, |
VertexIndex | v1, | ||
VertexIndex | v2 | ||
) |
Adds a new triangle of vertices v0, v1, v2 to the surface.
Referenced by makeTwoTriangles().
VertexIndex DGtal::TriangulatedSurface< TPoint >::addVertex | ( | const Point & | vdata | ) |
Adds a new vertex to the surface with data vdata.
vdata | the data associated to this new vertex. |
Referenced by makeTwoTriangles().
ArcRange DGtal::TriangulatedSurface< TPoint >::allArcs | ( | ) | const |
ArcRange DGtal::TriangulatedSurface< TPoint >::allBoundaryArcs | ( | ) | const |
This set of arcs is sufficient for displaying the boundary of the surface.
Referenced by SCENARIO().
VertexRange DGtal::TriangulatedSurface< TPoint >::allBoundaryVertices | ( | ) | const |
This set of arcs is sufficient for displaying the boundary of the surface.
Referenced by SCENARIO().
FaceRange DGtal::TriangulatedSurface< TPoint >::allFaces | ( | ) | const |
VertexRange DGtal::TriangulatedSurface< TPoint >::allVertices | ( | ) | const |
Referenced by laplacian().
Arc DGtal::TriangulatedSurface< TPoint >::arc | ( | const Vertex & | t, |
const Vertex & | h | ||
) | const |
[t] and [h] should be adjacent vertices.
t | the vertex at the tail of the arc. |
h | the vertex at the head of the arc. |
Referenced by SCENARIO().
ArcRange DGtal::TriangulatedSurface< TPoint >::arcsAroundFace | ( | const Face & | f | ) | const |
f | any valid face on the surface. (open or closed ). |
this->faceAroundArc(anArc) == f
.Referenced by SCENARIO().
|
inline |
Definition at line 398 of file TriangulatedSurface.h.
Referenced by SCENARIO().
Size DGtal::TriangulatedSurface< TPoint >::bestCapacity | ( | ) | const |
DGtal::TriangulatedSurface< TPoint >::BOOST_STATIC_CONSTANT | ( | Face | , |
INVALID_FACE | = HALF_EDGE_INVALID_INDEX |
||
) |
bool DGtal::TriangulatedSurface< TPoint >::build | ( | ) |
Builds the half-edge data structure from the given triangles and vertices. After that, the surface is valid.
Referenced by makeTwoTriangles().
void DGtal::TriangulatedSurface< TPoint >::clear | ( | ) |
Clears everything.
Size DGtal::TriangulatedSurface< TPoint >::degree | ( | const Vertex & | v | ) | const |
|
inline |
Definition at line 402 of file TriangulatedSurface.h.
References DGtal::TriangulatedSurface< TPoint >::nbVertices().
Referenced by SCENARIO().
|
inline |
Definition at line 274 of file TriangulatedSurface.h.
References DGtal::HalfEdgeDataStructure::Euler(), and DGtal::TriangulatedSurface< TPoint >::myHEDS.
Referenced by SCENARIO().
Face DGtal::TriangulatedSurface< TPoint >::faceAroundArc | ( | const Arc & | a | ) | const |
Convenience method for computing the face incident to a given arc. There is at most one face that borders an arc for triangulated surface since it is a combinatorial 2-manifold.
a | any arc on the surface. |
Referenced by SCENARIO().
FaceRange DGtal::TriangulatedSurface< TPoint >::facesAroundArc | ( | const Arc & | a | ) | const |
Computes the faces incident to a given arc. There is only one for triangulated surface since it is a combinatorial 2-manifold.
a | any arc on the surface. |
FaceRange DGtal::TriangulatedSurface< TPoint >::facesAroundVertex | ( | const Vertex & | v | ) | const |
v | any vertex of the surface. |
Referenced by laplacian().
void DGtal::TriangulatedSurface< TPoint >::flip | ( | const Arc | a | ) |
Flip the edge associated to arc a.
a | any valid arc. |
isFlippable( a ) == true
Referenced by SCENARIO().
Vertex DGtal::TriangulatedSurface< TPoint >::head | ( | const Arc & | a | ) | const |
|
inline |
Definition at line 251 of file TriangulatedSurface.h.
References DGtal::TriangulatedSurface< TPoint >::myHEDS.
|
inline |
Definition at line 255 of file TriangulatedSurface.h.
References DGtal::TriangulatedSurface< TPoint >::myHEDS.
ArcRange DGtal::TriangulatedSurface< TPoint >::inArcs | ( | const Vertex & | v | ) | const |
v | any vertex of the surface. |
bool DGtal::TriangulatedSurface< TPoint >::isArcBoundary | ( | const Arc & | v | ) | const |
v | any arc. |
bool DGtal::TriangulatedSurface< TPoint >::isFlippable | ( | const Arc | a | ) | const |
An edge is (topologically) flippable iff: (1) it does not lie on the boundary, (2) it is bordered by two triangles, (3) the two other vertices of the quad are not already neighbors. (2) is always true for a triangulated surface.
a | any arc. |
Referenced by SCENARIO().
bool DGtal::TriangulatedSurface< TPoint >::isMergeable | ( | const Arc | a | ) | const |
An edge is (topologically) mergeable iff: (1) it is bordered by two triangles, (2) there is no boundary vertex in the two triangles bordering the edge.
a | any arc. |
bool DGtal::TriangulatedSurface< TPoint >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
bool DGtal::TriangulatedSurface< TPoint >::isVertexBoundary | ( | const Vertex & | v | ) | const |
v | any vertex. |
|
inline |
Definition at line 300 of file TriangulatedSurface.h.
References DGtal::TriangulatedSurface< TPoint >::nbEdges().
|
inline |
value | the value that is given to all edges at initialization. |
Definition at line 308 of file TriangulatedSurface.h.
References DGtal::TriangulatedSurface< TPoint >::nbEdges().
|
inline |
Definition at line 315 of file TriangulatedSurface.h.
References DGtal::TriangulatedSurface< TPoint >::nbFaces().
|
inline |
value | the value that is given to all faces at initialization. |
Definition at line 323 of file TriangulatedSurface.h.
References DGtal::TriangulatedSurface< TPoint >::nbFaces().
|
inline |
Definition at line 285 of file TriangulatedSurface.h.
References DGtal::TriangulatedSurface< TPoint >::nbVertices().
|
inline |
value | the value that is given to all vertices at initialization. |
Definition at line 293 of file TriangulatedSurface.h.
References DGtal::TriangulatedSurface< TPoint >::nbVertices().
Vertex DGtal::TriangulatedSurface< TPoint >::merge | ( | const Arc | a, |
const Point & | data | ||
) |
Merges the edge specified by the arc a.
a | any valid arc. |
data | the position for the merged vertex. |
isMergeable( a ) == true
head(a)
does not exist anymore (but has been replaced by a renumbered vertex).
|
inline |
Definition at line 260 of file TriangulatedSurface.h.
References DGtal::TriangulatedSurface< TPoint >::myHEDS, and DGtal::HalfEdgeDataStructure::nbHalfEdges().
Referenced by SCENARIO().
|
inline |
Definition at line 266 of file TriangulatedSurface.h.
References DGtal::TriangulatedSurface< TPoint >::myHEDS, and DGtal::HalfEdgeDataStructure::nbEdges().
Referenced by DGtal::TriangulatedSurface< TPoint >::makeEdgeMap(), and SCENARIO().
|
inline |
Definition at line 269 of file TriangulatedSurface.h.
References DGtal::TriangulatedSurface< TPoint >::myHEDS, and DGtal::HalfEdgeDataStructure::nbFaces().
Referenced by laplacian(), DGtal::TriangulatedSurface< TPoint >::makeFaceMap(), and SCENARIO().
|
inline |
Definition at line 263 of file TriangulatedSurface.h.
References DGtal::TriangulatedSurface< TPoint >::myHEDS, and DGtal::HalfEdgeDataStructure::nbVertices().
Referenced by DGtal::TriangulatedSurface< TPoint >::end(), laplacian(), DGtal::TriangulatedSurface< TPoint >::makeVertexMap(), and SCENARIO().
Arc DGtal::TriangulatedSurface< TPoint >::next | ( | const Arc & | a | ) | const |
Constant-time access to the next arc
a | any arc (s,t) |
Referenced by laplacian().
Arc DGtal::TriangulatedSurface< TPoint >::opposite | ( | const Arc & | a | ) | const |
ArcRange DGtal::TriangulatedSurface< TPoint >::outArcs | ( | const Vertex & | v | ) | const |
Point& DGtal::TriangulatedSurface< TPoint >::position | ( | Vertex | v | ) |
Mutable accessor to vertex data.
v | any vertex. |
Referenced by laplacian().
const Point& DGtal::TriangulatedSurface< TPoint >::position | ( | Vertex | v | ) | const |
Const accessor to vertex data.
v | any vertex. |
|
inline |
Definition at line 278 of file TriangulatedSurface.h.
References DGtal::TriangulatedSurface< TPoint >::myPositions.
Referenced by SCENARIO().
void DGtal::TriangulatedSurface< TPoint >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Size DGtal::TriangulatedSurface< TPoint >::size | ( | ) | const |
Referenced by SCENARIO().
Vertex DGtal::TriangulatedSurface< TPoint >::split | ( | const Arc | a, |
const Point & | data | ||
) |
Splits the edge specified by the arc a. The two faces incident to a are split into four faces.
a | any valid arc. |
data | the position for the newly created vertex. |
isFlippable( a ) == true
Vertex DGtal::TriangulatedSurface< TPoint >::tail | ( | const Arc & | a | ) | const |
a | any arc (s,t) |
VertexRange DGtal::TriangulatedSurface< TPoint >::verticesAroundFace | ( | const Face & | f | ) | const |
If f is incident to the arcs (s,t) and (t,u) (say), then (s,t,u) is a subsequence of the returned sequence.
f | any valid face on the surface (open or closed ). |
Referenced by laplacian(), and SCENARIO().
VertexRange DGtal::TriangulatedSurface< TPoint >::verticesOfFacesAroundArc | ( | const Arc | a | ) | const |
a | any arc. |
Referenced by SCENARIO().
void DGtal::TriangulatedSurface< TPoint >::writeNeighbors | ( | OutputIterator & | it, |
const Vertex & | v | ||
) | const |
Writes the neighbors of a vertex using an output iterator
OutputIterator | the type of an output iterator writing in a container of vertices. |
it | the output iterator |
v | the vertex whose neighbors will be writen |
void DGtal::TriangulatedSurface< TPoint >::writeNeighbors | ( | OutputIterator & | it, |
const Vertex & | v, | ||
const VertexPredicate & | pred | ||
) | const |
Writes the neighbors of a vertex which satisfy a predicate using an output iterator
OutputIterator | the type of an output iterator writing in a container of vertices. |
VertexPredicate | the type of the predicate |
it | the output iterator |
v | the vertex whose neighbors will be written |
pred | the predicate that must be satisfied |
|
protected |
Indicates if the half-edge structure has been created/updated.
Definition at line 660 of file TriangulatedSurface.h.
|
protected |
The half-edge data structure that stores the topology of the mesh.
Definition at line 662 of file TriangulatedSurface.h.
Referenced by DGtal::TriangulatedSurface< TPoint >::Euler(), DGtal::TriangulatedSurface< TPoint >::heds(), DGtal::TriangulatedSurface< TPoint >::nbArcs(), DGtal::TriangulatedSurface< TPoint >::nbEdges(), DGtal::TriangulatedSurface< TPoint >::nbFaces(), and DGtal::TriangulatedSurface< TPoint >::nbVertices().
|
protected |
Stores the information for each Vertex.
Definition at line 664 of file TriangulatedSurface.h.
Referenced by DGtal::TriangulatedSurface< TPoint >::positions().
|
protected |
Stores the triangles.
Definition at line 666 of file TriangulatedSurface.h.