This commit is contained in:
ganovelli 2008-12-19 10:31:56 +00:00
parent 698f6cbd7e
commit c9b6f8f7c8
34 changed files with 2774 additions and 1661 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,985 @@
/****************************************************************************
* 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 $
Revision 1.30 2007/02/26 14:21:44 turini
VTb moved to VTp
Revision 1.29 2007/02/20 14:08:34 ganovelli
added QualityType to comply vertexplus type
Revision 1.28 2006/08/23 15:34:20 marfr960
added minimal comments
Revision 1.26 2005/11/12 18:41:14 cignoni
Added HasFlags and initialization of flags at construction.
Revision 1.25 2005/10/14 13:25:50 cignoni
Added cVFp member
Revision 1.24 2005/10/06 14:26:39 pietroni
added getBBox method
Revision 1.23 2005/03/18 16:38:36 fiorin
Minor changes
Revision 1.22 2005/03/18 00:13:45 cignoni
Removed NormalizedNormalV (out of standard and wrong) and
added the member functions Normal and NormalizedNormal() (just like for faces)
Revision 1.21 2004/10/28 00:50:49 cignoni
Better Doxygen documentation
Revision 1.20 2004/10/11 17:45:05 ganovelli
added template on corrdinate type (default Point3)
Revision 1.19 2004/09/28 15:24:56 fiorin
DUMMY classes definition moved into vcg namespace
Revision 1.18 2004/08/25 15:15:27 ganovelli
minor changes to comply gcc compiler (typename's and stuff)
Revision 1.17 2004/07/20 15:24:53 pietroni
corrected NormalizedNormalV function...
Revision 1.16 2004/07/15 11:25:01 ganovelli
VFb moved to VFp, userbit to bitflag,setV, inclusion of pos.h
Revision 1.15 2004/07/15 10:13:48 pietroni
adde NormalizedNormalV funtion to compute the normal on a vertex
Revision 1.14 2004/05/13 22:44:40 ganovelli
syntax error (typo)
Revision 1.13 2004/05/13 22:40:02 ganovelli
default template parameters
Revision 1.12 2004/05/13 12:49:22 pietroni
no default template parameters... each one must be specified
Revision 1.12 2004/05/10 13:31:13 ganovelli
function for edge adjacency added
$Log: not supported by cvs2svn $
Revision 1.30 2007/02/26 14:21:44 turini
VTb moved to VTp
Revision 1.29 2007/02/20 14:08:34 ganovelli
added QualityType to comply vertexplus type
Revision 1.28 2006/08/23 15:34:20 marfr960
added minimal comments
Revision 1.26 2005/11/12 18:41:14 cignoni
Added HasFlags and initialization of flags at construction.
Revision 1.25 2005/10/14 13:25:50 cignoni
Added cVFp member
Revision 1.24 2005/10/06 14:26:39 pietroni
added getBBox method
Revision 1.23 2005/03/18 16:38:36 fiorin
Minor changes
Revision 1.22 2005/03/18 00:13:45 cignoni
Removed NormalizedNormalV (out of standard and wrong) and
added the member functions Normal and NormalizedNormal() (just like for faces)
Revision 1.21 2004/10/28 00:50:49 cignoni
Better Doxygen documentation
Revision 1.20 2004/10/11 17:45:05 ganovelli
added template on corrdinate type (default Point3)
Revision 1.19 2004/09/28 15:24:56 fiorin
DUMMY classes definition moved into vcg namespace
Revision 1.18 2004/08/25 15:15:27 ganovelli
minor changes to comply gcc compiler (typename's and stuff)
Revision 1.17 2004/07/20 15:24:53 pietroni
corrected NormalizedNormalV function...
Revision 1.16 2004/07/15 11:25:01 ganovelli
VFb moved to VFp, userbit to bitflag,setV, inclusion of pos.h
Revision 1.15 2004/07/15 10:13:48 pietroni
adde NormalizedNormalV funtion to compute the normal on a vertex
Revision 1.14 2004/05/13 22:44:40 ganovelli
syntax error (typo)
Revision 1.13 2004/05/13 22:40:02 ganovelli
default template parameters
Revision 1.12 2004/05/13 12:49:22 pietroni
no default template parameters... each one must be specified
Revision 1.11 2004/05/10 13:31:13 ganovelli
function for edge adjacency added
Revision 1.10 2004/05/10 13:13:17 cignoni
added void to Convert, corrected return object in VFp
Revision 1.9 2004/05/06 15:28:10 pietroni
changed names to VF topology function (was missed)
Revision 1.8 2004/05/05 17:03:25 pietroni
changed name to topology functions
Revision 1.7 2004/04/28 11:37:14 pietroni
*** empty log message ***
Revision 1.6 2004/04/26 09:40:15 pietroni
*** empty log message ***
Revision 1.6 2004/04/23 14:55:06 pietroni
conversion funtion
Revision 1.5 2004/03/10 00:59:06 cignoni
minor changes
Revision 1.4 2004/03/03 16:07:57 cignoni
Yet another cr lf mismatch
Revision 1.3 2004/02/24 21:36:39 cignoni
grouped documentation, changed typenames and reflection mechanism
Revision 1.2 2004/02/13 02:09:39 cignoni
First working release, with doxygen comment structure
Revision 1.1 2004/02/10 01:11:28 cignoni
Edited Comments and GPL license
****************************************************************************/
#ifndef VERTEX_TYPE
#pragma message("\nYou should never directly include this file\_n")
#else
#pragma message("VCGLIB Warning: this way to define the simplex vertex is DEPRECATED and no more SUPPORTED")
#pragma message("VCGLIB Warning: use vcg/simplex/vertexplus instead ")
#include<vcg/space/point3.h>
#include<vcg/space/color4.h>
#include<vcg/space/texcoord2.h>
#include<vcg/simplex/face/pos.h>
#include<vcg/space/box3.h>
namespace vcg {
class DUMMYFACETYPE;
class DUMMYEDGETYPE;
class DUMMYTETRATYPE;
/** \addtogroup vertex */
//@{
/*!
* This class represent the generic configurable Vertex;
* Usually you never direclty use this class with this name but you build
* your own type by directly including one of the .h files under the face/with
* directory. Each file specify a class type with the desired fields. So for example
* including 'vcg/simplex/vertex/with/VCVN.h' allow you to use the class VertVCVN that has per-vertex color and normal stored inside.
*/
template <class FLTYPE, class VETYPE = DUMMYEDGETYPE, class VFTYPE = DUMMYFACETYPE, class VTTYPE = DUMMYTETRATYPE,class TCTYPE = TexCoord2<float,1>, class CoordTYPE= Point3<FLTYPE> >
class VERTEX_TYPE
{
public:
/// The scalar type used to represent coords (i.e. float, double, ...)
typedef FLTYPE ScalarType;
/// The coordinate type used to represent the point (i.e. Point3f, Point3d, ...)
typedef CoordTYPE CoordType;
typedef Point3<ScalarType> NormalType;
/// The type base of the vertex, useful for recovering the original typename after user subclassing
typedef VERTEX_TYPE BaseVertexType;
/// The type of the face pointed by the vertex if vertex edge topology is present
typedef VETYPE EdgeType;
/// The type base of the vertex, useful for recovering the original typename after user subclassing
typedef VFTYPE FaceType;
/// The type of the quality (same as scalar)
typedef ScalarType QualityType;
/***********************************************/
/** @name Vertex Coords
blah
blah
**/
//@{
protected:
/// Spatial coordinates of the vertex
CoordType _p;
public:
/// Return the spatial coordinate of the vertex
inline CoordType & P()
{
assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 );
assert( (_flags & NOTWRITE) == 0 );
return _p;
}
/// Return the constant spatial coordinate of the vertex
inline const CoordType & P() const
{
assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 );
return _p;
}
/// Return the constant spatial coordinate of the vertex
inline const CoordType & cP() const
{
assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 );
return _p;
}
/// Return the spatial coordinate of the vertex, senza effettuare controlli sul flag
inline CoordType & UberP()
{
return _p;
}
/// Return the constant spatial coordinate of the vertex, senza effettuare controlli sul flag
inline const CoordType & UberP() const
{
return _p;
}
//@}
/***********************************************/
/** @name Vertex Flags
For each vertex we store a set of boolean values packed in a int.
The default value for each flag is 0. Most commonly used flags are the \a deleted and the \a selected ones.
Users can ask and dispose for a bit for their own purposes with the vcg::VertexFull::NewUserBit() and vcg::VertexFull::DeleteUserBit() functions.
The value returned by these functions has to be passed to the
vcg::VertexFull::SetUserBit() vcg::VertexFull::ClearUserBit() and vcg::VertexFull::IsUserBit() functions to check and modify the obtained bit flag.
**/
//@{
protected:
/// This are the flags of vertex, the default (reasonable) value is 0
int _flags;
public:
/// Return the vector of _flags
inline int & Flags ()
{
assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 );
return _flags;
}
/// Return the vector of _flags, senza effettuare controlli sui bit
inline int & UberFlags ()
{
return _flags;
}
inline const int UberFlags() const
{
return _flags;
}
/// checks if the vertex is deleted
bool IsD() const {return (_flags & DELETED) != 0;}
/// checks if the vertex is readable
bool IsR() const {return (_flags & NOTREAD) == 0;}
/// checks if the vertex is modifiable
bool IsW() const {return (_flags & NOTWRITE)== 0;}
/// This funcion checks whether the vertex is both readable and modifiable
bool IsRW() const {return (_flags & (NOTREAD | NOTWRITE)) == 0;}
/// checks if the vertex is Modified
bool IsS() const {return (_flags & SELECTED) != 0;}
/// checks if the vertex is readable
bool IsB() const {return (_flags & BORDER) != 0;}
/// checks if the vertex is visited
bool IsV() const {return (_flags & VISITED) != 0;}
/** Set the flag value
@param flagp Valore da inserire nel flag
*/
void SetFlags(int flagp) {_flags=flagp;}
/** Set the flag value
@param flagp Valore da inserire nel flag
*/
void ClearFlags() {_flags=0;}
/// deletes the vertex from the mesh
void SetD() {_flags |=DELETED;}
/// un-delete a vertex
void ClearD() {_flags &=(~DELETED);}
/// marks the vertex as readable
void SetR() {_flags &=(~NOTREAD);}
/// marks the vertex as not readable
void ClearR() {_flags |=NOTREAD;}
/// marks the vertex as writable
void ClearW() {_flags |=NOTWRITE;}
/// marks the vertex as not writable
void SetW() {_flags &=(~NOTWRITE);}
/// select the vertex
void SetS() {_flags |=SELECTED;}
/// Un-select a vertex
void ClearS() {_flags &= ~SELECTED;}
/// Set vertex as ob border
void SetB() {_flags |=BORDER;}
void ClearB() {_flags &=~BORDER;}
/// checks if the vertex is visited
void ClearV() {_flags &= ~VISITED;}
/// checks if the vertex is visited
void SetV() {_flags |=VISITED;}
/// Return the first bit that is not still used
static int &LastBitFlag()
{
static int b =USER0;
return b;
}
/// allocate a bit among the flags that can be used by user.
static inline int NewBitFlag()
{
LastBitFlag()=LastBitFlag()<<1;
return LastBitFlag();
}
// de-allocate a bit among the flags that can be used by user.
static inline bool DeleteBitFlag(int bitval)
{
if(LastBitFlag()==bitval) {
LastBitFlag()= LastBitFlag()>>1;
return true;
}
assert(0);
return false;
}
/// This function checks if the given user bit is true
bool IsUserBit(int userBit){return (_flags & userBit) != 0;}
/// This function set the given user bit
void SetUserBit(int userBit){_flags |=userBit;}
/// This function clear the given user bit
void ClearUserBit(int userBit){_flags &= (~userBit);}
//@}
/*#*******************
* Bounding box *
**********************/
void GetBBox( Box3<ScalarType> & bb ) const
{
bb.Set( cP() );
}
/***********************************************/
/** @name Vertex Texture Coords
blah
blah
**/
//@{
#ifdef __VCGLIB_VERTEX_VT
protected:
TCTYPE _t;
#endif
public:
TCTYPE & T()
{
#ifdef __VCGLIB_VERTEX_VT
return _t;
#else
assert(0);
return *(TCTYPE*)(&_flags);
#endif
}
const TCTYPE & T() const
{
#ifdef __VCGLIB_VERTEX_VT
return _t;
#else
assert(0);
return *(TCTYPE*)(&_flags);
#endif
}
//@}
/***********************************************/
/** @name Per vertex Color
blah
blah
**/
//@{
#ifdef __VCGLIB_VERTEX_VC
protected:
Color4b _c;
#endif
public:
Color4b & C()
{
#ifdef __VCGLIB_VERTEX_VC
return _c;
#else
assert(0);
return *(Color4b*)(&_flags);
#endif
}
const Color4b & C() const
{
#ifdef __VCGLIB_VERTEX_VC
return _c;
#else
return Color4b(Color4b::White);
#endif
}
//@}
/***********************************************/
/** @name Vertex Quality
blah
blah
**/
//@{
#ifdef __VCGLIB_VERTEX_VQ
protected:
float _q;
#endif
public:
float & Q()
{
#ifdef __VCGLIB_VERTEX_VQ
return _q;
#else
assert(0);
return *(float*)(&_flags);
#endif
}
const float & Q() const
{
#ifdef __VCGLIB_VERTEX_VQ
return _q;
#else
return 1;
#endif
}
//@}
/** @name Vertex-Edge Adjacency
blah
blah
**/
//@{
#if ((defined __VCGLIB_VERTEX_EA) || (defined __VCGLIB_VERTEX_EAS))
// Puntatore ad un edge appartenente alla stella del vertice, implementa l'adiacenza vertice-edge
protected:
EdgeType *_ep;
int _ei;
#endif
public:
inline EdgeType * & VEp()
{
#if ((defined __VCGLIB_VERTEX_EA) || (defined __VCGLIB_VERTEX_EAS))
return _ep;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return *((EdgeType **)(_flags));
#endif
}
inline const EdgeType * & VEp() const
{
#if ((defined __VCGLIB_VERTEX_EA) || (defined __VCGLIB_VERTEX_EAS))
return _ep;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return (EdgeType *)this;
#endif
}
inline int & VEi()
{
#if ((defined __VCGLIB_VERTEX_EA) || (defined __VCGLIB_VERTEX_EAS))
return _ei;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return _flags;
#endif
}
inline const int & VEi() const
{
#if ((defined __VCGLIB_VERTEX_EA) || (defined __VCGLIB_VERTEX_EAS))
return _ei;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return (void *)this;
#endif
}
//@}
/***********************************************/
/** @name Vertex-Face Adjacency
blah
blah
**/
//@{
#if ((defined __VCGLIB_VERTEX_AF) || (defined __VCGLIB_VERTEX_AFS))
// Puntatore ad una faccia appartenente alla stella del vertice, implementa l'adiacenza vertice-faccia
protected:
VFTYPE *_vfb;
int _vfi;
#endif
public:
inline VFTYPE * & VFp()
{
#if ((defined __VCGLIB_VERTEX_AF) || (defined __VCGLIB_VERTEX_AFS))
return _vfb;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
static VFTYPE *dum;
return dum;
#endif
}
inline const VFTYPE * & VFp() const
{
#if ((defined __VCGLIB_VERTEX_AF) || (defined __VCGLIB_VERTEX_AFS))
return _vfb;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return (VFTYPE *)0;
#endif
}
inline const VFTYPE * cVFp() const
{
#if ((defined __VCGLIB_VERTEX_AF) || (defined __VCGLIB_VERTEX_AFS))
return _vfb;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return (VFTYPE *)0;
#endif
}
inline int & VFi()
{
#if ((defined __VCGLIB_VERTEX_AF) || (defined __VCGLIB_VERTEX_AFS))
return _vfi;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return _flags;
#endif
}
inline const int & VFi() const
{
#if ((defined __VCGLIB_VERTEX_AF) || (defined __VCGLIB_VERTEX_AFS))
return _vfi;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return (void *)this;
#endif
}
//@}
/***********************************************/
/** @name Vertex-Tetrahedron Adjacency
blah
blah
**/
//@{
#if ((defined __VCGLIB_VERTEX_AT) || (defined __VCGLIB_VERTEX_ATS))
// Pointer to first tetrahedron of the start implements the Vertex-Tetrahedron Topology
protected:
VTTYPE *_vtp;
int _vti;
#endif
public:
inline VTTYPE * & VTp()
{
#if ((defined __VCGLIB_VERTEX_AT) || (defined __VCGLIB_VERTEX_ATS))
return _vtp;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return *((VTTYPE **)(_flags));
#endif
}
inline const VTTYPE * & VTp() const
{
#if ((defined __VCGLIB_VERTEX_AT) || (defined __VCGLIB_VERTEX_ATS))
return _vtp;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return (VTTYPE *)this;
#endif
}
inline int & VTi()
{
#if ((defined __VCGLIB_VERTEX_AT) || (defined __VCGLIB_VERTEX_ATS))
return _vti;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return _flags;
#endif
}
inline const int & VTi() const
{
#if ((defined __VCGLIB_VERTEX_AT) || (defined __VCGLIB_VERTEX_ATS))
return _vti;
#else
assert(0);// you are probably trying to use VF topology in a vertex without it
return (void *)this;
#endif
}
//@}
/***********************************************/
/** @name Vertex Incremental Mark
blah
blah
**/
//@{
#ifdef __VCGLIB_VERTEX_VM
protected:
/// The incremental vertex mark
int _imark;
#endif // Mark
public:
#ifdef __VCGLIB_VERTEX_VM
/// This function return the vertex incremental mark
inline int & IMark()
{
assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 );
assert( (_flags & NOTWRITE) == 0 );
return _imark;
}
/// This function return the constant vertex incremental mark
inline const int & IMark() const
{
assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 );
return _imark;
}
#endif
/// Initialize the _imark system of the vertex
inline void InitIMark()
{
#ifdef __VCGLIB_VERTEX_VM
_imark = 0;
#endif
}
//@}
/***********************************************/
/** @name Vertex Normal
blah
blah
**/
//@{
#ifdef __VCGLIB_VERTEX_VN
protected:
CoordType _n;
#endif
public:
/// Return the vertex normal
inline CoordType & N()
{
assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 );
assert( (_flags & NOTWRITE) == 0 );
#ifdef __VCGLIB_VERTEX_VN
return _n;
#else
assert(0);
return *(CoordType *)this;
#endif
}
/// Return the constant vertex normal
inline const CoordType & N() const
{
assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 );
#ifdef __VCGLIB_VERTEX_VN
return _n;
#else
assert(0);
return *(CoordType *)this;
#endif
}
inline const CoordType cN() const
{
assert( (_flags & DELETED) == 0 );
assert( (_flags & NOTREAD) == 0 );
#ifdef __VCGLIB_VERTEX_VN
return _n;
#else
return CoordType(0,0,0);
#endif
}
/// Return the Normal of the vertex
inline CoordType & UberN()
{
#ifdef __VCGLIB_VERTEX_VN
return _n;
#else
assert(0);
return *(CoordType *)this;
#endif
}
/// Return the constant normal of the vertex
inline const CoordType & UberN() const
{
#ifdef __VCGLIB_VERTEX_VN
return _n;
#else
assert(0);
return *(CoordType *)this;
#endif
}
template <bool NormalizeFlag>
const CoordType GenericNormal()
{
if (!HasVFAdjacency())
{
assert(0);
return (VERTEX_TYPE::CoordType (0,0,0));
}
else
{
vcg::face::VFIterator<typename VERTEX_TYPE::FaceType> VFi=vcg::face::VFIterator<typename VERTEX_TYPE::FaceType>();
VFi.f=VFp();
VFi.z=VFi();
typename VERTEX_TYPE::CoordType N= typename VERTEX_TYPE::CoordType(0,0,0);
while (!VFi.End())
{
N+=VFi.f->Normal();
VFi++;
}
if(NormalizeFlag) N.Normalize();
return N;
}
}
/// Return the un-normalized value of the vertex normal as it correspond to the current geometry.
/// It is always computed and never use any stored value.
/// REQUIRES vertex-face topology
const CoordType Normal() { return GenericNormal<false>(); }
/// Return the normalized value of the vertex normal as it correspond to the current geometry.
/// It is always computed and never use any stored value.
/// REQUIRES vertex-face topology
const CoordType NormalizedNormal() { return GenericNormal<true>(); }
//@}
/***********************************************/
/** @name Reflection Functions
Static functions that give information about the current vertex type.
Reflection is a mechanism making it possible to investigate yourself. Reflection is used to investigate format of objects at runtime, invoke methods and access fields of these objects. Here we provide static const functions that are resolved at compile time and they give information about the data (normal, color etc.) supported by the current vertex type.
**/
//@{
static bool HasFlags() { // Note the plural because ONE vertex has many Flags (but just one color, normal, mark, quality ecc.)
return true;
}
static bool HasNormal() {
#ifdef __VCGLIB_VERTEX_VN
return true;
#else
return false;
#endif
}
static bool HasColor() {
#ifdef __VCGLIB_VERTEX_VC
return true;
#else
return false;
#endif
}
static bool HasMark() {
#ifdef __VCGLIB_VERTEX_VM
return true;
#else
return false;
#endif
}
static bool HasQuality() {
#ifdef __VCGLIB_VERTEX_VQ
return true;
#else
return false;
#endif
}
static bool HasTexCoord() {
#ifdef __VCGLIB_VERTEX_VT
return true;
#else
return false;
#endif
}
static bool HasVFAdjacency() {
#ifdef __VCGLIB_VERTEX_AF
return true;
#else
return false;
#endif
}
static bool HasVTAdjacency() {
#ifdef __VCGLIB_VERTEX_AT
return true;
#else
return false;
#endif
}
static bool HasVEAdjacency() {
#ifdef __VCGLIB_VERTEX_EA
return true;
#else
return false;
#endif
}
//@}
/***********************************************/
/** @Conversion to other vertex
**/
//@{
template <class VERT_TYPE>
inline void Convert( VERT_TYPE &v )
{
P()=v.P();
Flags()=v.Flags();
if ((HasNormal())&&(v.HasNormal()))
N()=v.N();
if ((HasColor())&&(v.HasColor()))
C()=v.C();
#ifdef __VCGLIB_VERTEX_VM
if ((HasMark())&&(v.HasMark()))
IMark()=v.IMark();
#endif
if ((HasQuality())&&(v.HasQuality()))
Q()=v.Q();
if ((HasTexCoord())&&(v.HasTexCoord()))
T()=v.T();
}
//@}
enum {
// This bit indicate that the vertex is deleted from the mesh
DELETED = 0x0001, // cancellato
// This bit indicate that the vertex of the mesh is not readable
NOTREAD = 0x0002, // non leggibile (ma forse modificabile)
// This bit indicate that the vertex is not modifiable
NOTWRITE = 0x0004, // non modificabile (ma forse leggibile)
// This bit indicate that the vertex is modified
MODIFIED = 0x0008, // modificato
// This bit can be used to mark the visited vertex
VISITED = 0x0010, // Visited
// This bit can be used to select
SELECTED = 0x0020, // Selection flag
// Border Flag
BORDER = 0x0100,
// First user bit
USER0 = 0x0200 // Fisrt user bit
};
/** Return the i-th spatial value of the vertex coordinate.
@param i Index of the spatial vertex coordinate (x=0 y=1 z=2).
*/
inline ScalarType & operator [] ( const int i ){
assert(i>=0 && i<3);
return P().V(i);
}
/** Return the i-th spatial value of the const vertex coordinate.
@param i Index of the spatial vertex coordinate (x=0 y=1 z=2).
*/
inline const FLTYPE & operator [] ( const int i ) const {
assert(i>=0 && i<3);
return P().V(i);
}
/// Operator to compare two vertices using lexicographic order
inline bool operator < ( const VERTEX_TYPE & ve) const {
return _p < ve._p;
}
inline VERTEX_TYPE() {
//#ifdef _DEBUG
_flags=0;
//#endif
};
};
//@}
} // end namespace
#endif

