a48  2.0.2
a48::MeshT< Traits > Class Template Reference

Mesh type for a halfedge-based (topological) mesh. More...

#include <mesht.hh>

Inheritance diagram for a48::MeshT< Traits >:
a48::StellarMeshT< Traits > a48::AdaptiveMeshT< Traits >

List of all members.

Public Types

typedef BaseItemsPolicy< Traits > items_policy
 items policy definition
typedef Traits::vertex_type vertex_type
 vertex definition
typedef Traits::halfedge_type halfedge_type
 halfedge definition
typedef Traits::face_type face_type
 face definition
typedef halfedge_type::edge_type edge_type
 edge definition
typedef std::set< vertex_type * > vertex_container
 vertex container definition
typedef std::set< halfedge_type * > halfedge_container
 halfedge container definition
typedef std::set< face_type * > face_container
 face container definition
typedef vertex_container::iterator vertex_iterator
 vertex iterator definition
typedef
vertex_container::const_iterator 
vertex_const_iterator
 vertex constant iterator definition
typedef
halfedge_container::iterator 
halfedge_iterator
 halfedge iterator definition
typedef
halfedge_container::const_iterator 
halfedge_const_iterator
 halfedge constant iterator definition
typedef face_container::iterator face_iterator
 face iterator definition
typedef
face_container::const_iterator 
face_const_iterator
 face constant iterator definition

Public Member Functions

 MeshT ()
 Default Constructor.
 MeshT (items_policy *_ip)
 MeshT (const MeshT< Traits > &_m)
 ~MeshT ()
 Destructor.
void clear (void)
 Clear entire mesh, deleting all elements and erasing all containers.
MeshT< Traits > & operator= (const MeshT< Traits > &_m)
 Assign operator.
void fix_vertices_stars (void)
 Fix the star circulation of all mesh vertices.
vertex_typeadd_vertex (void)
 Add a new vertex to this mesh.
halfedge_typeadd_halfedge (void)
 Add a new halfedge to this mesh.
face_typeadd_face (void)
 Add a new face to this mesh.
void delete_vertex (vertex_type *_v)
 Delete a vertex from this mesh.
void delete_halfedge (halfedge_type *_h)
 Delete a halfedge from this mesh.
void delete_face (face_type *_f)
 Delete a face from this mesh.
bool is_closed (void) const
 Verifies if this mesh is closed (without boundaries)
bool is_consistent (void) const
 Verifies mesh halfedge data structure consistency.
bool is_manifold (void) const
 Verifies if this mesh is a manifold (topologically)
bool is_valid (void) const
 Verifies if this mesh is valid (halfedge data structure is ok)
void set_base (const unsigned int &nv, const unsigned int &nf, const unsigned int *conn, const unsigned int &nvf=3)
 Sets the base mesh.
void set_base (vertex_type **verts, const unsigned int *conn, const unsigned int &nf, const unsigned int &nvf=3)
void set_items_policy (items_policy *_ip)
 Set Items Policy for this mesh.
unsigned int size_of_vertices (void) const
 Gets the number of vertices of this mesh.
unsigned int size_of_halfedges (void) const
 Gets the number of halfedges of this mesh.
unsigned int size_of_faces (void) const
 Gets the number of faces of this mesh.
const vertex_containerset_of_vertices (void) const
 Gets the set of vertices of this mesh.
const halfedge_containerset_of_halfedges (void) const
 Gets the set of halfedges of this mesh.
const face_containerset_of_faces (void) const
 Gets the set of faces of this mesh.
items_policyget_items_policy (void)
 Get Items Policy of this mesh.
const items_policyget_items_policy (void) const
vertex_iterator vertices_begin (void)
vertex_const_iterator vertices_begin (void) const
vertex_iterator vertices_end (void)
vertex_const_iterator vertices_end (void) const
halfedge_iterator halfedges_begin (void)
halfedge_const_iterator halfedges_begin (void) const
halfedge_iterator halfedges_end (void)
halfedge_const_iterator halfedges_end (void) const
face_iterator faces_begin (void)
face_const_iterator faces_begin (void) const
face_iterator faces_end (void)
face_const_iterator faces_end (void) const

