vcglib/apps/sample
ganovelli ae83ca17ed [ Changes in definition of TriMesh: PART I ]
Note for the developers: the change to make to existing projects is very little 
but strictly necessary to compile. This change IS NOT backward compliant.


==== OLD ==== way to define a TriMesh:

// forward declarations
class MyVertex;
class MyEdge;
class MyFace;

class MyVertex: public VertexSimp2 < MyVertex, MyEdge, MyFace, vertex::Coord3f,...other components>{};
class MyFace: public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};


==== NEW ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;

// declaration of which types is used as VertexType, which type is used as FaceType and so on...
class MyUsedTypes: public vcg::UsedType < vcg::Use<MyVertex>::AsVertexType,
                                          vcg::Use<MyFace>::AsFaceType>{};

class MyVertex: public Vertex < MyUsedTypes, vertex::Coord3f,...other components>{};
class MyFace: public Face < MyUsedTypes, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};

                                 
===== classes introduced          
[vcg::UsedType] : it is a class containing all the types that must be passed to the definition of Vertex, Face, Edge... This
class replaces the list of typenames to pass as first templates and the need to specify the maximal simplicial. So 

<MyVertex, MyEdge, MyFace  becomes <MyUsedTypes<

and 

VertexSimp2 becomes Vertex

[vcg::Use] : an auxiliary class to give a simple way to specify the role of a type

Note 2: the order of templates parameters to vcg::UsedTypes is unimportant, e.g:

class MyUsedTypes: public vcg::UsedType <vcg::Use<MyVertex>::AsVertexType,
                                         vcg::Use<MyEdge>::AsEdgeType,
                                         vcg::Use<MyFace>::AsFaceType>{};

is the same as:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyFace>::AsFaceType,
                                         vcg::Use<MyEdge>::AsEdgeType,
                                         vcg::Use<MyVertex>::AsVertexType>{};

Note 3: you only need to specify the type  you use. If you do not have edges you do not need 
to include vcg::Use<MyEdge>::AsEdgeType in the template list of UsedTypes.
==== the Part II will be a tiny change to the class TriMesh it self.
2010-03-15 10:44:40 +00:00
..
aabb_binary_tree [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
colorspace *** empty log message *** 2006-08-29 12:58:40 +00:00
edgemesh_grid [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:42:03 +00:00
img_filters added basic filter sample for image module 2009-08-25 16:53:04 +00:00
polygonmesh_base [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
space_minimal Initial Relase 2005-09-21 10:29:33 +00:00
trackball_SDL [SIMPLEXplus promotion] 2008-12-19 10:43:36 +00:00
trimesh_QT [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
trimesh_SDL [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
trimesh_attribute [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
trimesh_ball_pivoting [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
trimesh_base [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
trimesh_clustering [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
trimesh_hole [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
trimesh_intersection [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
trimesh_isosurface [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
trimesh_join [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
trimesh_optional [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
trimesh_pos_demo [SIMPLEXplus promotion] 2008-12-19 10:43:36 +00:00
trimesh_refine [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
trimesh_smooth [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
trimesh_split_vertex [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
trimesh_topology [ Changes in definition of TriMesh: PART I ] 2010-03-15 10:44:40 +00:00
sample.pro added base example using polygon meshes and halfedges 2008-12-19 15:37:32 +00:00
sample.sln *** empty log message *** 2006-01-11 16:11:16 +00:00