View File

@ -0,0 +1,610 @@
/****************************************************************************
* 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 $
Revision 1.27 2008/04/03 23:12:28 cignoni
compacted two pair of empty components to shorten derivation chains
Revision 1.26 2008/03/17 11:39:14 ganovelli
added curvature and curvatruredir (compiled .net 2005 and gcc)
Revision 1.25 2008/02/05 10:11:34 cignoni
A small typo (a T:: instead of TT::)
Revision 1.24 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
Revision 1.23 2007/06/04 15:40:22 turini
Add vertex-tetrahedron adjacency component VTAdj.
Revision 1.22 2007/03/12 15:37:21 tarini
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
Revision 1.21 2007/02/18 07:41:32 cignoni
Corrected small syntax errors detected by gcc
Revision 1.20 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
Revision 1.19 2006/12/11 23:40:57 ganovelli
Has*Opt migrated to Has*Occ
Revision 1.18 2006/11/28 22:34:28 cignoni
Added default constructor with null initialization to adjacency members.
AddFaces and AddVertices NEED to know if the topology is correctly computed to update it.
Revision 1.17 2006/01/09 13:58:56 cignoni
Added Initialization of Color in Vertex and Face Components
Revision 1.16 2005/11/22 23:58:03 cignoni
Added intiailization of flags to zero in the constructor,
Revision 1.15 2005/11/18 15:44:51 cignoni
Access to constant normal changed from by val to by reference
Revision 1.14 2005/11/16 23:02:37 cignoni
Added some missing members to EmptyMark
Standardized name of flags. It is plural becouse each simplex has many flag.
Revision 1.13 2005/11/14 23:50:57 cignoni
Added Incremental Mark
Revision 1.12 2005/11/12 18:35:49 cignoni
Changed HasFlag -> HasFlags
Revision 1.11 2005/11/01 18:17:52 cignoni
Added an assert(0) in all the accesses to empty components
Revision 1.10 2005/10/15 16:24:10 ganovelli
Working release (compilata solo su MSVC), component_occ <EFBFBD> migrato da component_opt
Revision 1.9 2005/10/14 13:30:07 cignoni
Added constant access functions and reflective functions (HasSomething stuff)
to all the components This is the first really working version...
Revision 1.8 2005/10/07 15:19:54 cignoni
minor updates to keep it in line with the rest of the library
Revision 1.7 2004/05/10 13:50:32 cignoni
Updated names of adj functions to the new standards
Revision 1.6 2004/04/05 11:53:06 cignoni
addend constant access funcs
Revision 1.5 2004/04/03 13:35:51 cignoni
minor changes
Revision 1.4 2004/03/31 13:15:28 cignoni
Added optional cpmponent
Revision 1.3 2004/03/31 12:28:37 ganovelli
*** empty log message ***
Revision 1.2 2004/03/29 14:26:38 cignoni
Error in color
Revision 1.1 2004/03/29 08:36:26 cignoni
First working version!
****************************************************************************/
#ifndef __VCG_VERTEX_PLUS_COMPONENT
#define __VCG_VERTEX_PLUS_COMPONENT
#include <vector>
#include <string>
#include <vcg/space/point3.h>
#include <vcg/space/texcoord2.h>
#include <vcg/space/color4.h>
namespace vcg {
namespace vertex {
/*
Some naming Rules
All the Components that can be added to a vertex should be defined in the namespace vert:
*/
/*------------------------- EMPTY COORD & NORMAL -----------------------------------------*/
template <class T> class EmptyCoordNormal: public T {
public:
typedef vcg::Point3f CoordType;
typedef CoordType::ScalarType ScalarType;
CoordType &P() { static CoordType coord(0, 0, 0); return coord; }
const CoordType &P() const { static CoordType coord(0, 0, 0); assert(0); return coord; }
const CoordType &cP() const { static CoordType coord(0, 0, 0); assert(0); return coord; }
CoordType &UberP() { static CoordType coord(0, 0, 0); return coord; }
static bool HasCoord() { return false; }
typedef vcg::Point3s NormalType;
NormalType &N() { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; }
const NormalType cN()const { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; }
static bool HasNormal() { return false; }
static bool HasNormalOcc() { return false; }
template < class LeftV>
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); }
static void Name(std::vector<std::string> & name){T::Name(name);}
};
/*-------------------------- COORD ----------------------------------------*/
template <class A, class T> class Coord: public T {
public:
typedef A CoordType;
typedef typename CoordType::ScalarType ScalarType;
CoordType &P() { return _coord; }
const CoordType &P() const { return _coord; }
const CoordType &cP() const { return _coord; }
CoordType &UberP() { return _coord; }
template < class LeftV>
void ImportLocal(const LeftV & left ) { P().Import(left.cP()); T::ImportLocal( left); }
static bool HasCoord() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord"));T::Name(name);}
private:
CoordType _coord;
};
template <class T> class Coord3f: public Coord<vcg::Point3f, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord3f"));T::Name(name);}
};
template <class T> class Coord3d: public Coord<vcg::Point3d, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord3d"));T::Name(name);}
};
/*-------------------------- NORMAL ----------------------------------------*/
template <class A, class T> class Normal: public T {
public:
typedef A NormalType;
NormalType &N() { return _norm; }
const NormalType &cN() const { return _norm; }
template < class LeftV>
void ImportLocal(const LeftV & left ) { N() = left.cN(); T::ImportLocal( left); }
static bool HasNormal() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal"));T::Name(name);}
private:
NormalType _norm;
};
template <class T> class Normal3s: public Normal<vcg::Point3s, T> {
public:static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3s"));T::Name(name);}
};
template <class T> class Normal3f: public Normal<vcg::Point3f, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3f"));T::Name(name);}
};
template <class T> class Normal3d: public Normal<vcg::Point3d, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3d"));T::Name(name);}
};
/*-------------------------- INCREMENTAL MARK ----------------------------------------*/
template <class T> class EmptyMark: public T {
public:
static bool HasMark() { return false; }
static bool HasMarkOcc() { return false; }
inline void InitIMark() { }
inline int & IMark() { assert(0); static int tmp=-1; return tmp;}
inline const int & IMark() const {return 0;}
template < class LeftV>
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); }
static void Name(std::vector<std::string> & name){T::Name(name);}
};
template <class T> class Mark: public T {
public:
static bool HasMark() { return true; }
static bool HasMarkOcc() { return true; }
inline void InitIMark() { _imark = 0; }
inline int & IMark() { return _imark;}
inline const int & IMark() const {return _imark;}
template < class LeftV>
void ImportLocal(const LeftV & left ) { IMark() = left.IMark(); T::ImportLocal( left); }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
private:
int _imark;
};
/*-------------------------- TEXCOORD ----------------------------------------*/
template <class TT> class EmptyTexCoord: public TT {
public:
typedef vcg::TexCoord2<float,1> TexCoordType;
TexCoordType &T() { static TexCoordType dummy_texcoord; assert(0); return dummy_texcoord; }
template < class LeftV>
void ImportLocal(const LeftV & left ) { TT::ImportLocal( left); }
static bool HasTexCoord() { return false; }
static void Name(std::vector<std::string> & name){TT::Name(name);}
};
template <class A, class TT> class TexCoord: public TT {
public:
typedef A TexCoordType;
TexCoordType &T() { return _t; }
const TexCoordType &cT() const { return _t; }
template < class LeftV>
void ImportLocal(const LeftV & left ) { T() = left.cT(); TT::ImportLocal( left); }
static bool HasTexCoord() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord"));TT::Name(name);}
private:
TexCoordType _t;
};
template <class TT> class TexCoord2s: public TexCoord<TexCoord2<short,1>, TT> {
static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord2s"));TT::Name(name);}
};
template <class TT> class TexCoord2f: public TexCoord<TexCoord2<float,1>, TT> {
static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord2f"));TT::Name(name);}
};
template <class TT> class TexCoord2d: public TexCoord<TexCoord2<double,1>, TT> {
static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord2d"));TT::Name(name);}
};
/*------------------------- FLAGS -----------------------------------------*/
template <class T> class EmptyBitFlags: public T {
public:
typedef int FlagType;
/// Return the vector of Flags(), senza effettuare controlli sui bit
int &Flags() { static int dummyflags(0); assert(0); return dummyflags; }
const int Flags() const { return 0; }
template < class LeftV>
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); }
static bool HasFlags() { return false; }
static void Name(std::vector<std::string> & name){T::Name(name);}
};
template <class T> class BitFlags: public T {
public:
BitFlags(){_flags=0;}
typedef int FlagType;
int &Flags() {return _flags; }
const int Flags() const {return _flags; }
template < class LeftV>
void ImportLocal(const LeftV & left ) { Flags() = left.Flags(); T::ImportLocal( left); }
static bool HasFlags() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
private:
int _flags;
};
/*-------------------------- EMPTY COLOR & QUALITY ----------------------------------*/
template <class T> class EmptyColorQuality: public T {
public:
typedef float QualityType;
QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
static bool HasQuality() { return false; }
typedef vcg::Color4b ColorType;
ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
const ColorType &cC() const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
template < class LeftV>
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); }
static bool HasColor() { return false; }
static void Name(std::vector<std::string> & name){T::Name(name);}
};
/*-------------------------- Color ----------------------------------*/
template <class A, class T> class Color: public T {
public:
Color():_color(vcg::Color4b::White) {}
typedef A ColorType;
ColorType &C() { return _color; }
const ColorType &C() const { return _color; }
const ColorType &cC() const { return _color; }
template < class LeftV>
void ImportLocal(const LeftV & left ) { C() = left.cC(); T::ImportLocal( left); }
static bool HasColor() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
private:
ColorType _color;
};
template <class TT> class Color4b: public Color<vcg::Color4b, TT> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Color4b"));TT::Name(name);}
};
/*-------------------------- Quality ----------------------------------*/
template <class A, class TT> class Quality: public TT {
public:
typedef A QualityType;
QualityType &Q() { return _quality; }
const QualityType & cQ() const {return _quality; }
template < class LeftV>
void ImportLocal(const LeftV & left ) { Q() = left.cQ(); TT::ImportLocal( left); }
static bool HasQuality() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);}
private:
QualityType _quality;
};
template <class TT> class Qualitys: public Quality<short, TT> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualitys"));TT::Name(name);}
};
template <class TT> class Qualityf: public Quality<float, TT> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualityf"));TT::Name(name);}
};
template <class TT> class Qualityd: public Quality<double, TT> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualityd"));TT::Name(name);}
};
template <class TT> class EmptyCurvatureData:public TT {
public:
typedef float ScalarType;
typedef Point3f VecType;
float &Kh() {static float dummy = 0.f; assert(0);return dummy;;}
float &Kg() { static float dummy = 0.f; assert(0);return dummy;}
const float &cKh() const {static float dummy = 0.f; assert(0);return dummy;;}
const float &cKg()const { static float dummy = 0.f;assert(0); return dummy;}
VecType &PD1(){static VecType v(0,0,0); assert(0);return v;}
VecType &PD2(){static VecType v(0,0,0); assert(0);return v;}
const VecType &cPD1() const {static VecType v(0,0,0); assert(0);return v;}
const VecType &cPD2() const {static VecType v(0,0,0); assert(0);return v;}
ScalarType &K1(){ static ScalarType v = 0.0;assert(0);return v;}
ScalarType &K2(){ static ScalarType v = 0.0;assert(0);return v;}
const ScalarType &cK1() const {static ScalarType v = 0.0;assert(0);return v;}
const ScalarType &cK2()const {static ScalarType v = 0.0;assert(0);return v;}
static bool HasCurvatureOcc() { return false; }
static bool HasCurvatureOcf() { return false; }
static bool HasCurvature() { return false; }
static bool HasCurvatureDir() { return false; }
static void Name(std::vector<std::string> & name){TT::Name(name);}
};
/*-------------------------- Curvature ----------------------------------*/
template <class TT> class EmptyCurvature: public TT {
public:
typedef vcg::Point2<float> CurvatureType;
float &Kh() {static float dummy = 0.f; return dummy;;}
float &Kg() { static float dummy = 0.f; return dummy;}
const float &cKh() const {static float dummy = 0.f; return dummy;;}
const float &cKg()const { static float dummy = 0.f; return dummy;}
static bool HasCurvatureOcc() { return false; }
static bool HasCurvatureOcf() { return false; }
static bool HasCurvature() { return false; }
static void Name(std::vector<std::string> & name){TT::Name(name);}
};
template <class A, class TT> class Curvature: public TT {
public:
typedef Point2<A> CurvatureType;
typedef typename CurvatureType::ScalarType ScalarType;
ScalarType &Kh(){ return _hk[0];}
ScalarType &Kg(){ return _hk[1];}
const ScalarType &cKh() const { return _hk[0];}
const ScalarType &cKg() const { return _hk[1];}
static bool HasCurvature() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvature"));TT::Name(name);}
private:
Point2<A> _hk;
};
template <class T> class Curvaturef: public Curvature< float, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvaturef"));T::Name(name);}
};
template <class T> class Curvatured: public Curvature<double , T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvatured"));T::Name(name);}
};
/*-------------------------- Curvature Direction ----------------------------------*/
template <class S>
struct CurvatureDirBaseType{
typedef Point3<S> VecType;
typedef S ScalarType;
CurvatureDirBaseType () {}
Point3<S>max_dir,min_dir; // max and min curvature direction
S k1,k2;// max and min curvature values
};
template <class TT> class EmptyCurvatureDir: public TT {
public:
typedef CurvatureDirBaseType<float> CurvatureDirType;
Point3f &PD1(){static Point3f dummy(0,0,0); return dummy;}
Point3f &PD2(){static Point3f dummy(0,0,0); return dummy;}
const Point3f &cPD1() const {static Point3f dummy(0,0,0); return dummy;}
const Point3f &cPD2()const {static Point3f dummy(0,0,0); return dummy;}
float &K1(){ static float dummy(0);assert(0);return dummy;}
float &K2(){ static float dummy(0);assert(0);return dummy;}
const float &cK1()const { static float dummy(0);assert(0);return dummy;}
const float &cK2()const { static float dummy(0);assert(0);return dummy;}
static bool HasCurvatureDir() { return false; }
static void Name(std::vector<std::string> & name){TT::Name(name);}
};
template <class A, class TT> class CurvatureDir: public TT {
public:
typedef A CurvatureDirType;
typedef typename CurvatureDirType::VecType VecType;
typedef typename CurvatureDirType::ScalarType ScalarType;
VecType &PD1(){ return _curv.max_dir;}
VecType &PD2(){ return _curv.min_dir;}
const VecType &cPD1() const {return _curv.max_dir;}
const VecType &cPD2() const {return _curv.min_dir;}
ScalarType &K1(){ return _curv.k1;}
ScalarType &K2(){ return _curv.k2;}
const ScalarType &cK1() const {return _curv.k1;}
const ScalarType &cK2()const {return _curv.k2;}
static bool HasCurvatureDir() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDir"));TT::Name(name);}
private:
CurvatureDirType _curv;
};
template <class T> class CurvatureDirf: public CurvatureDir<CurvatureDirBaseType<float>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirf"));T::Name(name);}
};
template <class T> class CurvatureDird: public CurvatureDir<CurvatureDirBaseType<double>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDird"));T::Name(name);}
};
/*-------------------------- Empty Radius ----------------------------------*/
template <class T> class EmptyRadius: public T {
public:
typedef float RadiusType;
typedef RadiusType ScalarType;
RadiusType &R(){ static ScalarType v = 0.0; assert(0 && "the radius component is not available"); return v; }
const RadiusType &cR() const { static const ScalarType v = 0.0; assert(0 && "the radius component is not available"); return v; }
static bool HasRadius() { return false; }
static bool HasRadiusOcf() { return false; }
static void Name(std::vector<std::string> & name){ T::Name(name);}
};
/*----------------------------- VEADJ ------------------------------*/
template <class T> class EmptyVEAdj: public T {
public:
typename T::EdgePointer &VEp() { static typename T::EdgePointer ep=0; assert(0); return ep; }
typename T::EdgePointer cVEp() { static typename T::EdgePointer ep=0; assert(0); return ep; }
int &VEi(){static int z=0; return z;};
template < class LeftV>
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); }
static bool HasVEAdjacency() { return false; }
static bool HasVEAdjacencyOcc() { return false; }
static void Name(std::vector<std::string> & name){ T::Name(name);}
};
template <class T> class VEAdj: public T {
public:
VEAdj(){_ep=0;}
typename T::EdgePointer &VEp() {return _ep; }
typename T::EdgePointer cVEp() {return _ep; }
int &VEi() {return _zp; }
template < class LeftV>
void ImportLocal(const LeftV & left ) { VEp() = NULL; T::ImportLocal( left); }
static bool HasVEAdjacency() { return true; }
static bool HasVEAdjacencyOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VEAdj"));T::Name(name);}
private:
typename T::EdgePointer _ep ;
int _zp ;
};
/*----------------------------- VFADJ ------------------------------*/
template <class T> class EmptyVFAdj: public T {
public:
typename T::FacePointer &VFp() { static typename T::FacePointer fp=0; assert(0); return fp; }
typename T::FacePointer cVFp() { static typename T::FacePointer fp=0; assert(0); return fp; }
int &VFi(){static int z=0; return z;};
template < class LeftV>
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); }
static bool HasVFAdjacency() { return false; }
static bool HasVFAdjacencyOcc() { return false; }
static void Name(std::vector<std::string> & name){ T::Name(name);}
};
template <class T> class VFAdj: public T {
public:
VFAdj(){_fp=0;}
typename T::FacePointer &VFp() {return _fp; }
typename T::FacePointer cVFp() {return _fp; }
int &VFi() {return _zp; }
template < class LeftV>
void ImportLocal(const LeftV & left ) { VFp() = NULL; T::ImportLocal( left); }
static bool HasVFAdjacency() { return true; }
static bool HasVFAdjacencyOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdj"));T::Name(name);}
private:
typename T::FacePointer _fp ;
int _zp ;
};
/*----------------------------- VTADJ ------------------------------*/
template <class T> class EmptyVTAdj: public T {
public:
typename T::TetraPointer &VTp() { static typename T::TetraPointer tp = 0; assert(0); return tp; }
typename T::TetraPointer cVTp() { static typename T::TetraPointer tp = 0; assert(0); return tp; }
int &VTi() { static int z = 0; return z; };
static bool HasVTAdjacency() { return false; }
static bool HasVTAdjacencyOcc() { return false; }
static void Name( std::vector< std::string > & name ) { T::Name(name); }
};
template <class T> class VTAdj: public T {
public:
VTAdj() { _tp = 0; }
typename T::TetraPointer &VTp() { return _tp; }
typename T::TetraPointer cVTp() { return _tp; }
int &VTi() {return _zp; }
static bool HasVTAdjacency() { return true; }
static bool HasVTAdjacencyOcc() { return true; }
static void Name( std::vector< std::string > & name ) { name.push_back( std::string("VTAdj") ); T::Name(name); }
private:
typename T::TetraPointer _tp ;
int _zp ;
};
} // end namespace vert
}// end namespace vcg
#endif

