DGtal
1.5.beta
|
Aim: Represents a polygon mesh, i.e. a 2-dimensional combinatorial surface whose faces are (topologically at least) simple polygons. 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 PolygonalSurface::makeVertexMap
).
More...
#include <DGtal/shapes/PolygonalSurface.h>
Data Structures | |
struct | IndexedPropertyMap |
struct | VertexMap |
Public Types | |
typedef TPoint | Point |
typedef PolygonalSurface< 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 HalfEdgeDataStructure::PolygonalFace | PolygonalFace |
typedef std::vector< Point > | PositionsStorage |
typedef std::vector< PolygonalFace > | PolygonalFacesStorage |
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) | |
~PolygonalSurface () | |
PolygonalSurface () | |
PolygonalSurface (Clone< HalfEdgeDataStructure > aHeds, Clone< PositionsStorage > pos) | |
void | clear () |
Clears everything. More... | |
bool | build () |
VertexIndex | addVertex (const Point &vdata) |
FaceIndex | addTriangle (VertexIndex v0, VertexIndex v1, VertexIndex v2) |
FaceIndex | addQuadrangle (VertexIndex v0, VertexIndex v1, VertexIndex v2, VertexIndex v3) |
FaceIndex | addPolygonalFace (const PolygonalFace &f) |
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 |
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... | |
PolygonalFacesStorage | myPolygonalFaces |
Stores the polygonal faces. More... | |
Aim: Represents a polygon mesh, i.e. a 2-dimensional combinatorial surface whose faces are (topologically at least) simple polygons. 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 PolygonalSurface::makeVertexMap
).
Description of template class 'PolygonalSurface'
For now, the user must add vertices and faces (triangles, quadrangles, polygones), 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 86 of file PolygonalSurface.h.
typedef HalfEdgeDataStructure::HalfEdgeIndex DGtal::PolygonalSurface< TPoint >::Arc |
Definition at line 113 of file PolygonalSurface.h.
typedef std::vector<Arc> DGtal::PolygonalSurface< TPoint >::ArcRange |
Definition at line 115 of file PolygonalSurface.h.
typedef IntegerSequenceIterator<VertexIndex> DGtal::PolygonalSurface< TPoint >::ConstIterator |
Definition at line 110 of file PolygonalSurface.h.
typedef EdgeIndex DGtal::PolygonalSurface< TPoint >::Edge |
Definition at line 109 of file PolygonalSurface.h.
typedef HalfEdgeDataStructure::EdgeIndex DGtal::PolygonalSurface< TPoint >::EdgeIndex |
Definition at line 94 of file PolygonalSurface.h.
typedef HalfEdgeDataStructure::FaceIndex DGtal::PolygonalSurface< TPoint >::Face |
Definition at line 114 of file PolygonalSurface.h.
typedef HalfEdgeDataStructure::FaceIndex DGtal::PolygonalSurface< TPoint >::FaceIndex |
Definition at line 95 of file PolygonalSurface.h.
typedef std::vector<Face> DGtal::PolygonalSurface< TPoint >::FaceRange |
Definition at line 116 of file PolygonalSurface.h.
|
protected |
Definition at line 216 of file PolygonalSurface.h.
typedef HalfEdgeDataStructure::Index DGtal::PolygonalSurface< TPoint >::Index |
Definition at line 92 of file PolygonalSurface.h.
typedef TPoint DGtal::PolygonalSurface< TPoint >::Point |
Definition at line 89 of file PolygonalSurface.h.
typedef HalfEdgeDataStructure::PolygonalFace DGtal::PolygonalSurface< TPoint >::PolygonalFace |
Definition at line 97 of file PolygonalSurface.h.
typedef std::vector<PolygonalFace> DGtal::PolygonalSurface< TPoint >::PolygonalFacesStorage |
Definition at line 99 of file PolygonalSurface.h.
typedef IndexedPropertyMap< Point > DGtal::PolygonalSurface< TPoint >::PositionsMap |
Definition at line 213 of file PolygonalSurface.h.
typedef std::vector<Point> DGtal::PolygonalSurface< TPoint >::PositionsStorage |
Definition at line 98 of file PolygonalSurface.h.
typedef PolygonalSurface<TPoint> DGtal::PolygonalSurface< TPoint >::Self |
Definition at line 90 of file PolygonalSurface.h.
typedef HalfEdgeDataStructure::Size DGtal::PolygonalSurface< TPoint >::Size |
Definition at line 91 of file PolygonalSurface.h.
typedef HalfEdgeDataStructure::Triangle DGtal::PolygonalSurface< TPoint >::Triangle |
Definition at line 96 of file PolygonalSurface.h.
typedef VertexIndex DGtal::PolygonalSurface< TPoint >::Vertex |
Definition at line 102 of file PolygonalSurface.h.
typedef HalfEdgeDataStructure::VertexIndex DGtal::PolygonalSurface< TPoint >::VertexIndex |
Definition at line 93 of file PolygonalSurface.h.
typedef std::vector<Vertex> DGtal::PolygonalSurface< TPoint >::VertexRange |
Definition at line 117 of file PolygonalSurface.h.
typedef std::set<Vertex> DGtal::PolygonalSurface< TPoint >::VertexSet |
Definition at line 103 of file PolygonalSurface.h.
|
inline |
|
inline |
Constructor.
Definition at line 229 of file PolygonalSurface.h.
DGtal::PolygonalSurface< TPoint >::PolygonalSurface | ( | Clone< HalfEdgeDataStructure > | aHeds, |
Clone< PositionsStorage > | pos | ||
) |
Constructor from half-edge data structure and vector of positions.
aHeds | any valid half-edge data structure (cloned). |
pos | any vector of point giving the positions of all vertices (its size should match the number of vertices in heds). |
FaceIndex DGtal::PolygonalSurface< TPoint >::addPolygonalFace | ( | const PolygonalFace & | f | ) |
Adds a new polygonal face f to the surface.
FaceIndex DGtal::PolygonalSurface< TPoint >::addQuadrangle | ( | VertexIndex | v0, |
VertexIndex | v1, | ||
VertexIndex | v2, | ||
VertexIndex | v3 | ||
) |
Adds a new quadrangle of vertices v0, v1, v2, v3 to the surface.
FaceIndex DGtal::PolygonalSurface< TPoint >::addTriangle | ( | VertexIndex | v0, |
VertexIndex | v1, | ||
VertexIndex | v2 | ||
) |
Adds a new triangle of vertices v0, v1, v2 to the surface.
VertexIndex DGtal::PolygonalSurface< TPoint >::addVertex | ( | const Point & | vdata | ) |
Adds a new vertex to the surface with data vdata.
vdata | the data associated to this new vertex. |
ArcRange DGtal::PolygonalSurface< TPoint >::allArcs | ( | ) | const |
ArcRange DGtal::PolygonalSurface< TPoint >::allBoundaryArcs | ( | ) | const |
This set of arcs is sufficient for displaying the boundary of the surface.
VertexRange DGtal::PolygonalSurface< TPoint >::allBoundaryVertices | ( | ) | const |
This set of arcs is sufficient for displaying the boundary of the surface.
FaceRange DGtal::PolygonalSurface< TPoint >::allFaces | ( | ) | const |
VertexRange DGtal::PolygonalSurface< TPoint >::allVertices | ( | ) | const |
Arc DGtal::PolygonalSurface< 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. |
ArcRange DGtal::PolygonalSurface< TPoint >::arcsAroundFace | ( | const Face & | f | ) | const |
f | any valid face on the surface. (open or closed ). |
this->faceAroundArc(anArc) == f
.
|
inline |
Definition at line 420 of file PolygonalSurface.h.
Size DGtal::PolygonalSurface< TPoint >::bestCapacity | ( | ) | const |
DGtal::PolygonalSurface< TPoint >::BOOST_STATIC_CONSTANT | ( | Face | , |
INVALID_FACE | = HALF_EDGE_INVALID_INDEX |
||
) |
bool DGtal::PolygonalSurface< TPoint >::build | ( | ) |
Builds the half-edge data structure from the given polygonal faces and vertices. After that, the surface is valid.
void DGtal::PolygonalSurface< TPoint >::clear | ( | ) |
Clears everything.
Size DGtal::PolygonalSurface< TPoint >::degree | ( | const Vertex & | v | ) | const |
v | any vertex |
|
inline |
Definition at line 424 of file PolygonalSurface.h.
References DGtal::PolygonalSurface< TPoint >::nbVertices().
|
inline |
Definition at line 296 of file PolygonalSurface.h.
References DGtal::HalfEdgeDataStructure::Euler(), and DGtal::PolygonalSurface< TPoint >::myHEDS.
Face DGtal::PolygonalSurface< 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 polygonal surface since it is a combinatorial 2-manifold.
a | any arc on the surface. |
FaceRange DGtal::PolygonalSurface< TPoint >::facesAroundArc | ( | const Arc & | a | ) | const |
Computes the faces incident to a given arc. There is only one for polygonal surface since it is a combinatorial 2-manifold.
a | any arc on the surface. |
FaceRange DGtal::PolygonalSurface< TPoint >::facesAroundVertex | ( | const Vertex & | v | ) | const |
v | any vertex of the surface. |
Vertex DGtal::PolygonalSurface< TPoint >::head | ( | const Arc & | a | ) | const |
a | any arc (s,t) |
|
inline |
Definition at line 273 of file PolygonalSurface.h.
References DGtal::PolygonalSurface< TPoint >::myHEDS.
|
inline |
Definition at line 277 of file PolygonalSurface.h.
References DGtal::PolygonalSurface< TPoint >::myHEDS.
ArcRange DGtal::PolygonalSurface< TPoint >::inArcs | ( | const Vertex & | v | ) | const |
v | any vertex of the surface. |
bool DGtal::PolygonalSurface< TPoint >::isArcBoundary | ( | const Arc & | v | ) | const |
v | any arc. |
bool DGtal::PolygonalSurface< TPoint >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
bool DGtal::PolygonalSurface< TPoint >::isVertexBoundary | ( | const Vertex & | v | ) | const |
v | any vertex. |
|
inline |
Definition at line 322 of file PolygonalSurface.h.
References DGtal::PolygonalSurface< TPoint >::nbEdges().
|
inline |
value | the value that is given to all edges at initialization. |
Definition at line 330 of file PolygonalSurface.h.
References DGtal::PolygonalSurface< TPoint >::nbEdges().
|
inline |
Definition at line 337 of file PolygonalSurface.h.
References DGtal::PolygonalSurface< TPoint >::nbFaces().
|
inline |
value | the value that is given to all faces at initialization. |
Definition at line 345 of file PolygonalSurface.h.
References DGtal::PolygonalSurface< TPoint >::nbFaces().
|
inline |
Definition at line 307 of file PolygonalSurface.h.
References DGtal::PolygonalSurface< TPoint >::nbVertices().
|
inline |
value | the value that is given to all vertices at initialization. |
Definition at line 315 of file PolygonalSurface.h.
References DGtal::PolygonalSurface< TPoint >::nbVertices().
|
inline |
Definition at line 282 of file PolygonalSurface.h.
References DGtal::PolygonalSurface< TPoint >::myHEDS, and DGtal::HalfEdgeDataStructure::nbHalfEdges().
|
inline |
Definition at line 288 of file PolygonalSurface.h.
References DGtal::PolygonalSurface< TPoint >::myHEDS, and DGtal::HalfEdgeDataStructure::nbEdges().
Referenced by DGtal::PolygonalSurface< TPoint >::makeEdgeMap().
|
inline |
Definition at line 291 of file PolygonalSurface.h.
References DGtal::PolygonalSurface< TPoint >::myHEDS, and DGtal::HalfEdgeDataStructure::nbFaces().
Referenced by DGtal::PolygonalSurface< TPoint >::makeFaceMap().
|
inline |
Definition at line 285 of file PolygonalSurface.h.
References DGtal::PolygonalSurface< TPoint >::myHEDS, and DGtal::HalfEdgeDataStructure::nbVertices().
Referenced by DGtal::PolygonalSurface< TPoint >::end(), and DGtal::PolygonalSurface< TPoint >::makeVertexMap().
Arc DGtal::PolygonalSurface< TPoint >::next | ( | const Arc & | a | ) | const |
Constant-time access to the next arc
a | any arc (s,t) |
Arc DGtal::PolygonalSurface< TPoint >::opposite | ( | const Arc & | a | ) | const |
a | any arc (s,t) |
ArcRange DGtal::PolygonalSurface< TPoint >::outArcs | ( | const Vertex & | v | ) | const |
v | any vertex of the surface. |
Point& DGtal::PolygonalSurface< TPoint >::position | ( | Vertex | v | ) |
Mutable accessor to vertex data.
v | any vertex. |
const Point& DGtal::PolygonalSurface< TPoint >::position | ( | Vertex | v | ) | const |
Const accessor to vertex data.
v | any vertex. |
|
inline |
Definition at line 300 of file PolygonalSurface.h.
References DGtal::PolygonalSurface< TPoint >::myPositions.
void DGtal::PolygonalSurface< 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::PolygonalSurface< TPoint >::size | ( | ) | const |
Vertex DGtal::PolygonalSurface< TPoint >::tail | ( | const Arc & | a | ) | const |
a | any arc (s,t) |
VertexRange DGtal::PolygonalSurface< 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 ). |
void DGtal::PolygonalSurface< 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::PolygonalSurface< 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 595 of file PolygonalSurface.h.
|
protected |
The half-edge data structure that stores the topology of the mesh.
Definition at line 597 of file PolygonalSurface.h.
Referenced by DGtal::PolygonalSurface< TPoint >::Euler(), DGtal::PolygonalSurface< TPoint >::heds(), DGtal::PolygonalSurface< TPoint >::nbArcs(), DGtal::PolygonalSurface< TPoint >::nbEdges(), DGtal::PolygonalSurface< TPoint >::nbFaces(), and DGtal::PolygonalSurface< TPoint >::nbVertices().
|
protected |
Stores the polygonal faces.
Definition at line 601 of file PolygonalSurface.h.
|
protected |
Stores the information for each Vertex.
Definition at line 599 of file PolygonalSurface.h.
Referenced by DGtal::PolygonalSurface< TPoint >::positions().