2004-03-03 17:07:57 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* VCGLib o o *
|
|
|
|
* Visual and Computer Graphics Library o o *
|
|
|
|
* _ O _ *
|
|
|
|
* Copyright(C) 2004 \/)\/ *
|
|
|
|
* Visual Computing Lab /\/| *
|
|
|
|
* ISTI - Italian National Research Council | *
|
|
|
|
* \ *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
|
|
|
* for more details. *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
|
|
History
|
|
|
|
|
|
|
|
$Log: not supported by cvs2svn $
|
2008-12-19 11:31:56 +01:00
|
|
|
Revision 1.12 2008/03/17 11:39:14 ganovelli
|
|
|
|
added curvature and curvatruredir (compiled .net 2005 and gcc)
|
2004-09-28 17:24:56 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
Revision 1.11 2008/02/04 21:26:49 ganovelli
|
|
|
|
added ImportLocal which imports all local attributes into vertexplus and faceplus.
|
|
|
|
A local attribute is everything (N(), C(), Q()....) except pointers to other simplices
|
|
|
|
(i.e. FFAdj, VFAdj, VertexRef) which are set to NULL.
|
|
|
|
Added some function for const attributes
|
2004-08-25 17:15:27 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
Revision 1.10 2007/03/12 15:37:21 tarini
|
|
|
|
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
|
2004-07-20 17:24:53 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
Revision 1.9 2007/02/12 19:00:56 ganovelli
|
|
|
|
added Name(std:vector<std::string>& n) that fills n with the names of the attribute of the vertex type
|
2004-07-15 13:25:01 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
Revision 1.8 2006/09/28 17:34:11 cignoni
|
|
|
|
Added Missing GetBBox function
|
2004-07-15 12:13:48 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
Revision 1.7 2006/02/27 17:42:43 ponchio
|
|
|
|
Added some documentation.
|
2004-05-14 00:44:40 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
Revision 1.6 2005/12/05 15:58:10 cignoni
|
|
|
|
Removed spurious definition of flags in Aritymax that was overriding the correct definition in EmplyBitFlags and BitFlags classes
|
2004-05-14 00:40:02 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
Revision 1.5 2005/12/02 00:44:41 cignoni
|
|
|
|
Reformatted and compacted flags code.
|
2004-05-13 14:49:22 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
Revision 1.4 2005/11/16 22:59:35 cignoni
|
|
|
|
Standardized name of flags. It is plural becouse each simplex has many flag.
|
2004-05-10 15:31:13 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
Revision 1.3 2005/11/12 18:36:51 cignoni
|
|
|
|
Added 'Visited' flag functions
|
2004-05-10 15:13:17 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
Revision 1.2 2004/04/03 13:33:55 cignoni
|
|
|
|
Missing include
|
2004-05-06 17:28:10 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
Revision 1.1 2004/03/29 08:36:26 cignoni
|
|
|
|
First working version!
|
2004-05-05 19:03:25 +02:00
|
|
|
|
2004-04-28 13:37:15 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
****************************************************************************/
|
|
|
|
#ifndef __VCG_VERTEX_PLUS
|
|
|
|
#define __VCG_VERTEX_PLUS
|
2004-04-26 11:40:15 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
//#include <vcg/space/point3.h>
|
|
|
|
#include <vcg/space/texcoord2.h>
|
|
|
|
#include <vcg/space/color4.h>
|
|
|
|
#include <vcg/simplex/vertex/component.h>
|
|
|
|
#include <vcg/container/derivation_chain.h>
|
2004-03-10 02:00:21 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
namespace vcg {
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
/*------------------------------------------------------------------*/
|
|
|
|
/*
|
|
|
|
The base class of all the recusive definition chain. It is just a container of the typenames of the various simplexes.
|
|
|
|
These typenames must be known form all the derived classes.
|
|
|
|
*/
|
[ 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 11:42:52 +01:00
|
|
|
//
|
|
|
|
//template <class BVT, class BET, class BFT, class BTT>
|
|
|
|
//class VertexTypeHolder{
|
|
|
|
// public:
|
|
|
|
// typedef BVT VertType;
|
|
|
|
// typedef BET EdgeType;
|
|
|
|
// typedef BFT FaceType;
|
|
|
|
// typedef BTT TetraType;
|
|
|
|
// typedef BVT *VertPointer;
|
|
|
|
// typedef BET *EdgePointer;
|
|
|
|
// typedef BFT *FacePointer;
|
|
|
|
// typedef BTT *TetraPointer;
|
|
|
|
// template < class LeftV>
|
|
|
|
// void ImportLocal(const LeftV & /* left */ ) { }
|
|
|
|
// static void Name(std::vector<std::string> & /* name */){}
|
|
|
|
//
|
|
|
|
//};
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
/* The base class form which we start to add our components.
|
|
|
|
it has the empty definition for all the standard members (coords, color flags)
|
|
|
|
Note:
|
|
|
|
in order to avoid both virtual classes and ambiguous definitions all
|
|
|
|
the subsequent overrides must be done in a sequence of derivation.
|
|
|
|
|
|
|
|
In other words we cannot derive and add in a single derivation step
|
|
|
|
(with multiple ancestor), both the real (non-empty) normal and color but
|
|
|
|
we have to build the type a step a time (deriving from a single ancestor at a time).
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
[ 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 11:42:52 +01:00
|
|
|
//template <class UserUsedTypes>
|
|
|
|
//class VertexBase: public vertex::EmptyCore< UserUsedTypes >{
|
|
|
|
//};
|
2004-03-03 17:07:57 +01:00
|
|
|
|
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
/* The Real Big Vertex class;
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
The class __VertexArityMax__ is the one that is the Last to be derived,
|
|
|
|
and therefore is the only one to know the real members
|
|
|
|
(after the many overrides) so all the functions with common behaviour
|
|
|
|
using the members defined in the various Empty/nonEmpty component classes
|
|
|
|
MUST be defined here.
|
2008-09-28 16:30:09 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
I.e. IsD() that uses the overridden Flags() member must be defined here.
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
*/
|
2004-09-28 17:24:56 +02:00
|
|
|
|
[ 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 11:42:52 +01:00
|
|
|
template <class UserTypes,
|
2008-12-19 11:31:56 +01:00
|
|
|
template <typename> class A, template <typename> class B,
|
|
|
|
template <typename> class C, template <typename> class D,
|
|
|
|
template <typename> class E, template <typename> class F,
|
|
|
|
template <typename> class G, template <typename> class H,
|
|
|
|
template <typename> class I, template <typename> class J,
|
|
|
|
template <typename> class K, template <typename> class L>
|
[ 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 11:42:52 +01:00
|
|
|
class VertexArityMax: public Arity12<vertex::EmptyCore<UserTypes>, A, B, C, D, E, F, G, H, I, J, K, L> {
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
// ----- Flags stuff -----
|
2004-03-03 17:07:57 +01:00
|
|
|
public:
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
enum {
|
|
|
|
|
|
|
|
DELETED = 0x0001, // This bit indicate that the vertex is deleted from the mesh
|
|
|
|
NOTREAD = 0x0002, // This bit indicate that the vertex of the mesh is not readable
|
|
|
|
NOTWRITE = 0x0004, // This bit indicate that the vertex is not modifiable
|
|
|
|
MODIFIED = 0x0008, // This bit indicate that the vertex is modified
|
|
|
|
VISITED = 0x0010, // This bit can be used to mark the visited vertex
|
|
|
|
SELECTED = 0x0020, // This bit can be used to select
|
|
|
|
BORDER = 0x0100, // Border Flag
|
|
|
|
USER0 = 0x0200 // First user bit
|
|
|
|
};
|
2004-07-15 13:25:01 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
inline int & UberFlags () { return this->Flags(); }
|
2009-06-03 14:23:20 +02:00
|
|
|
inline int UberFlags() const { return this->Flags(); }
|
2008-12-19 11:31:56 +01:00
|
|
|
|
|
|
|
bool IsD() const {return (this->Flags() & DELETED) != 0;} /// checks if the vertex is deleted
|
|
|
|
bool IsR() const {return (this->Flags() & NOTREAD) == 0;} /// checks if the vertex is readable
|
|
|
|
bool IsW() const {return (this->Flags() & NOTWRITE)== 0;}/// checks if the vertex is modifiable
|
|
|
|
bool IsRW() const {return (this->Flags() & (NOTREAD | NOTWRITE)) == 0;}/// This funcion checks whether the vertex is both readable and modifiable
|
|
|
|
bool IsS() const {return (this->Flags() & SELECTED) != 0;}/// checks if the vertex is Selected
|
|
|
|
bool IsB() const {return (this->Flags() & BORDER) != 0;}/// checks if the vertex is a border one
|
|
|
|
bool IsV() const {return (this->Flags() & VISITED) != 0;}/// checks if the vertex Has been visited
|
|
|
|
|
2004-03-03 17:07:57 +01:00
|
|
|
|
|
|
|
/** Set the flag value
|
|
|
|
@param flagp Valore da inserire nel flag
|
|
|
|
*/
|
2008-12-19 11:31:56 +01:00
|
|
|
void SetFlags(int flagp) {this->Flags()=flagp;}
|
2004-03-03 17:07:57 +01:00
|
|
|
|
|
|
|
/** Set the flag value
|
|
|
|
@param flagp Valore da inserire nel flag
|
|
|
|
*/
|
2008-12-19 11:31:56 +01:00
|
|
|
void ClearFlags() {this->Flags()=0;}
|
|
|
|
void SetD() {this->Flags() |=DELETED;}/// deletes the vertex from the mesh
|
|
|
|
void ClearD() {this->Flags() &=(~DELETED);}/// un-delete a vertex
|
|
|
|
void SetR() {this->Flags() &=(~NOTREAD);}/// marks the vertex as readable
|
|
|
|
void ClearR() {this->Flags() |=NOTREAD;}/// marks the vertex as not readable
|
|
|
|
void ClearW() {this->Flags() |=NOTWRITE;}/// marks the vertex as writable
|
|
|
|
void SetW() {this->Flags() &=(~NOTWRITE);}/// marks the vertex as not writable
|
|
|
|
void SetS() {this->Flags() |=SELECTED;}/// select the vertex
|
|
|
|
void ClearS() {this->Flags() &= ~SELECTED;}/// Un-select a vertex
|
|
|
|
void SetB() {this->Flags() |=BORDER;}
|
|
|
|
void ClearB() {this->Flags() &=~BORDER;}
|
|
|
|
void SetV() {this->Flags() |=VISITED;}
|
|
|
|
void ClearV() {this->Flags() &=~VISITED;}
|
|
|
|
|
|
|
|
/// Return the first bit that is not still used
|
2004-03-03 17:07:57 +01:00
|
|
|
static int &LastBitFlag()
|
|
|
|
{
|
|
|
|
static int b =USER0;
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// allocate a bit among the flags that can be used by user.
|
2004-07-15 13:25:01 +02:00
|
|
|
static inline int NewBitFlag()
|
2004-03-03 17:07:57 +01:00
|
|
|
{
|
|
|
|
LastBitFlag()=LastBitFlag()<<1;
|
|
|
|
return LastBitFlag();
|
|
|
|
}
|
|
|
|
// de-allocate a bit among the flags that can be used by user.
|
2004-07-15 13:25:01 +02:00
|
|
|
static inline bool DeleteBitFlag(int bitval)
|
2004-03-03 17:07:57 +01:00
|
|
|
{
|
|
|
|
if(LastBitFlag()==bitval) {
|
|
|
|
LastBitFlag()= LastBitFlag()>>1;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
assert(0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
/// This function checks if the given user bit is true
|
2008-12-19 11:31:56 +01:00
|
|
|
bool IsUserBit(int userBit){return (this->Flags() & userBit) != 0;}
|
2004-03-03 17:07:57 +01:00
|
|
|
/// This function set the given user bit
|
2008-12-19 11:31:56 +01:00
|
|
|
void SetUserBit(int userBit){this->Flags() |=userBit;}
|
2004-03-03 17:07:57 +01:00
|
|
|
/// This function clear the given user bit
|
2008-12-19 11:31:56 +01:00
|
|
|
void ClearUserBit(int userBit){this->Flags() &= (~userBit);}
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
template<class BoxType>
|
|
|
|
void GetBBox( BoxType & bb ) const
|
|
|
|
{ bb.Set(this->P()); }
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
};
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
|
|
|
|
/*
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
These are the three main classes that are used by the library user to define its own vertexes.
|
|
|
|
The user MUST specify the names of all the type involved in a generic complex.
|
|
|
|
so for example when defining a vertex of a trimesh you must know the name of the type of the edge and of the face.
|
|
|
|
Typical usage example:
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
A vertex with coords, flags and normal for use in a standard trimesh:
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
class VertexNf : public VertexSimp2< VertexNf, EdgeProto, FaceProto, vert::Coord3d, vert::Flag, vert::Normal3f > {};
|
2004-05-05 19:03:25 +02:00
|
|
|
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
A vertex with coords, and normal for use in a tetrahedral mesh AND in a standard trimesh:
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
class TetraVertex : public VertexSimp3< TetraVertex, EdgeProto, FaceProto, TetraProto, vert::Coord3d, vert::Normal3f > {};
|
2004-03-03 17:07:57 +01:00
|
|
|
|
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
A summary of the available vertex attributes (see component.h for more details):
|
|
|
|
|
|
|
|
Coord3f, Coord3d,
|
|
|
|
Normal3s, Normal3f, Normal3d
|
|
|
|
Mark //a int component (incremental mark)
|
|
|
|
BitFlags
|
|
|
|
TexCoord2s, TexCoord2f, TexCoord2d
|
|
|
|
Color4b
|
|
|
|
Qualitys, Qualityf, Qualityd
|
|
|
|
VFAdj //topology (vertex->face adjacency)
|
|
|
|
*/
|
2004-03-03 17:07:57 +01:00
|
|
|
|
[ 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 11:42:52 +01:00
|
|
|
template <class UserTypes,
|
2008-12-19 11:31:56 +01:00
|
|
|
template <typename> class A = DefaultDeriver, template <typename> class B = DefaultDeriver,
|
|
|
|
template <typename> class C = DefaultDeriver, template <typename> class D = DefaultDeriver,
|
|
|
|
template <typename> class E = DefaultDeriver, template <typename> class F = DefaultDeriver,
|
|
|
|
template <typename> class G = DefaultDeriver, template <typename> class H = DefaultDeriver,
|
|
|
|
template <typename> class I = DefaultDeriver, template <typename> class J = DefaultDeriver,
|
|
|
|
template <typename> class K = DefaultDeriver, template <typename> class L = DefaultDeriver>
|
[ 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 11:42:52 +01:00
|
|
|
class Vertex: public VertexArityMax<UserTypes, A, B, C, D, E, F, G, H, I, J, K, L> {};
|
2004-03-03 17:07:57 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
}// end namespace
|
2004-03-03 17:07:57 +01:00
|
|
|
#endif
|