View File

@ -0,0 +1,268 @@
/****************************************************************************
* 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 $
Revision 1.2 2007/03/12 15:37:21 tarini
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
Revision 1.1 2005/10/15 16:24:10 ganovelli
Working release (compilata solo su MSVC), component_occ <EFBFBD> migrato da component_opt
****************************************************************************/
#ifndef __VCG_VERTEX_PLUS_COMPONENT_OCC
#define __VCG_VERTEX_PLUS_COMPONENT_OCC
#include <vcg/simplex/vertex/component.h>
#include <vcg/container/vector_occ.h>
namespace vcg {
namespace vertex {
/*
Some naming Rules
All the Components that can be added to a vertex should be defined in the namespace vert:
*/
/*------------------------- COORD -----------------------------------------*/
template <class A, class T> class CoordOcc: public T {
public:
typedef A CoordType;
typedef typename CoordType::ScalarType ScalarType;
typedef typename T::VertType VertType;
CoordType &P() { return CAT< vector_occ<VertType>,CoordType>::Instance()->Get((VertType*)this); }
CoordType &UberP() { return CAT< vector_occ<VertType>,CoordType>::Instance()->Get((VertType*)this); }
};
template <class T> class Coord3fOcc: public CoordOcc<vcg::Point3f, T> {};
template <class T> class Coord3dOcc: public CoordOcc<vcg::Point3d, T> {};
/*-------------------------- NORMAL ----------------------------------------*/
template <class A, class T> class NormalOcc: public T {
public:
typedef A NormalType;
typedef typename T::VertType VertType;
NormalType &N() {return CAT< vector_occ<VertType>,NormalType>::Instance()->Get((VertType*)this); }
/*private:
NormalType _norm; */
};
template <class T> class Normal3sOcc: public NormalOcc<vcg::Point3s, T> {};
template <class T> class Normal3fOcc: public NormalOcc<vcg::Point3f, T> {};
template <class T> class Normal3dOcc: public NormalOcc<vcg::Point3d, T> {};
/*-------------------------- TEXCOORD ----------------------------------------*/
template <class A, class TT> class TexCoordOcc: public TT {
public:
typedef A TexCoordType;
typedef typename TT::VertType VertType;
TexCoordType &T() {return CAT< vector_occ<VertType>,TexCoordType>::Instance()->Get((VertType*)this); }
static bool HasTexCoord() { return true; }
static bool HasTexCoordOcc() { return true; }
/* private:
TexCoordType _t; */
};
template <class T> class TexCoord2sOcc: public TexCoordOcc<TexCoord2<short,1>, T> {};
template <class T> class TexCoord2fOcc: public TexCoordOcc<TexCoord2<float,1>, T> {};
template <class T> class TexCoord2dOcc: public TexCoordOcc<TexCoord2<double,1>, T> {};
///*------------------------- FLAGS -----------------------------------------*/
template <class T> class FlagOcc: public T {
public:
typedef typename T::VertType VertType;
int &Flags() {return CAT< vector_occ<VertType>,int>::Instance()->Get((VertType*)this); }
const int Flags() const {return CAT< vector_occ<VertType>,int>::Instance()->Get((VertType*)this); }
static bool HasFlags() {return true;}
static bool HasFlagsOcc() {return true;}
};
///*-------------------------- COLOR ----------------------------------*/
template <class A, class T> class ColorOcc: public T {
public:
typedef A ColorType;
typedef typename T::VertType VertType;
ColorType &C() { return CAT< vector_occ<VertType>,ColorType>::Instance()->Get((VertType*)this); }
static bool HasColor() { return true; }
/*private:
ColorType _color; */
};
template <class T> class Color4bOcc: public ColorOcc<vcg::Color4b, T> {};
///*-------------------------- Quality ----------------------------------*/
template <class A, class T> class QualityOcc: public T {
public:
typedef A QualityType;
typedef typename T::VertType VertType;
QualityType &Q() { return CAT< vector_occ<VertType>,QualityType>::Instance()->Get((VertType*)this);}
static bool HasQuality() { return true; }
/*private:
QualityType _quality; */
};
template <class T> class QualitysOcc: public QualityOcc<short, T> {};
template <class T> class QualityfOcc: public QualityOcc<float, T> {};
template <class T> class QualitydOcc: public QualityOcc<double, T> {};
//
///*-------------------------- Curvature ----------------------------------*/
template <class A, class TT> class CurvatureOcc: public TT {
public:
typedef Point2<A> CurvatureTypeOcc;
typedef typename TT::VertType VertType;
typedef typename CurvatureTypeOcc::ScalarType ScalarType;
ScalarType &H(){ return CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0];}
ScalarType &K(){ return CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1];}
const ScalarType &cH() const { return CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0];}
const ScalarType &cK() const { return CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1];}
template <class LeftV>
void ImportLocal(const LeftV & leftV){
CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0] = leftV.cH();
CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1] = leftV.cK();
TT::ImporLocal(leftV);
}
static bool HasCurvature() { return true; }
static bool HasCurvatureOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureOcc"));TT::Name(name);}
private:
};
template <class T> class CurvaturefOcc: public CurvatureOcc<float, T> {
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvaturefOcc"));T::Name(name);}
};
template <class T> class CurvaturedOcc: public CurvatureOcc<double, T> {
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvaturedOcc"));T::Name(name);}
};
/*-------------------------- Curvature Direction ----------------------------------*/
template <class S>
struct CurvatureDirTypeOcc{
typedef Point3<S> VecType;
typedef S ScalarType;
CurvatureDirTypeOcc () {}
Point3<S>max_dir,min_dir; // max and min curvature direction
S k1,k2;// max and min curvature values
};
template <class A, class TT> class CurvatureDirOcc: public TT {
public:
typedef A CurvatureDirTypeOcc;
typedef typename CurvatureDirTypeOcc::VecType VecType;
typedef typename CurvatureDirTypeOcc::ScalarType ScalarType;
typedef typename TT::VertType VertType;
VecType &PD1(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).max_dir;}
VecType &PD2(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).min_dir;}
const VecType &cPD1() const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).max_dir;}
const VecType &cPD2() const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).min_dir;}
ScalarType &K1(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k1;}
ScalarType &K2(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k2;}
const ScalarType &cK1() const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k1;}
const ScalarType &cK2()const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k2;}
static bool HasCurvatureDir() { return true; }
static bool HasCurvatureDirOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDir"));TT::Name(name);}
};
template <class T> class CurvatureDirfOcc: public CurvatureDirOcc<CurvatureDirTypeOcc<float>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirf"));T::Name(name);}
};
template <class T> class CurvatureDirdOcc: public CurvatureDirOcc<CurvatureDirTypeOcc<double>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDird"));T::Name(name);}
};
/*-------------------------- RADIUS ----------------------------------*/
template <class A, class TT> class RadiusOcc: public TT {
public:
typedef A RadiusType;
typedef A ScalarType;
typedef typename TT::VertType VertType;
RadiusType &R(){ return CAT< vector_occ<VertType>,RadiusType>::Instance()->Get((VertType*)this);}
const RadiusType &cR() const { return CAT< vector_occ<VertType>,RadiusType>::Instance()->Get((VertType*)this);}
template <class LeftV>
void ImportLocal(const LeftV & leftV){
CAT< vector_occ<VertType>,RadiusType>::Instance()->Get((VertType*)this) = leftV.cR();
TT::ImporLocal(leftV);
}
static bool HasRadius() { return true; }
static bool HasRadiusOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("RadiusOcc"));TT::Name(name);}
private:
};
template <class T> class RadiusfOcc: public RadiusOcc<float, T> {
static void Name(std::vector<std::string> & name){name.push_back(std::string("RadiusfOcc"));T::Name(name);}
};
template <class T> class RadiusdOcc: public RadiusOcc<double, T> {
static void Name(std::vector<std::string> & name){name.push_back(std::string("RadiusdOcc"));T::Name(name);}
};
///*----------------------------- VFADJ ------------------------------*/
template <class T> class VFAdjOcc: public T {
public:
typedef typename T::VertType VertType;
typedef typename T::FacePointer FacePointer;
FacePointer &Fp() {return CAT< vector_occ<VertType>,FacePointer>::Instance()->Get((VertType*)this); }
int &Zp() {return _zp; }
static bool HasVFAdjacency() { return true; }
private:
typename T::FacePointer _fp ;
int _zp ;
};
} // end namespace vert
}// end namespace vcg
#endif

