Removed old useless files. Why do we kept them?

This commit is contained in:
Paolo Cignoni 2012-10-25 13:01:34 +00:00
parent b50b1e88c3
commit b045c9b992
7 changed files with 0 additions and 3778 deletions

View File

@ -1,874 +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. *
* *
****************************************************************************/
/****************************************************************************
History
$Log: not supported by cvs2svn $
Revision 1.11 2006/10/07 10:02:16 cignoni
Added missing typename for interp.parameters
Revision 1.10 2005/11/30 14:05:04 ponchio
Fixed some UberZ fuynctions and non defined _flags
Revision 1.9 2005/10/14 12:34:55 cignoni
Added ordered constructor that build a edge with unique ordering
among vertices (useful for edge-collapse simplification)
Revision 1.8 2005/10/01 09:22:51 cignoni
Major rewriting of the whole class edge. Removed default flags and nonsense attibutes. Given consistent naming to defines.
Revision 1.7 2005/07/15 15:45:51 ganovelli
template parametere Scalar removed
Revision 1.6 2005/04/14 11:35:09 ponchio
*** empty log message ***
Revision 1.5 2004/10/25 16:25:12 ponchio
inline Set(...) -> inline void Set(...)
Revision 1.4 2004/10/25 08:21:17 ganovelli
added: constructor,Set and some minor changes.
Revision 1.3 2004/05/10 14:40:28 ganovelli
name of adhacency function updated
Revision 1.2 2004/05/10 14:02:29 ganovelli
created
Revision 1.1 2004/04/26 19:04:23 ganovelli
created
****************************************************************************/
#ifndef __VCGLIB__EDGE_TYPE_BASE
#define __VCGLIB__EDGE_TYPE_BASE
#pragma message("[VCGLIB Warning] this way to define the simplex edge is DEPRECATED and no more SUPPORTED")
#pragma message("[VCGLIB Warning] use vcg/simplex/edgeplus instead ")
#include <vcg/space/box3.h>
#include <vcg/space/texcoord2.h>
namespace vcg {
/**
\ingroup segment
@name segment
Class Edge.
This is the base class for definition of a face of the mesh.
@param SVTYPE (Templete Parameter) Specifies the vertex class type.
*/
template <class EDGENAME, class SVTYPE, class TCTYPE = TexCoord2<float,1> > class EDGE_TYPE
{
public:
/// The base type of the segment
typedef EDGE_TYPE BaseEdgeType;
/// The scalar type derived from the vertex
typedef typename SVTYPE::ScalarType ScalarType;
/// The vertex type
typedef SVTYPE VertexType;
/// The type of the the vertex coordinate
typedef Point3< ScalarType > CoordType;
/// The bounding box type
typedef Box3<ScalarType> BoxType;
/// Default Empty Costructor
inline EDGE_TYPE(){}
inline EDGE_TYPE(VertexType* v0,VertexType* v1){v[0]=v0;v[1]=v1;}
static inline EDGE_TYPE OrderedEdge(VertexType* v0,VertexType* v1){
if(v0<v1) return EDGE_TYPE(v0,v1);
else return EDGE_TYPE(v1,v0);
}
/// Costructor
inline void Set(VertexType* v0,VertexType* v1){v[0]=v0;v[1]=v1;}
/***********************************************/
/** @name Vertex Pointer
blah
blah
**/
//@{
protected:
/// Vector of vertex pointer incident in the face
VertexType *v[2];
public:
/** Return the pointer to the j-th vertex of the face.
@param j Index of the face vertex.
*/
inline SVTYPE * & V( const int j )
{
assert( !IsD() );
assert(j >= 0 && j < 2);
return v[j];
}
inline const SVTYPE * const & V( const int j ) const
{
assert( !IsD() );
assert(j>=0 && j<2);
return v[j];
}
inline const SVTYPE * const & cV( const int j ) const
{
assert( !IsD() );
assert(j>=0 && j<2);
return v[j];
}
// Shortcut per accedere ai punti delle facce
inline CoordType & P( const int j )
{
assert( !IsD() );
assert(j>=0 && j<2);
return v[j]->P();
}
inline const CoordType & P( const int j ) const
{
assert( !IsD() );
assert(j>=0 && j<2);
return v[j]->cP();
}
inline const CoordType & cP( const int j ) const
{
assert( !IsD() );
assert(j>=0 && j<2);
return v[j]->cP();
}
/** Return the pointer to the ((j+1)%3)-th vertex of the face.
@param j Index of the face vertex.
*/
inline SVTYPE * & V0( const int j ) { return V(j);}
inline SVTYPE * & V1( const int j ) { return V((j+1)%2);}
inline const SVTYPE * const & V0( const int j ) const { return V(j);}
inline const SVTYPE * const & V1( const int j ) const { return V((j+1)%2);}
inline const SVTYPE * const & cV0( const int j ) const { return cV(j);}
inline const SVTYPE * const & cV1( const int j ) const { return cV((j+1)%2);}
/// Shortcut per accedere ai punti delle facce
inline CoordType & P0( const int j ) { return V(j)->P();}
inline CoordType & P1( const int j ) { return V((j+1)%2)->P();}
inline const CoordType & P0( const int j ) const { return V(j)->P();}
inline const CoordType & P1( const int j ) const { return V((j+1)%2)->P();}
inline const CoordType & cP0( const int j ) const { return cV(j)->P();}
inline const CoordType & cP1( const int j ) const { return cV((j+1)%2)->P();}
inline SVTYPE * & UberV( const int j )
{
assert(j>=0 && j<2);
return v[j];
}
inline const SVTYPE * const & UberV( const int j ) const
{
assert(j>=0 && j<2);
return v[j];
}
//@}
/***********************************************/
/** @name Normal
blah
blah
**/
//@{
#ifdef __VCGLIB_EDGE_EN
/// This vector indicates the normal of the face (defines if FACE_N is defined)
protected:
CoordType _n;
public:
#endif
/// Return the reference of the normal to the face (if __VCGLIB_EDGE_FN is defined).
inline CoordType & N()
{
#ifdef __VCGLIB_EDGE_EN
return _n;
#else
assert(0);
return *(CoordType *)0;
#endif
}
/// Return the reference of the normal to the face (if __VCGLIB_EDGE_FN is defined).
inline const CoordType & N() const
{
#ifdef __VCGLIB_EDGE_EN
return _n;
#else
return *(CoordType *)0;
#endif
}
/// Return the reference of the normal to the face (if __VCGLIB_EDGE_FN is defined).
inline const CoordType cN() const
{
#ifdef __VCGLIB_EDGE_EN
return _n;
#else
return *(CoordType *)0;
#endif
}
//@}
/***********************************************/
/** @name Quality
blah
blah
**/
//@{
#ifdef __VCGLIB_EDGE_EQ
protected:
float _q;
#endif
public:
float & Q()
{
#ifdef __VCGLIB_EDGE_EQ
return _q;
#else
assert(0);
return *(float*)(0);
#endif
}
const float & Q() const
{
#ifdef __VCGLIB_EDGE_EQ
return _q;
#else
assert(0);
return *(float*)(0);
#endif
}
//@}
/***********************************************/
/** @name Colors
blah
blah
**/
//@{
protected:
#ifdef __VCGLIB_EDGE_EC
Color4b _c;
#endif
public:
Color4b & C()
{
#ifdef __VCGLIB_EDGE_EC
return _c;
#else
assert(0);
return *(Color4b*)(0);
#endif
}
const Color4b C() const
{
#ifdef __VCGLIB_EDGE_EC
return _c;
#else
return Color4b(Color4b::White);
#endif
}
//@}
/***********************************************/
/** @name Adjacency
blah
blah
**/
//@{
protected:
#if defined(__VCGLIB_EDGE_AE)
/// Vector of face pointer, it's used to indicate the adjacency relations (defines if FACE_A is defined)
EDGENAME *ee[2]; // edge adiacenti
/// Index of the face in the arrival face
char zs[2];
#endif
#ifdef __VCGLIB_EDGE_AV
///Vettore di puntatori a edge, utilizzato per indicare le adiacenze vertice faccia
EDGENAME *ev[2];
char zv[2];
#endif
public:
/** Return the pointer to the j-th adjacent edge.
@param j Index of the edge.
*/
inline EDGENAME * & EEp( const int j )
{
assert( !IsD() );
assert(j>=0 && j<2);
#if defined(__VCGLIB_EDGE_AE)
return ee[j];
#else
assert(0);
return *(EDGENAME **)(0);;
#endif
}
inline const EDGENAME * const & EEp( const int j ) const
{
assert( !IsD() );
assert(j>=0 && j<2);
#if defined(__VCGLIB_EDGE_AE)
return ee[j];
#else
assert(0);
return (EDGENAME *)0;
#endif
}
inline EDGENAME * & EEp1( const int j ) { return EEp((j+1)%2);}
inline const EDGENAME * const& EEp1( const int j ) const { return EEp((j+1)%2);}
/** Return the pointer to the j-th adjacent face.
@param j Index of the edge.
*/
inline EDGENAME * & UberEEp( const int j )
{
assert(j>=0 && j<2);
#if defined(__VCGLIB_EDGE_AE)
return ee[j];
#else
assert(0); // if you stop here you are probably trying to use FF topology in a face without it
return *(EDGENAME **)(0);
#endif
}
inline const EDGENAME * const & UberEEp( const int j ) const
{
assert(j>=0 && j<2);
#if defined(__VCGLIB_EDGE_AE)
return ee[j];
#else
assert(0); // if you stop here you are probably trying to use FF topology in a face without it
return *(EDGENAME **)(0);
#endif
}
inline EDGENAME * & VEp( const int j )
{
assert( !IsD() );
assert(j>=0 && j<2);
#ifdef __VCGLIB_EDGE_AV
return ev[j];
#else
assert(0); // you are probably trying to use VF topology in a vertex without it
return *(EDGENAME **)(0);
#endif
}
inline const EDGENAME * const & VEp( const int j ) const
{
assert( !IsD() );
assert(j>=0 && j<2);
#ifdef __VCGLIB_EDGE_AV
return ev[j];
#else
assert(0);
return *(EDGENAME **)(0);
#endif
}
/** Return the index that the face have in the j-th adjacent face.
@param j Index of the edge.
*/
inline char & EEi( const int j )
{
assert( !IsD() );
assert(j>=0 && j<2);
#if defined(__VCGLIB_EDGE_AE)
return zs[j];
#else
assert(0);
return *(char *)0; // tanto per farlo compilare...
#endif
}
inline const char & EEi( const int j ) const
{
assert( !IsD() );
assert(j>=0 && j<2);
#if defined(__VCGLIB_EDGE_AE)
return zs[j];
#else
assert(0);
return *(char *)0;
#endif
}
/** Return the index that the face have in the j-th adjacent face.
@param j Index of the edge.
*/
inline char & UberZ( const int j )
{
assert(j>=0 && j<2);
#if defined(__VCGLIB_EDGE_AE)
return zs[j];
#elif defined(__VCGLIB_EDGE_SA)
return zs[j];
#else
assert(0);
static char dummy = 0;
return dummy;
#endif
}
inline const char & UberZ( const int j ) const
{
assert(j>=0 & j<2);
#if defined(__VCGLIB_EDGE_AE)
return zs[j];
#elif defined(__VCGLIB_EDGE_SA)
return zs[j];
#else
assert(0);
static int dummy = 0;
return dummy;
#endif
}
inline char & VEi( const int j )
{
assert( !IsD() );
assert(j>=0 & j<2);
#ifdef __VCGLIB_EDGE_VA
return zv[j];
#elif defined(__VCGLIB_EDGE_SA)
return zs[j];
#else
assert(0);
static char dummy = 0;
return dummy;
#endif
}
inline const char & VEi( const int j ) const
{
assert( !IsD() );
assert(j>=0 & j<2);
#ifdef __VCGLIB_EDGE_VA
return zv[j];
#elif defined(__VCGLIB_EDGE_SA)
return zs[j];
#else
assert(0);
static char dummy = 0;
return dummy;
#endif
}
//@}
/***********************************************/
/** @name Mark
blah
blah
**/
//@{
#ifdef __VCGLIB_EDGE_EM
/// Incremental mark (defines if FACE_I is defined)
int imark;
#endif // Mark
inline int & IMark()
{
#ifdef __VCGLIB_EDGE_EM
assert( !IsD() );
assert( (_flags & NOTREAD) == 0 );
assert( (_flags & NOTWRITE) == 0 );
return imark;
#else
return 0;
#endif // Mark
}
inline const int & IMark() const
{
assert( !IsD() );
#ifdef __VCGLIB_EDGE_EM
assert( (_flags & NOTREAD) == 0 );
return imark;
#else
static int dummy = 0;
return dummy;
#endif
}
/// Initialize the imark system of the face
inline void InitIMark()
{
#ifdef __VCGLIB_EDGE_EM
imark = 0;
#endif
}
//@}
/***********************************************/
/** @name Flags
blah
blah
**/
//@{
/// This are the _flags of face, the default value is 0
#ifdef __VCGLIB_EDGE_EF
int _flags;
#endif
enum {
// This bit indicate that the face is deleted from the mesh
DELETED = 0x00000001, // cancellato
// This bit indicate that the face of the mesh is not readable
NOTREAD = 0x00000002, // non leggibile (ma forse modificabile)
// This bit indicate that the face is not modifiable
NOTWRITE = 0x00000004, // non modificabile (ma forse leggibile)
// This bit indicate that the face is modified
SELECTED = 0x00000020, // Selection _flags
// Border _flags, it is assumed that BORDERi = BORDER0<<i
BORDER0 = 0x00000040,
BORDER1 = 0x00000080,
// First user bit
USER0 = 0x00040000
};
public:
static int &LastBitFlag()
{
static int b =USER0;
return b;
}
static inline int NewBitFlag()
{
LastBitFlag()=LastBitFlag()<<1;
return LastBitFlag();
}
static inline bool DeleteBitFlag(int bitval)
{
if(LastBitFlag()==bitval) {
LastBitFlag()= LastBitFlag()>>1;
return true;
}
assert(0);
return false;
}
void ClearFlags() {
#ifdef __VCGLIB_EDGE_EF
_flags=0;
#endif
}
/// Return the _flags.
inline int & Flags ()
{
#ifdef __VCGLIB_EDGE_EF
assert( !IsD() );
return _flags;
#else
return *(int *)0;
#endif
}
inline const int & Flags () const
{
#ifdef __VCGLIB_EDGE_EF
assert( !IsD() );
return _flags;
#else
return 0;
#endif
}
/// Ritorna il _flags senza effettuare alcun controllo sui relativi bit
inline int & UberFlags()
{
#ifdef __VCGLIB_EDGE_EF
return _flags;
#else
assert(0);
return *(int *)0;
#endif
}
inline const int UberFlags() const
{
#ifdef __VCGLIB_EDGE_EF
return _flags;
#else
return 0;
#endif
}
/// This function checks if the face is deleted
bool IsD() const {
#ifdef __VCGLIB_EDGE_EF
return (_flags & DELETED) != 0;
#else
return false;
#endif
}
/// This function mark the face as deleted
void SetD() {
#ifdef __VCGLIB_EDGE_EF
_flags |=DELETED;
#endif
}
/// This function mark the face as not deleted
void ClearD() {
#ifdef __VCGLIB_EDGE_EF
_flags &= (~DELETED);
#endif
}
/// This function checks if the face is selected
bool IsS() const {
#ifdef __VCGLIB_EDGE_EF
return (_flags & SELECTED) != 0;
#else
return false;
#endif
}
/// This function select the face
void SetS() {
#ifdef __VCGLIB_EDGE_EF
_flags |=SELECTED;
#endif
}
/// This funcion execute the inverse operation of SetS()
void ClearS() {
#ifdef __VCGLIB_EDGE_EF
_flags &= (~SELECTED);
#endif
}
/// This function checks if the edge is Border on a given side
bool IsB(int i) const {
#ifdef __VCGLIB_EDGE_EF
return (_flags & (BORDER0<<i)) != 0;
#else
return false;
#endif
}
/// This function set edge as Border on a given side
void SetB(int i) {
#ifdef __VCGLIB_EDGE_EF
_flags |=(BORDER0<<i);
#endif
}
/// This function clear edge as Border on a given side
void ClearB(int i) {
#ifdef __VCGLIB_EDGE_EF
_flags &= (~(BORDER0<<i));
#endif
}
/// This function checks if the given user bit is true
bool IsUserBit(int userBit){
#ifdef __VCGLIB_EDGE_EF
return (_flags & userBit) != 0;
#else
return false;
#endif
}
/// This function set the given user bit
void SetUserBit(int userBit){
#ifdef __VCGLIB_EDGE_EF
_flags |=userBit;
#endif
}
/// This function clear the given user bit
void ClearUserBit(int userBit){
#ifdef __VCGLIB_EDGE_EF
_flags &= (~userBit);
#endif
}
//@}
/*#*******************
* Bounding box *
**********************/
void GetBBox( BoxType & bb )
{
bb.Set( v[0]->P() );
bb.Add( v[1]->P() );
}
/***********************************************/
/** @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 HasEdgeNormal() {
#ifdef __VCGLIB_EDGE_FN
return true;
#else
return false;
#endif
}
static bool HasEdgeQuality() {
#ifdef __VCGLIB_EDGE_FQ
return true;
#else
return false;
#endif
}
static bool HasEdgeColor() {
#ifdef __VCGLIB_EDGE_FC
return true;
#else
return false;
#endif
}
static bool HasEEAdjacency() {
#if (defined(__VCGLIB_EDGE_AE) )
return true;
#else
return false;
#endif
}
static bool HasVEAdjacency() {
#if (defined(__VCGLIB_EDGE_AV) )
return true;
#else
return false;
#endif
}
static bool HasEdgeMark() {
#ifdef __VCGLIB_EDGE_FC
return true;
#else
return false;
#endif
}
//@}
/// operator to compare two edges
inline bool operator == ( const EDGENAME & f ) const {
if( (V(0) != f.V(0)) && (V(0) != f.V(1)) ) return false;
if( (V(1) != f.V(0)) && (V(1) != f.V(1)) ) return false;
return true;
}
/** Calcola i coefficienti della combinazione convessa.
@param bq Punto appartenente alla faccia
@param a Valore di ritorno per il vertice V(0)
@param b Valore di ritorno per il vertice V(1)
@param _c Valore di ritorno per il vertice V(2)
@return true se bq appartiene alla faccia, false altrimenti
*/
bool InterpolationParameters(const CoordType & bq, typename VertexType::ScalarType &a, ScalarType &_b) const
{
typedef typename VertexType::ScalarType ScalarType;
const ScalarType EPSILON = ScalarType(0.000001);
ScalarType l;
#define x1 (cV(0)->P().x())
#define y1 (cV(0)->P().y())
#define z1 (cV(0)->P().z())
#define x2 (cV(1)->P().x())
#define y2 (cV(1)->P().y())
#define z2 (cV(1)->P().z())
#define px (bq.x())
#define py (bq.y())
#define pz (bq.z())
a = (px-x1)/(x2-x1);
l = (py-y1)/(y2-y1);
if( ( l < a -EPSILON) || ( l > a +EPSILON))
return false;
l = (pz-z1)/(z2-z1);
if( ( l < a -EPSILON) || ( l > a +EPSILON))
return false;
_b = 1-a;
return true;
#undef x1
#undef y1
#undef z1
#undef x2
#undef y2
#undef z2
#undef px
#undef py
#undef pz
}
/// Return the DOUBLE of the area of the face
ScalarType Length() const
{
return Norm( (V(1)->P() - V(0)->P()).Norm());
}
CoordType Barycenter() const
{
return (V(0)->P()+V(1)->P())/ScalarType(2.0);
}
}; //end Class
} // end namespace
#endif