Related Functions

(Note that these are not member functions.)

template<class Mesh >
bool make_consistent (Mesh &_m)
 Reset halfedge orientations to make the mesh consistent.

Detailed Description

template<class Traits = DefaultTraits>
class a48::MeshT< Traits >

Mesh type for a halfedge-based (topological) mesh.

This class is based mainly on the following book:

@BOOK{Mantyla:1988,
  title = {An introduction to solid modeling},
  author = {M{\"a}ntyl{\"a}, M.},
  isbn = {9780881751086},
  lccn = {87027852},
  note = {\url{http://books.google.com.br/books?id=CJVRAAAAMAAJ}},
  year = {1988},
  publisher = {Computer Science Press}
}   
Template Parameters:
Traitstemplate argument to define mesh traits
Examples:
example_itemspolicy.cc, example_mesht.cc, and example_traits.h.

Definition at line 151 of file mesht.hh.


Member Typedef Documentation

template<class Traits = DefaultTraits>
typedef BaseItemsPolicy< Traits > a48::MeshT< Traits >::items_policy

items policy definition

Reimplemented in a48::AdaptiveMeshT< Traits >, and a48::StellarMeshT< Traits >.

Definition at line 155 of file mesht.hh.

template<class Traits = DefaultTraits>
typedef Traits::vertex_type a48::MeshT< Traits >::vertex_type

vertex definition

Reimplemented in a48::AdaptiveMeshT< Traits >, and a48::StellarMeshT< Traits >.

Definition at line 157 of file mesht.hh.

template<class Traits = DefaultTraits>
typedef Traits::halfedge_type a48::MeshT< Traits >::halfedge_type

halfedge definition

Reimplemented in a48::AdaptiveMeshT< Traits >, and a48::StellarMeshT< Traits >.

Definition at line 158 of file mesht.hh.

template<class Traits = DefaultTraits>
typedef Traits::face_type a48::MeshT< Traits >::face_type

face definition

Reimplemented in a48::AdaptiveMeshT< Traits >, and a48::StellarMeshT< Traits >.

Definition at line 159 of file mesht.hh.

template<class Traits = DefaultTraits>
typedef halfedge_type::edge_type a48::MeshT< Traits >::edge_type

edge definition

Definition at line 161 of file mesht.hh.

template<class Traits = DefaultTraits>
typedef std::set< vertex_type* > a48::MeshT< Traits >::vertex_container

vertex container definition

Definition at line 163 of file mesht.hh.

template<class Traits = DefaultTraits>
typedef std::set< halfedge_type* > a48::MeshT< Traits >::halfedge_container

halfedge container definition

Definition at line 164 of file mesht.hh.

template<class Traits = DefaultTraits>
typedef std::set< face_type* > a48::MeshT< Traits >::face_container

face container definition

Definition at line 165 of file mesht.hh.

template<class Traits = DefaultTraits>
typedef vertex_container::iterator a48::MeshT< Traits >::vertex_iterator

vertex iterator definition

Definition at line 167 of file mesht.hh.

template<class Traits = DefaultTraits>
typedef vertex_container::const_iterator a48::MeshT< Traits >::vertex_const_iterator

vertex constant iterator definition

Definition at line 168 of file mesht.hh.

template<class Traits = DefaultTraits>
typedef halfedge_container::iterator a48::MeshT< Traits >::halfedge_iterator

halfedge iterator definition

Definition at line 170 of file mesht.hh.

template<class Traits = DefaultTraits>
typedef halfedge_container::const_iterator a48::MeshT< Traits >::halfedge_const_iterator

halfedge constant iterator definition

Definition at line 171 of file mesht.hh.

template<class Traits = DefaultTraits>
typedef face_container::iterator a48::MeshT< Traits >::face_iterator

face iterator definition

Definition at line 173 of file mesht.hh.

template<class Traits = DefaultTraits>
typedef face_container::const_iterator a48::MeshT< Traits >::face_const_iterator

face constant iterator definition

Definition at line 174 of file mesht.hh.


Constructor & Destructor Documentation

template<class Traits = DefaultTraits>
a48::MeshT< Traits >::MeshT ( ) [inline]

Default Constructor.

Definition at line 177 of file mesht.hh.

template<class Traits = DefaultTraits>
a48::MeshT< Traits >::MeshT ( items_policy _ip) [inline]

Constructor

Parameters:
[in]_ipItems Policy to be used by this mesh
See also:
BaseItemsPolicy

Definition at line 183 of file mesht.hh.

template<class Traits = DefaultTraits>
a48::MeshT< Traits >::MeshT ( const MeshT< Traits > &  _m) [inline]

Copy Constructor

Parameters:
[in]_mCopy mesh

Definition at line 188 of file mesht.hh.

template<class Traits = DefaultTraits>
a48::MeshT< Traits >::~MeshT ( ) [inline]

Destructor.

Definition at line 191 of file mesht.hh.

References a48::MeshT< Traits >::clear().


Member Function Documentation

template<class Traits = DefaultTraits>
void a48::MeshT< Traits >::clear ( void  ) [inline]

Clear entire mesh, deleting all elements and erasing all containers.

Definition at line 194 of file mesht.hh.

template<class Traits = DefaultTraits>
void a48::MeshT< Traits >::fix_vertices_stars ( void  ) [inline]

Fix the star circulation of all mesh vertices.

Make sure each boundary vertex starts its star circulation with the first halfedge in the boundary.

See also:
VertexT::star_next

Definition at line 248 of file mesht.hh.

template<class Traits = DefaultTraits>
vertex_type* a48::MeshT< Traits >::add_vertex ( void  ) [inline]

Add a new vertex to this mesh.

Returns:
Vertex pointer

Definition at line 260 of file mesht.hh.

template<class Traits = DefaultTraits>
halfedge_type* a48::MeshT< Traits >::add_halfedge ( void  ) [inline]

Add a new halfedge to this mesh.

Returns:
Halfedge pointer

Definition at line 265 of file mesht.hh.

template<class Traits = DefaultTraits>
face_type* a48::MeshT< Traits >::add_face ( void  ) [inline]

Add a new face to this mesh.

Returns:
Face pointer

Definition at line 270 of file mesht.hh.

template<class Traits = DefaultTraits>
void a48::MeshT< Traits >::delete_vertex ( vertex_type _v) [inline]

Delete a vertex from this mesh.

Parameters:
[in,out]_vVertex pointer

Definition at line 275 of file mesht.hh.

template<class Traits = DefaultTraits>
void a48::MeshT< Traits >::delete_halfedge ( halfedge_type _h) [inline]

Delete a halfedge from this mesh.

Parameters:
[in,out]_hHalfedge pointer

Definition at line 280 of file mesht.hh.

template<class Traits = DefaultTraits>
void a48::MeshT< Traits >::delete_face ( face_type _f) [inline]

Delete a face from this mesh.

Parameters:
[in,out]_fFace pointer

Definition at line 285 of file mesht.hh.

template<class Traits = DefaultTraits>
bool a48::MeshT< Traits >::is_closed ( void  ) const [inline]

Verifies if this mesh is closed (without boundaries)

Returns:
True if this mesh is a closed manifold

Definition at line 295 of file mesht.hh.

template<class Traits = DefaultTraits>
bool a48::MeshT< Traits >::is_consistent ( void  ) const [inline]

Verifies mesh halfedge data structure consistency.

Returns:
True if the halfedge data structure is consistent

Definition at line 304 of file mesht.hh.

template<class Traits = DefaultTraits>
bool a48::MeshT< Traits >::is_manifold ( void  ) const [inline]

Verifies if this mesh is a manifold (topologically)

Returns:
True if this mesh is a manifold

Definition at line 313 of file mesht.hh.

template<class Traits = DefaultTraits>
bool a48::MeshT< Traits >::is_valid ( void  ) const [inline]

Verifies if this mesh is valid (halfedge data structure is ok)

A valid mesh is also a consistent mesh, so this function overlaps the is_consistent function.

See also:
is_consistent
Returns:
True if this mesh is valid

Definition at line 373 of file mesht.hh.

template<class Traits = DefaultTraits>
void a48::MeshT< Traits >::set_base ( const unsigned int &  nv,
const unsigned int &  nf,
const unsigned int *  conn,
const unsigned int &  nvf = 3 
) [inline]

Sets the base mesh.

All the vertices of the mesh will be instantiated through the add_vertex() method and the items policy (if any) will be used to set vertex attributes. Note that the order of the vertices in the mesh container (accessed by the vertices_begin() method) is not guaranteed to complain with the input connectivity array, for that reason a temporary container is created to store vertex_type*'s in the correct order. The base-mesh connnectivity must be given in the same orientation to ensure that opposite halfedges go in opposite directions.

Parameters:
[in]nvNumber of vertices in the base mesh
[in]nfNumber of faces in the base mesh
[in]connConnectivity describing base-mesh topology
[in]nvfNumber of vertices per face (default 3 = triangle mesh)

Definition at line 437 of file mesht.hh.

References a48::MeshT< Traits >::add_vertex(), a48::MeshT< Traits >::clear(), and a48::BaseItemsPolicy< Traits >::set_vertex_attributes().

template<class Traits = DefaultTraits>
void a48::MeshT< Traits >::set_base ( vertex_type **  verts,
const unsigned int *  conn,
const unsigned int &  nf,
const unsigned int &  nvf = 3 
) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

All the vertices of the mesh must have been defined previously through the add_vertex() method. The base-mesh connnectivity must be given in the same orientation.

Parameters:
[in,out]vertsAn array of vertex_type pointers previously defined
[in]connConnectivity describing base-mesh topology
[in]nfNumber of faces in the base mesh
[in]nvfNumber of vertices per face (default 3 = triangle mesh)

Definition at line 465 of file mesht.hh.

References a48::MeshT< Traits >::add_face(), a48::MeshT< Traits >::add_halfedge(), a48::MeshT< Traits >::fix_vertices_stars(), a48::BaseItemsPolicy< Traits >::set_face_attributes(), and a48::BaseItemsPolicy< Traits >::set_halfedge_attributes().

template<class Traits = DefaultTraits>
void a48::MeshT< Traits >::set_items_policy ( items_policy _ip) [inline]

Set Items Policy for this mesh.

Parameters:
[in]_ipItems Policy to be used by this mesh
See also:
BaseItemsPolicy

Definition at line 520 of file mesht.hh.

template<class Traits = DefaultTraits>
unsigned int a48::MeshT< Traits >::size_of_vertices ( void  ) const [inline]

Gets the number of vertices of this mesh.

Returns:
Number of vertices

Definition at line 530 of file mesht.hh.

template<class Traits = DefaultTraits>
unsigned int a48::MeshT< Traits >::size_of_halfedges ( void  ) const [inline]

Gets the number of halfedges of this mesh.

Returns:
Number of halfedges

Definition at line 535 of file mesht.hh.

template<class Traits = DefaultTraits>
unsigned int a48::MeshT< Traits >::size_of_faces ( void  ) const [inline]

Gets the number of faces of this mesh.

Returns:
Number of faces

Definition at line 540 of file mesht.hh.

template<class Traits = DefaultTraits>
const vertex_container& a48::MeshT< Traits >::set_of_vertices ( void  ) const [inline]

Gets the set of vertices of this mesh.

Returns:
Set of vertices

Definition at line 545 of file mesht.hh.

template<class Traits = DefaultTraits>
const halfedge_container& a48::MeshT< Traits >::set_of_halfedges ( void  ) const [inline]

Gets the set of halfedges of this mesh.

Returns:
Set of halfedges

Definition at line 550 of file mesht.hh.

template<class Traits = DefaultTraits>
const face_container& a48::MeshT< Traits >::set_of_faces ( void  ) const [inline]

Gets the set of faces of this mesh.

Returns:
Set of faces

Definition at line 555 of file mesht.hh.

template<class Traits = DefaultTraits>
items_policy* a48::MeshT< Traits >::get_items_policy ( void  ) [inline]

Get Items Policy of this mesh.

Returns:
Items Policy used by this mesh
See also:
BaseItemsPolicy

Definition at line 561 of file mesht.hh.

template<class Traits = DefaultTraits>
const items_policy * a48::MeshT< Traits >::get_items_policy ( void  ) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns:
Items Policy (constant) used by this mesh

Definition at line 566 of file mesht.hh.

template<class Traits = DefaultTraits>
vertex_iterator a48::MeshT< Traits >::vertices_begin ( void  ) [inline]
Returns:
Iterator to the vertices begin

Definition at line 574 of file mesht.hh.

template<class Traits = DefaultTraits>
vertex_const_iterator a48::MeshT< Traits >::vertices_begin ( void  ) const [inline]
Returns:
Constant iterator to the vertices begin

Definition at line 576 of file mesht.hh.

template<class Traits = DefaultTraits>
vertex_iterator a48::MeshT< Traits >::vertices_end ( void  ) [inline]
Returns:
Iterator to the vertices end

Definition at line 579 of file mesht.hh.

template<class Traits = DefaultTraits>
vertex_const_iterator a48::MeshT< Traits >::vertices_end ( void  ) const [inline]
Returns:
Constant iterator to the vertices end

Definition at line 581 of file mesht.hh.

template<class Traits = DefaultTraits>
halfedge_iterator a48::MeshT< Traits >::halfedges_begin ( void  ) [inline]
Returns:
Iterator to the halfedge begin

Definition at line 584 of file mesht.hh.

template<class Traits = DefaultTraits>
halfedge_const_iterator a48::MeshT< Traits >::halfedges_begin ( void  ) const [inline]
Returns:
Constant iterator to the halfedge begin

Definition at line 586 of file mesht.hh.

template<class Traits = DefaultTraits>
halfedge_iterator a48::MeshT< Traits >::halfedges_end ( void  ) [inline]
Returns:
Iterator to the halfedge end

Definition at line 589 of file mesht.hh.

template<class Traits = DefaultTraits>
halfedge_const_iterator a48::MeshT< Traits >::halfedges_end ( void  ) const [inline]
Returns:
Constant iterator to the halfedge end

Definition at line 591 of file mesht.hh.

template<class Traits = DefaultTraits>
face_iterator a48::MeshT< Traits >::faces_begin ( void  ) [inline]
Returns:
Iterator to the faces begin

Definition at line 594 of file mesht.hh.

template<class Traits = DefaultTraits>
face_const_iterator a48::MeshT< Traits >::faces_begin ( void  ) const [inline]
Returns:
Constant iterator to the faces begin

Definition at line 596 of file mesht.hh.

template<class Traits = DefaultTraits>
face_iterator a48::MeshT< Traits >::faces_end ( void  ) [inline]
Returns:
Iterator to the faces end

Definition at line 599 of file mesht.hh.

template<class Traits = DefaultTraits>
face_const_iterator a48::MeshT< Traits >::faces_end ( void  ) const [inline]
Returns:
Constant iterator to the faces end

Definition at line 601 of file mesht.hh.


Friends And Related Function Documentation

template<class Mesh >
bool make_consistent ( Mesh &  _m) [related]

Reset halfedge orientations to make the mesh consistent.

If one mesh face is not given in the same orientation of the others then some opposed halfedges are going in the same direction and the mesh is not consistent.

See also:
MeshT::is_consistent
Parameters:
[in,out]_mThe input mesh to make consistent
Returns:
True if the mesh is now a consistent mesh, false means non-orientable 2-manifold
Template Parameters:
MeshBase mesh class must be derived from
See also:
MeshT

Definition at line 473 of file mesh.hh.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Typedefs