View File

@ -0,0 +1,645 @@
/****************************************************************************
* 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 $
Revision 1.16 2008/04/03 23:15:40 cignoni
added optional mark and cleaned up some nasty type bugs.
Revision 1.15 2008/03/17 11:39:15 ganovelli
added curvature and curvatruredir (compiled .net 2005 and gcc)
Revision 1.14 2008/03/11 09:22:07 cignoni
Completed the garbage collecting functions CompactVertexVector and CompactFaceVector.
Revision 1.13 2008/02/05 20:42:43 cignoni
Other small typos
Revision 1.12 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
Revision 1.11 2007/12/11 18:25:31 cignoni
added missing include limits
Revision 1.10 2007/12/11 11:36:03 cignoni
Added the CompactVertexVector garbage collecting function.
Revision 1.9 2006/12/11 23:42:00 ganovelli
bug Index()() instead of Index()
Revision 1.8 2006/12/04 11:17:42 ganovelli
added forward declaration of TriMesh
Revision 1.7 2006/11/07 17:22:52 cignoni
many gcc compiling issues
Revision 1.6 2006/11/07 15:13:57 zifnab1974
Necessary changes for compilation with gcc 3.4.6. Especially the hash function is a problem
Revision 1.5 2006/11/07 11:29:24 cignoni
Corrected some errors in the reflections Has*** functions
Revision 1.4 2006/10/31 16:02:59 ganovelli
vesione 2005 compliant
Revision 1.3 2006/02/28 11:59:55 ponchio
g++ compliance:
begin() -> (*this).begin() and for end(), size(), Base(), Index()
Revision 1.2 2005/12/12 11:17:32 cignoni
Corrected update function, now only the needed simplexes should be updated.
Revision 1.1 2005/10/14 15:07:59 cignoni
First Really Working version
****************************************************************************/
/*
Note
OCF = Optional Component Fast (hopefully)
compare with OCC(Optional Component Compact)
Mainly the trick here is to store a base pointer in each simplex...
****************************************************************************/
#ifndef __VCG_VERTEX_PLUS_COMPONENT_OCF
#define __VCG_VERTEX_PLUS_COMPONENT_OCF
#include <vcg/simplex/vertex/component.h>
#include <vector>
#include <limits>
namespace vcg {
namespace vertex {
/*
All the Components that can be added to a vertex should be defined in the namespace vert:
*/
template <class VALUE_TYPE>
class vector_ocf: public std::vector<VALUE_TYPE> {
typedef std::vector<VALUE_TYPE> BaseType;
typedef typename vector_ocf<VALUE_TYPE>::iterator ThisTypeIterator;
public:
vector_ocf():std::vector<VALUE_TYPE>(){
QualityEnabled = false;
ColorEnabled = false;
MarkEnabled = false;
NormalEnabled = false;
VFAdjacencyEnabled = false;
CurvatureEnabled = false;
CurvatureEnabled = false;
CurvatureDirEnabled = false;
RadiusEnabled = false;
}
// override di tutte le funzioni che possono spostare
// l'allocazione in memoria del container
void push_back(const VALUE_TYPE & v)
{
BaseType::push_back(v);
BaseType::back()._ovp = this;
if (ColorEnabled) CV.push_back(vcg::Color4b(vcg::Color4b::White));
if (MarkEnabled) MV.push_back(0);
if (NormalEnabled) NV.push_back(typename VALUE_TYPE::NormalType());
if (VFAdjacencyEnabled) AV.push_back(VFAdjType());
if (CurvatureEnabled) CuV.push_back(typename VALUE_TYPE::CurvatureType());
if (CurvatureDirEnabled) CuDV.push_back(typename VALUE_TYPE::CurvatureDirType());
if (RadiusEnabled) RadiusV.push_back(typename VALUE_TYPE::RadiusType());
}
void pop_back();
void resize(const unsigned int & _size)
{
const unsigned int oldsize = BaseType::size();
BaseType::resize(_size);
if(oldsize<_size){
ThisTypeIterator firstnew = BaseType::begin();
advance(firstnew,oldsize);
_updateOVP(firstnew,(*this).end());
}
if (ColorEnabled) CV.resize(_size);
if (MarkEnabled) MV.resize(_size);
if (NormalEnabled) NV.resize(_size);
if (VFAdjacencyEnabled) AV.resize(_size);
if (CurvatureEnabled) CuV.resize(_size);
if (CurvatureDirEnabled) CuDV.resize(_size);
if (RadiusEnabled) RadiusV.resize(_size);
}
void reserve(const unsigned int & _size)
{
BaseType::reserve(_size);
if (ColorEnabled) CV.reserve(_size);
if (MarkEnabled) MV.reserve(_size);
if (NormalEnabled) NV.reserve(_size);
if (VFAdjacencyEnabled) AV.reserve(_size);
if (CurvatureEnabled) CuV.reserve(_size);
if (CurvatureDirEnabled) CuDV.reserve(_size);
if (RadiusEnabled) RadiusV.reserve(_size);
}
void _updateOVP(ThisTypeIterator lbegin, ThisTypeIterator lend)
{
ThisTypeIterator vi;
for(vi=lbegin;vi!=lend;++vi)
(*vi)._ovp=this;
}
// this function is called by the specialized Reorder function, that is called whenever someone call the allocator::CompactVertVector
void ReorderVert(std::vector<size_t> &newVertIndex )
{
size_t i=0;
if (ColorEnabled) assert( CV.size() == newVertIndex.size() );
if (MarkEnabled) assert( MV.size() == newVertIndex.size() );
if (NormalEnabled) assert( NV.size() == newVertIndex.size() );
if (VFAdjacencyEnabled) assert( AV.size() == newVertIndex.size() );
if (CurvatureEnabled) assert(CuV.size() == newVertIndex.size() );
if (CurvatureDirEnabled)assert(CuDV.size() == newVertIndex.size() );
assert( (!RadiusEnabled) || RadiusV.size() == newVertIndex.size() );
for(i=0;i<newVertIndex.size();++i)
{
if(newVertIndex[i] != std::numeric_limits<size_t>::max() )
{
assert(newVertIndex[i] <= i);
if (ColorEnabled) CV[newVertIndex[i]] = CV[i];
if (MarkEnabled) MV[newVertIndex[i]] = MV[i];
if (NormalEnabled) NV[newVertIndex[i]] = NV[i];
if (VFAdjacencyEnabled) AV[newVertIndex[i]] = AV[i];
if (CurvatureEnabled) CuV[newVertIndex[i]] = CuV[i];
if (CurvatureDirEnabled) CuDV[newVertIndex[i]] =CuDV[i];
if (RadiusEnabled) RadiusV[newVertIndex[i]] = RadiusV[i];
}
}
if (ColorEnabled) CV.resize(BaseType::size());
if (MarkEnabled) MV.resize(BaseType::size());
if (NormalEnabled) NV.resize(BaseType::size());
if (VFAdjacencyEnabled) AV.resize(BaseType::size());
if (CurvatureEnabled) CuV.resize(BaseType::size());
if (CurvatureDirEnabled) CuDV.resize(BaseType::size());
if (RadiusEnabled) RadiusV.resize(BaseType::size());
}
////////////////////////////////////////
// Enabling Eunctions
bool IsQualityEnabled() const {return QualityEnabled;}
void EnableQuality() {
assert(VALUE_TYPE::HasQualityOcf());
QualityEnabled=true;
QV.resize((*this).size());
}
void DisableQuality() {
assert(VALUE_TYPE::HasQualityOcf());
QualityEnabled=false;
QV.clear();
}
bool IsColorEnabled() const {return ColorEnabled;}
void EnableColor() {
assert(VALUE_TYPE::HasColorOcf());
ColorEnabled=true;
CV.resize((*this).size());
}
void DisableColor() {
assert(VALUE_TYPE::HasColorOcf());
ColorEnabled=false;
CV.clear();
}
bool IsMarkEnabled() const {return MarkEnabled;}
void EnableMark() {
assert(VALUE_TYPE::HasFaceMarkOcf());
MarkEnabled=true;
MV.resize((*this).size());
}
void DisableMark() {
assert(VALUE_TYPE::HasFaceMarkOcf());
MarkEnabled=false;
MV.clear();
}
bool IsNormalEnabled() const {return NormalEnabled;}
void EnableNormal() {
assert(VALUE_TYPE::HasNormalOcf());
NormalEnabled=true;
NV.resize((*this).size());
}
void DisableNormal() {
assert(VALUE_TYPE::HasNormalOcf());
NormalEnabled=false;
NV.clear();
}
void EnableVFAdjacency() {
assert(VALUE_TYPE::HasVFAdjacencyOcf());
VFAdjacencyEnabled=true;
AV.resize((*this).size());
}
void DisableVFAdjacency() {
assert(VALUE_TYPE::HasVFAdjacencyOcf());
VFAdjacencyEnabled=false;
AV.clear();
}
bool IsCurvatureEnabled() const {return CurvatureEnabled;}
void EnableCurvature() {
assert(VALUE_TYPE::HasCurvatureOcf());
CurvatureEnabled=true;
CuV.resize((*this).size());
}
void DisableCurvature() {
assert(VALUE_TYPE::HasCurvatureOcf());
CurvatureEnabled=false;
CuV.clear();
}
bool IsCurvatureDirEnabled() const {return CurvatureDirEnabled;}
void EnableCurvatureDir() {
assert(VALUE_TYPE::HasCurvatureDirOcf());
CurvatureDirEnabled=true;
CuDV.resize((*this).size());
}
void DisableCurvatureDir() {
assert(VALUE_TYPE::HasCurvatureDirOcf());
CurvatureDirEnabled=false;
CuDV.clear();
}
bool IsRadiusEnabled() const {return RadiusEnabled;}
void EnableRadius() {
assert(VALUE_TYPE::HasRadiusOcf());
RadiusEnabled=true;
RadiusV.resize((*this).size());
}
void DisableRadius() {
assert(VALUE_TYPE::HasRadiusOcf());
RadiusEnabled=false;
RadiusV.clear();
}
struct VFAdjType {
typename VALUE_TYPE::FacePointer _fp ;
int _zp ;
};
public:
std::vector<typename VALUE_TYPE::QualityType> QV;
std::vector<typename VALUE_TYPE::CurvatureType> CuV;
std::vector<typename VALUE_TYPE::CurvatureDirType> CuDV;
std::vector<typename VALUE_TYPE::RadiusType> RadiusV;
std::vector<typename VALUE_TYPE::ColorType> CV;
std::vector<typename VALUE_TYPE::NormalType> NV;
std::vector<struct VFAdjType> AV;
std::vector<int> MV;
bool QualityEnabled;
bool ColorEnabled;
bool NormalEnabled;
bool VFAdjacencyEnabled;
bool CurvatureEnabled;
bool CurvatureDirEnabled;
bool MarkEnabled;
bool RadiusEnabled;
};
//template<> void EnableAttribute<typename VALUE_TYPE::NormalType>(){ NormalEnabled=true;}
/*------------------------- COORD -----------------------------------------*/
/*----------------------------- VFADJ ------------------------------*/
template <class T> class VFAdjOcf: public T {
public:
typename T::FacePointer &VFp() {
assert((*this).Base().VFAdjacencyEnabled);
return (*this).Base().AV[(*this).Index()]._fp;
}
typename T::FacePointer cVFp() const {
if(! (*this).Base().VFAdjacencyEnabled ) return 0;
else return (*this).Base().AV[(*this).Index()]._fp;
}
int &VFi() {
assert((*this).Base().VFAdjacencyEnabled);
return (*this).Base().AV[(*this).Index()]._zp;
}
template <class LeftV>
void ImportLocal(const LeftV & leftV)
{
if((*this).Base().VFAdjacencyEnabled) // init the data only if they are enabled!
{
VFp() = NULL;
VFi() = -1;
}
T::ImportLocal(leftV);
}
static bool HasVFAdjacency() { return true; }
static bool HasVFAdjacencyOcf() {assert(!T::HasVFAdjacencyOcf()); return true; }
private:
};
/*------------------------- Normal -----------------------------------------*/
template <class A, class T> class NormalOcf: public T {
public:
typedef A NormalType;
static bool HasNormal() { return true; }
static bool HasNormalOcf() { return true; }
NormalType &N() {
// you cannot use Normals before enabling them with: yourmesh.vert.EnableNormal()
assert((*this).Base().NormalEnabled);
return (*this).Base().NV[(*this).Index()]; }
const NormalType &N() const {
// you cannot use Normals before enabling them with: yourmesh.vert.EnableNormal()
assert((*this).Base().NormalEnabled);
return (*this).Base().NV[(*this).Index()]; }
template <class LeftV>
void ImportLocal(const LeftV & leftV){
if((*this).Base().NormalEnabled && leftV.Base().NormalEnabled ) // copy the data only if they are enabled in both vertices
N().Import(leftV.cN());
T::ImporLocal(leftV);}
};
template <class T> class Normal3sOcf: public NormalOcf<vcg::Point3s, T> {};
template <class T> class Normal3fOcf: public NormalOcf<vcg::Point3f, T> {};
template <class T> class Normal3dOcf: public NormalOcf<vcg::Point3d, T> {};
///*-------------------------- COLOR ----------------------------------*/
template <class A, class T> class ColorOcf: public T {
public:
typedef A ColorType;
ColorType &C() { assert((*this).Base().NormalEnabled); return (*this).Base().CV[(*this).Index()]; }
const ColorType &cC() const { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
template <class LeftV>
void ImportLocal(const LeftV & leftV)
{
if((*this).Base().ColorEnabled && leftV.Base().ColorEnabled ) // copy the data only if they are enabled in both vertices
C() = leftV.cC();
T::ImporLocal(leftV);
}
static bool HasColor() { return true; }
static bool HasColorOcf() { assert(!T::HasColorOcf()); return true; }
};
template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {};
///*-------------------------- QUALITY ----------------------------------*/
template <class A, class T> class QualityOcf: public T {
public:
typedef A QualityType;
QualityType &Q() { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()]; }
template <class LeftV>
void ImportLocal(const LeftV & leftV)
{
if((*this).Base().QualityEnabled && leftV.Base().QualityEnabled ) // copy the data only if they are enabled in both vertices
Q() = leftV.cQ();
T::ImporLocal(leftV);
}
static bool HasQuality() { return true; }
static bool HasQualityOcf() { assert(!T::HasQualityOcf()); return true; }
};
template <class T> class QualityfOcf: public QualityOcf<float, T> {};
///*-------------------------- MARK ----------------------------------*/
template <class T> class MarkOcf: public T {
public:
inline int & IMark() {
assert((*this).Base().MarkEnabled);
return (*this).Base().MV[(*this).Index()];
}
inline int IMark() const {
assert((*this).Base().MarkEnabled);
return (*this).Base().MV[(*this).Index()];
}
template <class LeftV>
void ImportLocal(const LeftV & leftV)
{
if((*this).Base().MarkEnabled && leftV.Base().MarkEnabled ) // copy the data only if they are enabled in both vertices
IMark() = leftV.IMark();
T::ImportLocal(leftV);
}
static bool HasFaceMark() { return true; }
static bool HasFaceMarkOcf() { return true; }
inline void InitIMark() { IMark() = 0; }
};
///*-------------------------- CURVATURE ----------------------------------*/
template <class A, class TT> class CurvatureOcf: public TT {
public:
typedef Point2<A> CurvatureType;
typedef typename CurvatureType::ScalarType ScalarType;
ScalarType &Kh(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];}
ScalarType &Kg(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];}
const ScalarType &cKh() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];}
const ScalarType &cKg() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];}
template <class LeftV>
void ImportLocal(const LeftV & leftV){
if((*this).Base().CurvatureEnabled && leftV.Base().CurvatureEnabled ) // copy the data only if they are enabled in both vertices
{
(*this).Base().CuV[(*this).Index()][0] = leftV.cKh();
(*this).Base().CuV[(*this).Index()][1] = leftV.cKg();
}
TT::ImportLocal(leftV);
}
static bool HasCurvatureOcf() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureOcf"));TT::Name(name);}
private:
};
template <class T> class CurvaturefOcf: public CurvatureOcf<float, T> {};
template <class T> class CurvaturedOcf: public CurvatureOcf<double, T> {};
///*-------------------------- CURVATURE DIR ----------------------------------*/
template <class S>
struct CurvatureDirTypeOcf{
typedef Point3<S> VecType;
typedef S ScalarType;
CurvatureDirTypeOcf () {}
Point3<S>max_dir,min_dir;
S k1,k2;
};
template <class A, class TT> class CurvatureDirOcf: public TT {
public:
typedef A CurvatureDirType;
typedef typename CurvatureDirType::VecType VecType;
typedef typename CurvatureDirType::ScalarType ScalarType;
VecType &PD1(){ assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].max_dir;}
VecType &PD2(){ assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].min_dir;}
const VecType &cPD1() const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuV[(*this).Index()].max_dir;}
const VecType &cPD2() const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuV[(*this).Index()].min_dir;}
ScalarType &K1(){ assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k1;}
ScalarType &K2(){ assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;}
const ScalarType &cK1() const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k1;}
const ScalarType &cK2()const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;}
static bool HasCurvatureDirOcf() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirOcf"));TT::Name(name);}
private:
};
template <class T> class CurvatureDirfOcf: public CurvatureDirOcf<CurvatureDirTypeOcf<float>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirfOcf"));T::Name(name);}
};
template <class T> class CurvatureDirdOcf: public CurvatureDirOcf<CurvatureDirTypeOcf<double>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirdOcf"));T::Name(name);}
};
///*-------------------------- RADIUS ----------------------------------*/
template <class A, class TT> class RadiusOcf: public TT {
public:
typedef A RadiusType;
typedef RadiusType ScalarType;
RadiusType &R(){ assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
const RadiusType &cR() const { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
template <class LeftV>
void ImportLocal(const LeftV & leftV)
{
if ((*this).Base().RadiusEnabled && leftV.Base().RadiusEnabled )
(*this).Base().RadiusV[(*this).Index()] = leftV.cR();
TT::ImportLocal(leftV);
}
static bool HasRadius() { return true; }
static bool HasRadiusOcf() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("RadiusOcf")); TT::Name(name);}
private:
};
template <class T> class RadiusfOcf: public RadiusOcf<float, T> {};
template <class T> class RadiusdOcf: public RadiusOcf<double, T> {};
///*-------------------------- InfoOpt ----------------------------------*/
template < class T> class InfoOcf: public T {
public:
vector_ocf<typename T::VertType> &Base() const { return *_ovp;}
inline int Index() const {
typename T::VertType const *tp=static_cast<typename T::VertType const*>(this);
int tt2=tp- &*(_ovp->begin());
return tt2;
}
public:
vector_ocf<typename T::VertType> *_ovp;
static bool HasQualityOcf() { return false; }
static bool HasVFAdjacencyOcf() { return false; }
};
} // end namespace vert
namespace tri
{
template < class, class,class > class TriMesh;
template < class VertexType, class FaceContainerType, class EdgeContainerType >
bool HasPerVertexRadius (const TriMesh < vertex::vector_ocf< VertexType > , FaceContainerType, EdgeContainerType > & m)
{
if(VertexType::HasRadiusOcf()) return m.vert.IsRadiusEnabled();
else return VertexType::HasRadius();
}
template < class VertexType, class FaceContainerType, class EdgeContainerType >
bool HasPerVertexQuality (const TriMesh < vertex::vector_ocf< VertexType > , FaceContainerType , EdgeContainerType> & m)
{
if(VertexType::HasQualityOcf()) return m.vert.IsQualityEnabled();
else return VertexType::HasQuality();
}
template < class VertexType, class FaceContainerType, class EdgeContainerType >
bool HasPerVertexCurvature (const TriMesh < vertex::vector_ocf< VertexType > , FaceContainerType, EdgeContainerType > & m)
{
if(VertexType::HasCurvatureOcf()) return m.vert.IsCurvatureEnabled();
else return VertexType::HasCurvature();
}
template < class VertexType, class FaceContainerType, class EdgeContainerType >
bool HasPerVertexCurvatureDir (const TriMesh < vertex::vector_ocf< VertexType > , FaceContainerType, EdgeContainerType > & m)
{
if(VertexType::HasCurvatureDirOcf()) return m.vert.IsCurvatureDirEnabled();
else return VertexType::HasCurvatureDir();
}
template < class VertexType >
void ReorderVert( std::vector<size_t> &newVertIndex, vertex::vector_ocf< VertexType > &vertVec)
{
vertVec.ReorderVert(newVertIndex);
}
}
}// end namespace vcg
#endif