View File

@ -1,10 +0,0 @@
#ifndef __VCGLIB_EDGE_TYPE
#define __VCGLIB_EDGE_TYPE
#define EDGE_TYPE Edge
#include <vcg/simplex/edge/base.h>
#undef EDGE_TYPE
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +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. *
* *
****************************************************************************/
/****************************************************************************
History
$Log: not supported by cvs2svn $
Revision 1.2 2004/07/15 11:31:06 ganovelli
overwritten previous version (it was a copy of base.h)
First commit...
****************************************************************************/
#ifndef __VCGLIB__BASICFACETYPE
#define __VCGLIB__BASICFACETYPE
#define FACE_TYPE Face
#include <vcg/simplex/face/base.h>
#undef FACE_TYPE
#endif

View File

@ -1,544 +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. *
* *
****************************************************************************/
/****************************************************************************
History
$Log: not supported by cvs2svn $
Revision 1.15 2006/07/06 12:46:19 ganovelli
added GeometicType e SmallestEnclosingSphere
Revision 1.14 2005/12/12 11:10:36 ganovelli
modifications to compile with gcc
Revision 1.13 2004/10/04 17:07:58 pietroni
changed Q() function
Revision 1.12 2004/09/01 12:18:39 pietroni
minor changes to comply gcc compiler (typename's )
Revision 1.11 2004/08/26 13:15:23 pietroni
added IsS() function
Revision 1.10 2004/07/09 10:13:00 ganovelli
C() ,Q() ,hastetracolor(),hasqualityt()....
plus some misuse of tetra3 corrected
Revision 1.9 2004/07/08 08:43:22 pietroni
changed functions used to compute the aspect ratio
Revision 1.8 2004/05/20 13:04:23 pietroni
modified setBorderV function
Revision 1.7 2004/05/14 11:48:43 pietroni
templated with also tetratype...
Revision 1.6 2004/05/14 11:07:36 turini
Changed swap in std::swap.
Revision 1.5 2004/05/06 15:29:42 pietroni
changed names to topology functions
Revision 1.4 2004/04/28 11:37:14 pietroni
*** empty log message ***
Revision 1.3 2004/04/26 09:38:54 pietroni
*** empty log message ***
Revision 1.2 2004/04/20 12:42:37 pietroni
*** empty log message ***
Revision 1.1 2004/04/15 08:54:20 pietroni
*** empty log message ***
****************************************************************************/
#ifndef TETRA_TYPE
#pragma message("\nYou should never directly include this file\_n")
#else
#include<vcg/space/point3.h>
#include<vcg/space/tetra3.h>
#include<vcg/space/sphere3.h>
namespace vcg {
/**
\ingroup tetrahedron
@name Tetrahedron
Class Tetrahedron.
This is the base class for definition of a Tetrahedron of the mesh.
@param VTYPE (Template Parameter) Specifies the type for the vertex.
*/
template < class VTYPE, class TTYPE >
class TETRA_TYPE{
public:
/// The base type of the face
typedef TETRA_TYPE BaseTetraType;
/// The vertex type
typedef VTYPE VertexType;
/// The coordinate type used to represent the point (i.e. Point3f, Point3d, ...)
typedef typename VertexType::CoordType CoordType;
/// The scalar type used to represent coords (i.e. float, double, ...)
typedef typename VertexType::ScalarType ScalarType;
/// The geometric type of the tetrahedron
typedef Tetra3<ScalarType> GeometricType;
/***********************************************/
/** @name Tetrahedron Flags
For each Tetrahedron 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::TetrahedronFull::NewUserBit() and vcg::TetrahedronFull::DeleteUserBit() functions.
The value returned by these functions has to be passed to the
vcg::TetrahedronFull::SetUserBit() vcg::TetrahedronFull::ClearUserBit() and vcg::TetrahedronFull::IsUserBit() functions to check and modify the obtained bit flag.
**/
//@{
/// This are the flags of tetrahedron, the default value is 0
int _flags;
enum {
DELETED = 0x00000001, // deleted tetrahedron flag
SELECTED = 0x00000002, // Selection flag
BORDERF0 = 0x00000004, // Border flag, Face 0
BORDERF1 = 0x00000008, // Border flag, Face 1
BORDERF2 = 0x00000010, // Border flag, Face 2
BORDERF3 = 0x00000020, // Border flag, Face 3
BORDERE0 = 0x00000040, // Border flag, Edge 0
BORDERE1 = 0x00000080, // Border flag, Edge 1
BORDERE2 = 0x00000100, // Border flag, Edge 2
BORDERE3 = 0x00000200, // Border flag, Edge 3
BORDERE4 = 0x00000400, // Border flag, Edge 4
BORDERE5 = 0x00000800, // Border flag, Edge 5
USER0 = 0x00001000, // new flag for user
};
public:
/// Return the vector of _flags
inline int & Flags ()
{
assert( (_flags & DELETED) == 0 );
return _flags;
}
static int &LastBitFlag()
{
static int b =USER0;
return b;
}
static inline int NewBitFlag()
{
LastBitFlag()=LastBitFlag()<<1;
return LastBitFlag();
}
static inline bool DeleteBitFlag(int bitval)
{
if(LastBitFlag()==bitval) {
LastBitFlag()= LastBitFlag()>>1;
return true;
}
assert(0);
return false;
}
/// Get the flags without any control
inline int & UberFlags()
{
return _flags;
}
/// 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);}
/// This function checks if the tetrahedron is deleted.
bool IsD() const {return (_flags & DELETED) != 0;}
/// This function mark the tetrahedron as deleted.
void SetD() {_flags |=DELETED;}
/// This function mark the tetrahedron as not deleted.
void ClearD() {_flags &=~DELETED;}
/// This answer true if a tetrahedron is selected
bool IsS() const {return (_flags & SELECTED) != 0;}
/// This function mark the tetrahedron as selected.
void SetS() {_flags |=SELECTED;}
/// This function mark the tetrahedron as not selected.
void ClearS() {_flags &=~SELECTED;}
/// This function return true if one face is extern.
bool HaveBorderF() {return ((_flags & (BORDERF0 | BORDERF1 | BORDERF2 | BORDERF3)) != 0);}
/// This function return true if the face is extern.
bool IsBorderF(int face) {
assert ((face<4)&&(face>-1));
return (this->TTp(face) == this);
}
//@}
/***********************************************/
/** @name Vertex Pointers
For each Tetrahedron we store 4 pointers to vertex
**/
//@{
/// The 4 vertices of the tetrahedron
protected:
VertexType *_v[4];
public:
/** Return the pointer to the j-th vertex of the terahedron.
@param j Index of the tetrahedron's vertex.
*/
inline VertexType * & V( const int j )
{
assert( (_flags & DELETED) == 0 );
assert(j >= 0);
assert(j < 4);
return _v[j];
}
inline const VertexType * const & V( const int j ) const
{
assert( (_flags & DELETED) == 0 );
assert(j>=0);
assert(j<4);
return _v[j];
}
inline const VertexType * const & cV( const int j ) const
{
assert( (_flags & DELETED) == 0 );
assert(j>=0);
assert(j<4);
return _v[j];
}
inline CoordType & P( const int j ) { return V(j)->P();}
inline const CoordType & cP( const int j ) const { return V(j)->cP();}
/***********************************************/
/** @name Topology Structures
For each Tetrahedron we store 2 array for Tatrahedron - Tetrahedron topology ( sharing Face)
and 2 array to implement the list of Vertex - Tetrahedron Topology (List of Tetrahedron sharing a vertex).
**/
//@{
#ifdef __VCGLIB_TETRA_AT
protected:
///pointers to tetrahedron for tetrahedron-tetrahedron topology (sharing same face)
TTYPE *_ttp[4];
///index of face for tetrahedron-tetrahedron topology (sharing same face)
int _tti[4];
public:
///Function to access the Tetrahedron that share the index-face (extern face returns a pointer to himself)
TTYPE *&TTp(const int &index)
{
return _ttp[index];
}
///Function to see the index of the face as seen from the other tetrahedron (extern face returns -1)
int &TTi(const int &index)
{
return _tti[index];
}
#endif
#ifdef __VCGLIB_TETRA_AV
protected:
///pointers to tetrahedron for vertex-tetrahedron topology (sharing same vertex)
TTYPE *_tvp[4];
///index of vertex for vertex-tetrahedron topology (sharing same vertex)
short int _tvi[4];
public:
///Function to access the Next Tetrahedron of the list that share the index-face (end of list is Null)
TTYPE *&TVp(const int &index)
{
return _tvp[index];
}
///Function to see the index of the Vertex as seen from the next tetrahedron of the list ( end of list is -1)
short int &TVi(const int &index)
{
return _tvi[index];
}
#endif
//@}
/***********************************************/
/** @Default Tatrahedron Functions**/
//@{
public:
///Constructor
TETRA_TYPE()
{
_flags=0;
}
///initialize default parameters of tetrahedron
virtual void Init(VertexType * p0,VertexType * p1,VertexType * p2,VertexType * p3)
{
_flags = 0;
_v[0]=p0;
_v[1]=p1;
_v[2]=p2;
_v[3]=p3;
if(vcg::ComputeVolume(*this)<0 )
std::swap(_v[1],_v[2]);
#ifdef __VCGLIB_TETRA_TA
_z[0]=_z[1]=_z[2]=_z[3]=-1;
_t[0]=_t[1]=_t[2]=_t[3]=NULL;
#endif
#ifdef __VCGLIB_TETRA_TV
_zv[0]=_zv[1]=_zv[2]=_zv[3]=-1;
_tv[0]=_tv[1]=_tv[2]=_tv[3]=NULL;
#endif
#ifdef __VCGLIB_TETRA_TQ
ComputeAspectRatio();
#endif
}
///set border vertices using TT-topology
#ifdef __VCGLIB_TETRA_AT
void setBorderV()
{
int i;
for (i=0;i<4;i++)
if (TTp(i)==this)
{
V(Tetra::VofF(i,0))->SetB();
V(Tetra::VofF(i,1))->SetB();
V(Tetra::VofF(i,2))->SetB();
}
}
#endif
//@}
/***********************************************/
/** @Generic geometric and quality funtions of a tetrahedron**/
//@{
#ifdef __VCGLIB_TETRA_TN
private:
CoordType _n[4];
public:
#endif
///return the normal of a face of the tetrahedron
CoordType N(const int &i){
assert((i>=0)&&(i<4));
#ifdef __VCGLIB_TETRA_TN
return _n[i];
#else
/* Tetra3<ScalarType> T=Tetra3<ScalarType>();
T.P0(0)=V(0)->P();
T.P1(0)=V(1)->P();
T.P2(0)=V(2)->P();
T.P3(0)=V(3)->P();*/
return (Normal(*this,i));
#endif
}
/// Calculate the normal to all the faces of a tetrahedron, the value is store in a position of vecton _n for each face
void ComputeNormal()
{
#ifdef __VCGLIB_TETRA_TN
Tetra3<ScalarType> T=Tetra3<ScalarType>();
T.P0(0)=V(0)->P();
T.P1(0)=V(1)->P();
T.P2(0)=V(2)->P();
T.P3(0)=V(3)->P();
for (int i=0;i<4;i++)
_n[i]=(Normal<Tetra3<ScalarType> >(T,i));
#else
assert(0);
#endif
}
//@}
/***********************************************/
/** @Generic geometric and quality funtions of a tetrahedron**/
//@{
#ifdef __VCGLIB_TETRA_TQ
ScalarType _volume;
ScalarType _aspect_ratio;
ScalarType _q;
#endif
ScalarType & Q(){
#ifdef __VCGLIB_TETRA_TQ
return _q;
#else
assert(0);
return *(ScalarType*)(&_flags);
#endif
}
const ScalarType & Q()const{
#ifdef __VCGLIB_TETRA_TQ
return _q;
#else
assert(0);
return *(ScalarType*)(&_flags);
#endif
}
ScalarType ComputeVolume(){
#ifdef __VCGLIB_TETRA_TQ
_volume = vcg::ComputeVolume<BaseTetraType>(*this);
return _volume;
#else
return vcg::ComputeVolume<BaseTetraType>(*this);
#endif
}
///return the volume of the tetrahedron
const ScalarType & Volume(){
#ifdef __VCGLIB_TETRA_TQ
return _volume;
#else
return (( V(2)->cP()-V(0)->cP())^(V(1)->cP()-V(0)->cP() ))*(V(3)->cP()-V(0)->cP())/6.0;
#endif
}
///return aspect ratio of the tetrahedron
ScalarType AspectRatio(){
#ifdef __VCGLIB_TETRA_TQ
return _aspect_ratio;
#else
return ComputeAspectRatio();
#endif
}
///set if exist local value of aspect ratio
ScalarType ComputeAspectRatio(){
//Tetra3<ScalarType> T=Tetra3<ScalarType>();
//T.P0(0)=V(0)->cP();
//T.P1(0)=V(1)->cP();
//T.P2(0)=V(2)->cP();
//T.P3(0)=V(3)->cP();
#ifdef __VCGLIB_TETRA_TQ
_aspect_ratio= ( (Tetra3<ScalarType>* ) this) -> ComputeAspectRatio();
return(_aspect_ratio);
#else
return (( (Tetra3<ScalarType> *) this) -> ComputeAspectRatio());
#endif
}
CoordType Barycenter() const
{
return (V(0)->cP()+V(1)->cP()+V(2)->cP()+V(3)->cP())/ScalarType(4.0);
}
Sphere3<ScalarType> SmallestEnclosingSphere()const
{
return SmallestEnclosing::SphereOfTetra(*this);
}
//@}
/***********************************************/
/** @name Color
**/
//@{
#ifdef __VCGLIB_TETRA_TC
Color4b c;
#endif
Color4b & C(){
#ifdef __VCGLIB_TETRA_TC
return _c;
#else
assert(0);
return (*new Color4b());
#endif
}
//@}
/***********************************************/
/** @name Reflection Functions
Static functions that give information about the current tetra 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 supported by the current tetra type.
**/
//@{
static bool HasTetraNormal() {
#ifdef __VCGLIB_TETRA_TN
return true;
#else
return false;
#endif
}
static bool HasTetraMark() {
#ifdef __VCGLIB_TETRA_TM
return true;
#else
return false;
#endif
}
static bool HasTetraQuality() {
#ifdef __VCGLIB_TETRA_TQ
return true;
#else
return false;
#endif
}
static bool HasTetraColor() {
#ifdef __VCGLIB_TETRA_TC
return true;
#else
return false;
#endif
}
static bool HasTTAdjacency() {
#if (defined(__VCGLIB_TETRA_AT) || defined(__VCGLIB_TETRA_SAT))
return true;
#else
return false;
#endif
}
static bool HasVTAdjacency() {
#if (defined(__VCGLIB_TETRA_AV) || defined(__VCGLIB_TETRA_SAT))
return true;
#else
return false;
#endif
}
//@}
};//end class
}//end namespace
#endif

View File

@ -1,985 +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. *
* *
****************************************************************************/
/****************************************************************************
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

@ -1,22 +0,0 @@
#ifndef __VCGLIB_VERTEX__BASE__TYPE
#define __VCGLIB_VERTEX__BASE__TYPE
#define VERTEX_TYPE Vertex
#include <vcg/simplex/vertex/base.h>
#undef VERTEX_TYPE
namespace vcg {
template < class VETYPE, class VFTYPE, class VTTYPE,class TCTYPE = TexCoord2<float,1>, class CoordTYPE= Point3<float> >
class Vertexf : public Vertex<float,VETYPE,VFTYPE,VTTYPE, TCTYPE , CoordTYPE> {};
template < class VETYPE, class VFTYPE, class VTTYPE>
class Vertexd : public Vertex<double,VETYPE,VFTYPE,VTTYPE> {};
}
#endif