View File

@ -0,0 +1,58 @@
#ifndef COMPONENT_SPH_
#define COMPONENT_SPH_
#include <vcg/math/spherical_harmonics.h>
namespace vcg {
namespace vertex {
template <class A, class T> class Sph: public T
{
public:
typedef A SphType;
SphType &SH() { return _harmonics; }
const SphType &cSH() const { return _harmonics; }
template < class LeftV>
void ImportLocal(const LeftV & left ) { SH() = left.cSH(); T::ImportLocal( left); }
static bool HasSH() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Spherical Harmonics"));T::Name(name);}
private:
SphType _harmonics;
};
template <class T> class Sph9f: public Sph<vcg::math::SphericalHarmonics<float, 3>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Sph9f"));T::Name(name);}
};
template <class T> class Sph16f: public Sph<vcg::math::SphericalHarmonics<float, 4>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Sph16f"));T::Name(name);}
};
template <class T> class Sph25f: public Sph<vcg::math::SphericalHarmonics<float, 5>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Sph25f"));T::Name(name);}
};
template <class T> class Sph36f: public Sph<vcg::math::SphericalHarmonics<float, 6>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Sph36f"));T::Name(name);}
};
template <class T> class Sph9d: public Sph<vcg::math::SphericalHarmonics<double, 3>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Sph9d"));T::Name(name);}
};
template <class T> class Sph16d: public Sph<vcg::math::SphericalHarmonics<double, 4>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Sph16d"));T::Name(name);}
};
template <class T> class Sph25d: public Sph<vcg::math::SphericalHarmonics<double, 5>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Sph25d"));T::Name(name);}
};
template <class T> class Sph36d: public Sph<vcg::math::SphericalHarmonics<double, 6>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Sph36d"));T::Name(name);}
};
}}
#endif /*COMPONENT_H_*/

View File

@ -1,23 +0,0 @@
#ifndef __VCGLIB_VERTEX__AE__TYPE
#define __VCGLIB_VERTEX__AE__TYPE
#define VERTEX_TYPE VertexAE
#define __VCGLIB_VERTEX_AE
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_AE
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAEf : public VertexAE<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAEd : public VertexAE<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,23 +0,0 @@
#ifndef __VCGLIB_VERTEX__AF__TYPE
#define __VCGLIB_VERTEX__AF__TYPE
#define VERTEX_TYPE VertexAF
#define __VCGLIB_VERTEX_AF
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_AF
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFf : public VertexAF<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFd : public VertexAF<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,35 +0,0 @@
#ifndef __VCGLIB_VERTEX__AFATVCVNVQ__TYPE
#define __VCGLIB_VERTEX__AFATVCVNVQ__TYPE
#define VERTEX_TYPE VertexAFATVCVNVQ
#define __VCGLIB_VERTEX_AF
#define __VCGLIB_VERTEX_AT
#define __VCGLIB_VERTEX_VC
#define __VCGLIB_VERTEX_VN
#define __VCGLIB_VERTEX_VQ
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_AF
#undef __VCGLIB_VERTEX_AT
#undef __VCGLIB_VERTEX_VC
#undef __VCGLIB_VERTEX_VN
#undef __VCGLIB_VERTEX_VQ
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFATVCVNVQf : public VertexAFATVCVNVQ<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFATVCVNVQd : public VertexAFATVCVNVQ<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,32 +0,0 @@
#ifndef __VCGLIB_VERTEX__VCVN__TYPE
#define __VCGLIB_VERTEX__VCVN__TYPE
#define VERTEX_TYPE VertexAFVCVMVN
#define __VCGLIB_VERTEX_AF
#define __VCGLIB_VERTEX_VN
#define __VCGLIB_VERTEX_VC
#define __VCGLIB_VERTEX_VM
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_VM
#undef __VCGLIB_VERTEX_AF
#undef __VCGLIB_VERTEX_VN
#undef __VCGLIB_VERTEX_VC
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFVCVMVNf : public VertexAFVCVMVN<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFVCVMVNd : public VertexAFVCVMVN<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,33 +0,0 @@
#ifndef __VCGLIB_VERTEX__AFVCVNVQ__TYPE
#define __VCGLIB_VERTEX__AFVCVNVQ__TYPE
#define VERTEX_TYPE VertexAFVCVNVQ
#define __VCGLIB_VERTEX_AF
#define __VCGLIB_VERTEX_VC
#define __VCGLIB_VERTEX_VN
#define __VCGLIB_VERTEX_VQ
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_AF
#undef __VCGLIB_VERTEX_VC
#undef __VCGLIB_VERTEX_VN
#undef __VCGLIB_VERTEX_VQ
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFVCVNVQf : public VertexAFVCVNVQ<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFVCVNVQd : public VertexAFVCVNVQ<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,29 +0,0 @@
#ifndef __VCGLIB_VERTEX__AFVM__TYPE
#define __VCGLIB_VERTEX__AFVM__TYPE
#define VERTEX_TYPE VertexAFVM
#define __VCGLIB_VERTEX_AF
#define __VCGLIB_VERTEX_VM
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_AF
#undef __VCGLIB_VERTEX_VM
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFVMf : public VertexAFVM<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFVMd : public VertexAFVM<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,28 +0,0 @@
#ifndef __VCGLIB_VERTEX__AF__TYPE
#define __VCGLIB_VERTEX__VM__TYPE
#define __VCGLIB_VERTEX__VN__TYPE
#define VERTEX_TYPE VertexAFVMVN
#define __VCGLIB_VERTEX_AF
#define __VCGLIB_VERTEX_VM
#define __VCGLIB_VERTEX_VN
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX__AF__TYPE
#undef __VCGLIB_VERTEX__VM__TYPE
#undef __VCGLIB_VERTEX__VN__TYPE
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFVMVNf : public VertexAFVMVN<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFVMVNd : public VertexAFVMVN<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,31 +0,0 @@
#ifndef __VCGLIB_VERTEX__AF__TYPE
#define __VCGLIB_VERTEX__VM__TYPE
#define __VCGLIB_VERTEX__VN__TYPE
#define __VCGLIB_VERTEX__VQ__TYPE
#define VERTEX_TYPE VertexAFVMVNVQ
#define __VCGLIB_VERTEX_AF
#define __VCGLIB_VERTEX_VM
#define __VCGLIB_VERTEX_VN
#define __VCGLIB_VERTEX_VQ
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX__AF__TYPE
#undef __VCGLIB_VERTEX__VM__TYPE
#undef __VCGLIB_VERTEX__VN__TYPE
#undef __VCGLIB_VERTEX__VQ__TYPE
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFVMVNVQf : public VertexAFVMVNVQ<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFVMVNVQd : public VertexAFVMVNVQ<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,29 +0,0 @@
#ifndef __VCGLIB_VERTEX__AFVN__TYPE
#define __VCGLIB_VERTEX__AFVN__TYPE
#define VERTEX_TYPE VertexAFVN
#define __VCGLIB_VERTEX_AF
#define __VCGLIB_VERTEX_VN
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_AF
#undef __VCGLIB_VERTEX_VN
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFVNf : public VertexAFVN<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexAFVNd : public VertexAFVN<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,23 +0,0 @@
#ifndef __VCGLIB_VERTEX__AT__TYPE
#define __VCGLIB_VERTEX__AT__TYPE
#define VERTEX_TYPE VertexAT
#define __VCGLIB_VERTEX_AT
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_AT
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexATf : public VertexAT<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexATd : public VertexAT<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,27 +0,0 @@
#ifndef __VCGLIB_VERTEX__ATVMVN__TYPE
#define __VCGLIB_VERTEX__ATVMVN__TYPE
#define VERTEX_TYPE VertexATVMVN
#define __VCGLIB_VERTEX_AT
#define __VCGLIB_VERTEX_VM
#define __VCGLIB_VERTEX_VN
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_AT
#undef __VCGLIB_VERTEX_VM
#undef __VCGLIB_VERTEX_VN
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE,class TCTYPE = TexCoord2<float,1>, class CoordTYPE= Point3<float> >
class VertexATVMVNf : public VertexATVMVN<float,VETYPE,VFTYPE,VTTYPE,TCTYPE,CoordTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexATVMVNd : public VertexATVMVN<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,25 +0,0 @@
#ifndef __VCGLIB_VERTEX__AT__TYPE
#define __VCGLIB_VERTEX__AT__TYPE
#define VERTEX_TYPE VertexATVN
#define __VCGLIB_VERTEX_AT
#define __VCGLIB_VERTEX_VN
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_AT
#undef __VCGLIB_VERTEX_VN
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexATVNf : public VertexATVN<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexATVNd : public VertexATVN<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,27 +0,0 @@
#ifndef __VCGLIB_VERTEX__AT__TYPE
#define __VCGLIB_VERTEX__AT__TYPE
#define VERTEX_TYPE VertexATVN
#define __VCGLIB_VERTEX_AT
#define __VCGLIB_VERTEX_VN
#define __VCGLIB_VERTEX_VM
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_VM
#undef __VCGLIB_VERTEX_AT
#undef __VCGLIB_VERTEX_VN
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexATVNf : public VertexATVN<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexATVNd : public VertexATVN<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,53 +0,0 @@
/****************************************************************************
* 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. *
* *
****************************************************************************/
This folders contains most common VERTEX configuration files.
The name of the file specifies the members that are added to the vertex
class. The name is a sequence of letter pairs, in strict alphabetical order. The
possible admitted letters pairs are:
Adjacency Info
AF - Vertex-Face adjacency
AE - Vertex-Edge adjacency
AT - Vertex-Tetra adjacency
Per-Vertex Data
VC - Color
VN - Normal
VM - Incremental Mark
VQ - Quality
VT - Texture Coords
E.g.
#include<vcg/simplex/vertex/with/afvcvnvq.h>
generate a type
VertexAFVCVQ<VScalarType,FaceType>
That can store V-F adjacency, color, normal and quality.

View File

@ -1,26 +0,0 @@
#ifndef __VCGLIB_VERTEX__VCVN__TYPE
#define __VCGLIB_VERTEX__VCVN__TYPE
#define VERTEX_TYPE VertexVC
#define __VCGLIB_VERTEX_VC
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_VC
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVCf : public VertexVC<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVCd : public VertexVC<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,27 +0,0 @@
#ifndef __VCGLIB_VERTEX__VCVMVNVQ__TYPE
#define __VCGLIB_VERTEX__VCVMVNVQ__TYPE
#define VERTEX_TYPE VertexVCVMVNVQ
#define __VCGLIB_VERTEX_VC
#define __VCGLIB_VERTEX_VM
#define __VCGLIB_VERTEX_VN
#define __VCGLIB_VERTEX_VQ
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_VC
#undef __VCGLIB_VERTEX_VM
#undef __VCGLIB_VERTEX_VN
#undef __VCGLIB_VERTEX_VQ
namespace vcg {
typedef VertexVCVMVNVQ<float> VertexVCVMVNVQf;
typedef VertexVCVMVNVQ<double> VertexVCVMVNVQd;
}
#endif

View File

@ -1,32 +0,0 @@
#ifndef __VCGLIB_VERTEX__VCVMVNVT__TYPE
#define __VCGLIB_VERTEX__VCVMVNVT__TYPE
#define VERTEX_TYPE VertexVCVMVNVT
#define __VCGLIB_VERTEX_VC
#define __VCGLIB_VERTEX_VM
#define __VCGLIB_VERTEX_VN
#define __VCGLIB_VERTEX_VT
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_VC
#undef __VCGLIB_VERTEX_VM
#undef __VCGLIB_VERTEX_VN
#undef __VCGLIB_VERTEX_VT
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVCVMVNVTf : public VertexVCVMVNVT<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVCVMVNVTd : public VertexVCVMVNVT<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif /* __VCGLIB_VERTEX__VCVMVNVT__TYPE */

View File

@ -1,28 +0,0 @@
#ifndef __VCGLIB_VERTEX__VCVN__TYPE
#define __VCGLIB_VERTEX__VCVN__TYPE
#define VERTEX_TYPE VertexVCVN
#define __VCGLIB_VERTEX_VN
#define __VCGLIB_VERTEX_VC
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_VN
#undef __VCGLIB_VERTEX_VC
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVCVNf : public VertexVCVN<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVCVNd : public VertexVCVN<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,25 +0,0 @@
#ifndef __VCGLIB_VERTEX__VCVNVQ__TYPE
#define __VCGLIB_VERTEX__VCVNVQ__TYPE
#define VERTEX_TYPE VertexVCVNVQ
#define __VCGLIB_VERTEX_VC
#define __VCGLIB_VERTEX_VN
#define __VCGLIB_VERTEX_VQ
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_VC
#undef __VCGLIB_VERTEX_VN
#undef __VCGLIB_VERTEX_VQ
namespace vcg {
typedef VertexVCVNVQ<float> VertexVCVNVQf;
typedef VertexVCVNVQ<double> VertexVCVNVQd;
}
#endif

View File

@ -1,23 +0,0 @@
#ifndef __VCGLIB_VERTEX__VCVQ__TYPE
#define __VCGLIB_VERTEX__VCVQ__TYPE
#define VERTEX_TYPE VertexVCVQ
#define __VCGLIB_VERTEX_VC
#define __VCGLIB_VERTEX_VQ
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_VC
#undef __VCGLIB_VERTEX_VQ
namespace vcg {
typedef VertexVCVQ<float> VertexVCVQf;
typedef VertexVCVQ<double> VertexVCVQd;
}
#endif

View File

@ -1,27 +0,0 @@
#ifndef __VCGLIB_VERTEX__VM__TYPE
#define __VCGLIB_VERTEX__VM__TYPE
#define VERTEX_TYPE VertexVM
#define __VCGLIB_VERTEX_VM
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_VM
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVMf : public VertexVM<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVMd : public VertexVM<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,28 +0,0 @@
#ifndef __VCGLIB_VERTEX__VMVN__TYPE
#define __VCGLIB_VERTEX__VMVN__TYPE
#define VERTEX_TYPE VertexVMVN
#define __VCGLIB_VERTEX_VN
#define __VCGLIB_VERTEX_VM
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_VM
#undef __VCGLIB_VERTEX_VN
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVMVNf : public VertexVMVN<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVMVNd : public VertexVMVN<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,30 +0,0 @@
#ifndef __VCGLIB_VERTEX__VMVNVT__TYPE
#define __VCGLIB_VERTEX__VMVNVT__TYPE
#define VERTEX_TYPE VertexVMVNVT
#define __VCGLIB_VERTEX_VM
#define __VCGLIB_VERTEX_VN
#define __VCGLIB_VERTEX_VT
#include <vcg/simplex/vertex/base.h>
#undef __VCGLIB_VERTEX_VM
#undef __VCGLIB_VERTEX_VN
#undef __VCGLIB_VERTEX_VT
#undef VERTEX_TYPE
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVMVNVTf : public VertexVMVNVT<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVMVNVTd : public VertexVMVNVT<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif /* __VCGLIB_VERTEX__VMVNVT__TYPE */

View File

@ -1,25 +0,0 @@
#ifndef __VCGLIB_VERTEX__VN__TYPE
#define __VCGLIB_VERTEX__VN__TYPE
#define VERTEX_TYPE VertexVN
#define __VCGLIB_VERTEX_VN
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_VN
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVNf : public VertexVN<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVNd : public VertexVN<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,23 +0,0 @@
#ifndef __VCGLIB_VERTEX__VNVQ__TYPE
#define __VCGLIB_VERTEX__VNVQ__TYPE
#define VERTEX_TYPE VertexVNVQ
#define __VCGLIB_VERTEX_VN
#define __VCGLIB_VERTEX_VQ
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_VN
#undef __VCGLIB_VERTEX_VQ
namespace vcg {
typedef VertexVNVQ<float> VertexVNVQf;
typedef VertexVNVQ<double> VertexVNVQd;
}
#endif

View File

@ -1,27 +0,0 @@
#ifndef __VCGLIB_VERTEX__VNVT__TYPE
#define __VCGLIB_VERTEX__VNVT__TYPE
#define VERTEX_TYPE VertexVNVT
#define __VCGLIB_VERTEX_VN
#define __VCGLIB_VERTEX_VT
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_VN
#undef __VCGLIB_VERTEX_VT
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVNVTf : public VertexVNVT<float,VETYPE,VFTYPE,VTTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class VertexVNVTd : public VertexVNVT<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif

View File

@ -1,21 +0,0 @@
#ifndef __VCGLIB_VERTEX__VQ__TYPE
#define __VCGLIB_VERTEX__VQ__TYPE
#define VERTEX_TYPE VertexVQ
#define __VCGLIB_VERTEX_VQ
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
#undef __VCGLIB_VERTEX_VQ
namespace vcg {
typedef VertexVQ<float> VertexVQf;
typedef VertexVQ<double> VertexVQd;
}
#endif