2004-02-13 01:44:53 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* VCGLib o o *
|
|
|
|
* Visual and Computer Graphics Library o o *
|
|
|
|
* _ O _ *
|
|
|
|
* Copyright(C) 2004 \/)\/ *
|
|
|
|
* Visual Computing Lab /\/| *
|
|
|
|
* ISTI - Italian National Research Council | *
|
|
|
|
* \ *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
|
|
|
* for more details. *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
|
|
History
|
|
|
|
|
|
|
|
$Log: not supported by cvs2svn $
|
2005-03-18 17:35:53 +01:00
|
|
|
Revision 1.26 2005/03/11 14:14:14 ganovelli
|
|
|
|
_ffi was a 4 for positions vector (only 3 used)
|
|
|
|
|
2005-03-11 15:14:14 +01:00
|
|
|
Revision 1.25 2005/01/28 17:53:13 pietroni
|
|
|
|
added HasEdgePlane function
|
|
|
|
|
2005-01-28 18:53:13 +01:00
|
|
|
Revision 1.24 2004/10/28 00:50:48 cignoni
|
|
|
|
Better Doxygen documentation
|
|
|
|
|
2004-10-28 02:56:44 +02:00
|
|
|
Revision 1.23 2004/10/25 08:22:40 ganovelli
|
|
|
|
IsBOrder (typecast on return type)
|
|
|
|
|
2004-10-25 10:22:40 +02:00
|
|
|
Revision 1.22 2004/10/20 08:28:31 fiorin
|
|
|
|
Added constant access function FFp and renamed F1 F2 to FFp1 FFp2
|
|
|
|
|
2004-10-20 10:28:31 +02:00
|
|
|
Revision 1.21 2004/10/18 17:13:50 ganovelli
|
|
|
|
added ::IsBorder
|
|
|
|
|
2004-10-18 19:13:50 +02:00
|
|
|
Revision 1.20 2004/09/15 11:20:15 ganovelli
|
|
|
|
changed P() to cP()
|
|
|
|
|
2004-09-15 13:20:15 +02:00
|
|
|
Revision 1.19 2004/09/14 19:47:02 ganovelli
|
|
|
|
removed "&" in FFp
|
|
|
|
|
2004-09-14 21:47:02 +02:00
|
|
|
Revision 1.18 2004/08/25 15:15:27 ganovelli
|
|
|
|
minor changes to comply gcc compiler (typename's and stuff)
|
|
|
|
|
2004-08-25 17:15:27 +02:00
|
|
|
Revision 1.17 2004/07/15 12:03:07 ganovelli
|
|
|
|
minor changes
|
|
|
|
|
2004-07-15 14:04:14 +02:00
|
|
|
Revision 1.16 2004/07/15 11:31:59 ganovelli
|
|
|
|
minor changes
|
|
|
|
|
2004-07-15 13:31:59 +02:00
|
|
|
Revision 1.15 2004/07/12 12:17:09 pietroni
|
|
|
|
added function NormalizedNormal
|
|
|
|
|
2004-07-12 14:17:09 +02:00
|
|
|
Revision 1.14 2004/05/13 11:01:06 turini
|
|
|
|
Changed ComputeMormalizedNormal() using Triangle3
|
|
|
|
|
2004-05-13 13:01:06 +02:00
|
|
|
Revision 1.13 2004/05/12 18:49:05 ganovelli
|
|
|
|
dist and coputeRT removed (see distance.h and updateEdges)
|
|
|
|
|
2004-05-12 20:49:05 +02:00
|
|
|
Revision 1.12 2004/05/12 14:43:36 cignoni
|
|
|
|
removed warning of unused variables
|
|
|
|
|
2004-05-12 16:43:36 +02:00
|
|
|
Revision 1.11 2004/05/12 12:50:20 turini
|
|
|
|
include color4
|
|
|
|
|
2004-05-12 14:50:20 +02:00
|
|
|
Revision 1.10 2004/05/10 14:01:09 ganovelli
|
|
|
|
assert(i*0) for using "i" and preventing the compiler warning for unreferenced variable
|
|
|
|
|
2004-05-10 16:01:09 +02:00
|
|
|
Revision 1.9 2004/05/10 13:19:38 cignoni
|
|
|
|
Added mandatory template params for edge and face class names to the face class
|
|
|
|
Changed type of return face pointer to the one passed by templ params
|
|
|
|
Changed name of func FV to VF (it stores Vertex-Face Topology)
|
|
|
|
|
2004-05-10 15:19:38 +02:00
|
|
|
Revision 1.8 2004/05/06 09:06:59 pietroni
|
|
|
|
changed names to topology functions
|
|
|
|
|
2004-05-06 11:06:59 +02:00
|
|
|
Revision 1.7 2004/05/04 02:46:23 ganovelli
|
|
|
|
added function Dist
|
|
|
|
|
2004-04-27 16:15:23 +02:00
|
|
|
Revision 1.5 2004/04/05 11:51:22 cignoni
|
|
|
|
wrong define FACE_N instead of FACE_FN
|
|
|
|
|
2004-04-05 13:51:22 +02:00
|
|
|
Revision 1.4 2004/03/29 08:37:09 cignoni
|
|
|
|
missing include
|
|
|
|
|
2004-03-29 10:37:09 +02:00
|
|
|
Revision 1.3 2004/03/10 00:52:38 cignoni
|
|
|
|
Moved geometric stuff to the space/triangle class
|
|
|
|
|
2004-03-10 01:52:38 +01:00
|
|
|
Revision 1.2 2004/03/03 16:08:38 cignoni
|
|
|
|
First working version
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
Revision 1.1 2004/02/13 00:44:45 cignoni
|
|
|
|
First commit...
|
2004-02-13 01:44:53 +01:00
|
|
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef FACE_TYPE
|
2004-03-03 17:08:38 +01:00
|
|
|
#pragma error message("\nYou should never directly include this file\_n")
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
|
|
|
|
2004-05-04 04:46:23 +02:00
|
|
|
#include <vcg/math/base.h>
|
2004-03-03 17:08:38 +01:00
|
|
|
#include <vcg/space/box3.h>
|
2004-03-29 10:37:09 +02:00
|
|
|
#include <vcg/space/tcoord2.h>
|
2004-03-10 01:52:38 +01:00
|
|
|
#include <vcg/space/triangle3.h>
|
2004-05-12 14:50:20 +02:00
|
|
|
#include <vcg/space/color4.h>
|
2004-05-04 04:46:23 +02:00
|
|
|
#include <vcg/space/plane3.h>
|
2004-03-10 01:52:38 +01:00
|
|
|
#include <vcg/simplex/face/topology.h>
|
2004-02-13 01:44:53 +01:00
|
|
|
|
|
|
|
namespace vcg {
|
2004-05-10 15:19:38 +02:00
|
|
|
class DUMMYEDGETYPE;
|
|
|
|
class DUMMYFACETYPE;
|
|
|
|
class DUMMYTETRATYPE;
|
2004-02-13 01:44:53 +01:00
|
|
|
|
2004-10-28 02:56:44 +02:00
|
|
|
/** \addtogroup face */
|
|
|
|
//@{
|
|
|
|
/*!
|
|
|
|
* This class represent the generic configurable Face;
|
|
|
|
* 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/face/with/FCFN.h' allow you to use the class FaceFCFN that has per-face color and normal stored inside.
|
2004-02-13 01:44:53 +01:00
|
|
|
*/
|
2004-05-10 15:19:38 +02:00
|
|
|
template <class FVTYPE, class FETYPE, class FFTYPE, class TCTYPE = TCoord2<float,1> > class FACE_TYPE
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// The base type of the face
|
2004-03-03 17:08:38 +01:00
|
|
|
typedef FACE_TYPE BaseFaceType;
|
2004-07-15 13:31:59 +02:00
|
|
|
/// The base type of the face itself
|
2004-07-15 14:04:14 +02:00
|
|
|
typedef FFTYPE FaceType;
|
2004-02-13 01:44:53 +01:00
|
|
|
/// The vertex type
|
2004-03-03 17:08:38 +01:00
|
|
|
typedef FVTYPE VertexType;
|
2004-10-25 10:22:40 +02:00
|
|
|
/// The vertex type
|
|
|
|
typedef FETYPE EdgeType;
|
2004-03-03 17:08:38 +01:00
|
|
|
/// The type of the scalar field of the vertex coordinate
|
|
|
|
typedef typename VertexType::ScalarType ScalarType;
|
|
|
|
/// The type of the the vertex coordinate
|
|
|
|
typedef Point3< ScalarType > CoordType;
|
2004-03-10 01:52:38 +01:00
|
|
|
typedef Point3< ScalarType > NormalType;
|
2004-03-03 17:08:38 +01:00
|
|
|
|
|
|
|
typedef typename FVTYPE::FaceType FaceFromVertType;
|
2004-02-13 01:44:53 +01:00
|
|
|
/// The bounding box type
|
2004-03-03 17:08:38 +01:00
|
|
|
typedef Box3<ScalarType> BoxType;
|
|
|
|
|
2004-03-10 01:52:38 +01:00
|
|
|
/// Default Empty Costructor
|
|
|
|
inline FACE_TYPE(){}
|
2004-02-13 01:44:53 +01:00
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
/// This are the _flags of face, the default value is 0
|
|
|
|
int _flags;
|
2004-02-13 01:44:53 +01:00
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
/***********************************************/
|
|
|
|
/** @name Vertex Pointer
|
2004-10-28 02:56:44 +02:00
|
|
|
Functions to access to the vertexes of the face;
|
2004-03-03 17:08:38 +01:00
|
|
|
**/
|
|
|
|
//@{
|
2004-02-13 01:44:53 +01:00
|
|
|
protected:
|
|
|
|
/// Vector of vertex pointer incident in the face
|
2004-03-03 17:08:38 +01:00
|
|
|
VertexType *v[3];
|
|
|
|
public:
|
|
|
|
/** Return the pointer to the j-th vertex of the face.
|
|
|
|
@param j Index of the face vertex.
|
|
|
|
*/
|
2005-03-18 17:35:53 +01:00
|
|
|
inline VertexType * & V( const int j )
|
2004-03-03 17:08:38 +01:00
|
|
|
{
|
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
assert( (_flags & NOTWRITE) == 0 );
|
|
|
|
assert(j >= 0);
|
|
|
|
assert(j < 3);
|
|
|
|
return v[j];
|
|
|
|
}
|
|
|
|
|
2005-03-18 17:35:53 +01:00
|
|
|
inline VertexType * const & V( const int j ) const
|
2004-03-03 17:08:38 +01:00
|
|
|
{
|
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
assert(j>=0);
|
|
|
|
assert(j<3);
|
|
|
|
return v[j];
|
|
|
|
}
|
2005-03-18 17:35:53 +01:00
|
|
|
inline VertexType * const cV( const int j ) const
|
2004-03-03 17:08:38 +01:00
|
|
|
{
|
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
assert(j>=0);
|
|
|
|
assert(j<3);
|
|
|
|
return v[j];
|
|
|
|
}
|
2004-02-13 01:44:53 +01:00
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
// Shortcut per accedere ai punti delle facce
|
|
|
|
inline CoordType & P( const int j )
|
|
|
|
{
|
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
assert( (_flags & NOTWRITE) == 0 );
|
|
|
|
assert(j>=0);
|
|
|
|
assert(j<3);
|
|
|
|
return v[j]->P();
|
|
|
|
}
|
2004-02-13 01:44:53 +01:00
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
inline const CoordType & P( const int j ) const
|
|
|
|
{
|
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
assert(j>=0);
|
|
|
|
assert(j<3);
|
|
|
|
return v[j]->cP();
|
|
|
|
}
|
|
|
|
inline const CoordType & cP( const int j ) const
|
|
|
|
{
|
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
assert(j>=0);
|
|
|
|
assert(j<3);
|
|
|
|
return v[j]->cP();
|
|
|
|
}
|
2004-02-13 01:44:53 +01:00
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
/** Return the pointer to the ((j+1)%3)-th vertex of the face.
|
|
|
|
@param j Index of the face vertex.
|
|
|
|
*/
|
2005-03-18 17:35:53 +01:00
|
|
|
inline VertexType * & V0( const int j ) { return V(j);}
|
|
|
|
inline VertexType * & V1( const int j ) { return V((j+1)%3);}
|
|
|
|
inline VertexType * & V2( const int j ) { return V((j+2)%3);}
|
|
|
|
inline const VertexType * const & V0( const int j ) const { return V(j);}
|
|
|
|
inline const VertexType * const & V1( const int j ) const { return V((j+1)%3);}
|
|
|
|
inline const VertexType * const & V2( const int j ) const { return V((j+2)%3);}
|
|
|
|
inline const VertexType * const & cV0( const int j ) const { return cV(j);}
|
|
|
|
inline const VertexType * const & cV1( const int j ) const { return cV((j+1)%3);}
|
|
|
|
inline const VertexType * const & cV2( const int j ) const { return cV((j+2)%3);}
|
2004-03-03 17:08:38 +01:00
|
|
|
|
2004-03-10 01:52:38 +01:00
|
|
|
/// Shortcut per accedere ai punti delle facce
|
2004-03-03 17:08:38 +01:00
|
|
|
inline CoordType & P0( const int j ) { return V(j)->P();}
|
|
|
|
inline CoordType & P1( const int j ) { return V((j+1)%3)->P();}
|
|
|
|
inline CoordType & P2( const int j ) { return V((j+2)%3)->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)%3)->P();}
|
|
|
|
inline const CoordType & P2( const int j ) const { return V((j+2)%3)->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)%3)->P();}
|
|
|
|
inline const CoordType & cP2( const int j ) const { return cV((j+2)%3)->P();}
|
|
|
|
|
2005-03-18 17:35:53 +01:00
|
|
|
inline VertexType * & UberV( const int j )
|
2004-03-03 17:08:38 +01:00
|
|
|
{
|
|
|
|
assert(j>=0);
|
|
|
|
assert(j<3);
|
|
|
|
return v[j];
|
|
|
|
}
|
|
|
|
|
2005-03-18 17:35:53 +01:00
|
|
|
inline const VertexType * const & UberV( const int j ) const
|
2004-03-03 17:08:38 +01:00
|
|
|
{
|
|
|
|
assert(j>=0);
|
|
|
|
assert(j<3);
|
|
|
|
return v[j];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//@}
|
|
|
|
|
|
|
|
/***********************************************/
|
|
|
|
/** @name Normal
|
|
|
|
blah
|
|
|
|
blah
|
|
|
|
**/
|
|
|
|
//@{
|
|
|
|
|
|
|
|
#ifdef __VCGLIB_FACE_FN
|
|
|
|
/// This vector indicates the normal of the face (defines if FACE_N is defined)
|
2004-02-13 01:44:53 +01:00
|
|
|
protected:
|
2004-03-03 17:08:38 +01:00
|
|
|
CoordType _n;
|
|
|
|
public:
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
2004-03-03 17:08:38 +01:00
|
|
|
|
2004-04-05 13:51:22 +02:00
|
|
|
/// Return the reference of the normal to the face (if __VCGLIB_FACE_FN is defined).
|
2004-03-03 17:08:38 +01:00
|
|
|
inline CoordType & N()
|
|
|
|
{
|
2004-04-05 13:51:22 +02:00
|
|
|
#ifdef __VCGLIB_FACE_FN
|
2004-03-03 17:08:38 +01:00
|
|
|
return _n;
|
|
|
|
#else
|
|
|
|
assert(0);
|
|
|
|
return *(CoordType *)0;
|
|
|
|
#endif
|
|
|
|
}
|
2004-04-05 13:51:22 +02:00
|
|
|
/// Return the reference of the normal to the face (if __VCGLIB_FACE_FN is defined).
|
2004-03-03 17:08:38 +01:00
|
|
|
inline const CoordType & N() const
|
|
|
|
{
|
2004-04-05 13:51:22 +02:00
|
|
|
#ifdef __VCGLIB_FACE_FN
|
2004-03-03 17:08:38 +01:00
|
|
|
return _n;
|
|
|
|
#else
|
2004-03-10 01:52:38 +01:00
|
|
|
return *(CoordType *)0;
|
2004-03-03 17:08:38 +01:00
|
|
|
#endif
|
|
|
|
}
|
2004-04-05 13:51:22 +02:00
|
|
|
/// Return the reference of the normal to the face (if __VCGLIB_FACE_FN is defined).
|
2004-03-03 17:08:38 +01:00
|
|
|
inline const CoordType cN() const
|
|
|
|
{
|
2004-04-05 13:51:22 +02:00
|
|
|
#ifdef __VCGLIB_FACE_FN
|
2004-03-10 01:52:38 +01:00
|
|
|
return _n;
|
|
|
|
#else
|
|
|
|
return *(CoordType *)0;
|
|
|
|
#endif
|
2004-03-03 17:08:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Calculate the normal to the face, the value is store in the field _n of the face
|
|
|
|
void ComputeNormal()
|
|
|
|
{
|
2004-04-05 13:51:22 +02:00
|
|
|
#ifdef __VCGLIB_FACE_FN
|
|
|
|
_n = vcg::Normal(*this);
|
2004-03-03 17:08:38 +01:00
|
|
|
#else
|
|
|
|
assert(0);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
void ComputeNormalizedNormal()
|
|
|
|
{
|
2004-04-05 13:51:22 +02:00
|
|
|
#ifdef __VCGLIB_FACE_FN
|
2004-05-13 13:01:06 +02:00
|
|
|
_n = vcg::NormalizedNormal(*this);
|
2004-03-03 17:08:38 +01:00
|
|
|
#else
|
|
|
|
assert(0);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-03-10 01:52:38 +01:00
|
|
|
/// Return the value of the face normal as it correspond to the current geometry.
|
|
|
|
/// it is always computed and never stored.
|
|
|
|
const CoordType Normal() const
|
2004-03-03 17:08:38 +01:00
|
|
|
{
|
2004-03-10 01:52:38 +01:00
|
|
|
return vcg::Normal(*this);
|
2004-03-03 17:08:38 +01:00
|
|
|
}
|
2004-03-10 01:52:38 +01:00
|
|
|
|
2004-07-12 14:17:09 +02:00
|
|
|
/// Return the value of the face normal as it correspond to the current geometry.
|
|
|
|
/// it is always computed and never stored.
|
|
|
|
const CoordType NormalizedNormal() const
|
|
|
|
{
|
|
|
|
return vcg::NormalizedNormal(*this);
|
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
#ifdef __VCGLIB_FACE_WN
|
|
|
|
/// This vector indicates per wedge normal
|
|
|
|
CoordType _wn[3];
|
|
|
|
#endif
|
|
|
|
|
2004-02-13 01:44:53 +01:00
|
|
|
public:
|
2004-03-03 17:08:38 +01:00
|
|
|
CoordType & WN(const int i)
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
#ifdef __VCGLIB_FACE_WN
|
|
|
|
return _wn[i];
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
|
|
|
assert(0);
|
2004-03-03 17:08:38 +01:00
|
|
|
return *(CoordType *)(&_flags);
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
const CoordType & WN(const int i) const
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
#ifdef __VCGLIB_FACE_WN
|
|
|
|
return _wn[i];
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
2004-03-03 17:08:38 +01:00
|
|
|
return CoordType();
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/***********************************************/
|
|
|
|
/** @name Quality
|
|
|
|
blah
|
|
|
|
blah
|
|
|
|
**/
|
|
|
|
//@{
|
2004-02-13 01:44:53 +01:00
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
#ifdef __VCGLIB_FACE_FQ
|
|
|
|
protected:
|
|
|
|
float _q;
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
public:
|
2004-03-03 17:08:38 +01:00
|
|
|
float & Q()
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
#ifdef __VCGLIB_FACE_FQ
|
|
|
|
return _q;
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
|
|
|
assert(0);
|
2004-03-03 17:08:38 +01:00
|
|
|
return *(float*)(&_flags);
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
const float & Q() const
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
#ifdef __VCGLIB_FACE_FQ
|
|
|
|
return _q;
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
|
|
|
assert(0);
|
2004-03-03 17:08:38 +01:00
|
|
|
return *(float*)(&_flags);
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/***********************************************/
|
|
|
|
/** @name Texture
|
|
|
|
blah
|
|
|
|
blah
|
|
|
|
**/
|
|
|
|
//@{
|
|
|
|
|
2004-02-13 01:44:53 +01:00
|
|
|
// Per Wedge Texture Coords
|
|
|
|
protected:
|
|
|
|
#ifdef __VCGLIB_FACE_WT
|
2004-03-03 17:08:38 +01:00
|
|
|
TCTYPE _wt[3];
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
public:
|
|
|
|
TCTYPE & WT(const int i)
|
|
|
|
{
|
|
|
|
#ifdef __VCGLIB_FACE_WT
|
2004-03-03 17:08:38 +01:00
|
|
|
return _wt[i];
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
2004-05-12 16:43:36 +02:00
|
|
|
assert(0);
|
|
|
|
return *(TCTYPE*)(&_flags +i) ;
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
const TCTYPE & WT(const int i) const
|
|
|
|
{
|
|
|
|
#ifdef __VCGLIB_FACE_WT
|
2004-03-03 17:08:38 +01:00
|
|
|
return _wt[i];
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
|
|
|
assert(0);
|
2004-03-03 17:08:38 +01:00
|
|
|
return *(TCTYPE*)(&_flags);
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/***********************************************/
|
|
|
|
/** @name Colors
|
|
|
|
blah
|
|
|
|
blah
|
|
|
|
**/
|
|
|
|
//@{
|
2004-02-13 01:44:53 +01:00
|
|
|
protected:
|
2004-03-03 17:08:38 +01:00
|
|
|
#ifdef __VCGLIB_FACE_FC
|
|
|
|
Color4b _c;
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
public:
|
2004-03-03 17:08:38 +01:00
|
|
|
Color4b & C()
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
#ifdef __VCGLIB_FACE_FC
|
|
|
|
return _c;
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
|
|
|
assert(0);
|
2004-03-03 17:08:38 +01:00
|
|
|
return *(Color4b*)(&_flags);
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
const Color4b C() const
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
#ifdef __VCGLIB_FACE_FC
|
|
|
|
return _c;
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
2004-03-03 17:08:38 +01:00
|
|
|
return Color4b(Color4b::White);
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
#ifdef __VCGLIB_FACE_WC
|
2004-03-03 17:08:38 +01:00
|
|
|
Color4b _wc[3];
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
public:
|
2004-03-03 17:08:38 +01:00
|
|
|
Color4b & WC(const int i)
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
|
|
|
#ifdef __VCGLIB_FACE_WC
|
2004-03-03 17:08:38 +01:00
|
|
|
return _wc[i];
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
2004-05-12 16:43:36 +02:00
|
|
|
assert(0);
|
|
|
|
return *(Color4b*)(&_flags + i);
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
const Color4b WC(const int i) const
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
|
|
|
#ifdef __VCGLIB_FACE_WC
|
2004-03-03 17:08:38 +01:00
|
|
|
return _wc[i];
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
|
|
|
assert(0);
|
2004-03-03 17:08:38 +01:00
|
|
|
return Color4b(Color4b::White);
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
//@}
|
2004-02-13 01:44:53 +01:00
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
/***********************************************/
|
|
|
|
/** @name Adjacency
|
|
|
|
blah
|
|
|
|
blah
|
|
|
|
**/
|
|
|
|
//@{
|
2004-02-13 01:44:53 +01:00
|
|
|
|
2004-05-06 11:06:59 +02:00
|
|
|
#if (defined(__VCGLIB_FACE_AF) && defined(__VCGLIB_FACE_AS))
|
2004-02-13 01:44:53 +01:00
|
|
|
#error Error: You cannot specify face-to-face and shared topology together
|
|
|
|
#endif
|
|
|
|
|
2004-05-06 11:06:59 +02:00
|
|
|
#if (defined(__VCGLIB_FACE_AV) && defined(__VCGLIB_FACE_AS))
|
2004-02-13 01:44:53 +01:00
|
|
|
#error Error: You cannot specify vertex-face and shared topology together
|
|
|
|
#endif
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
protected:
|
2004-05-06 11:06:59 +02:00
|
|
|
#if defined(__VCGLIB_FACE_AF)
|
2004-03-03 17:08:38 +01:00
|
|
|
/// Vector of face pointer, it's used to indicate the adjacency relations (defines if FACE_A is defined)
|
2004-05-10 15:19:38 +02:00
|
|
|
FFTYPE *_ffp[3]; // Facce adiacenti
|
2004-02-13 01:44:53 +01:00
|
|
|
/// Index of the face in the arrival face
|
2005-03-11 15:14:14 +01:00
|
|
|
char _ffi[3];
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
|
2004-05-06 11:06:59 +02:00
|
|
|
#ifdef __VCGLIB_FACE_AV
|
2004-02-13 01:44:53 +01:00
|
|
|
///Vettore di puntatori a faccia, utilizzato per indicare le adiacenze vertice faccia
|
2004-05-10 15:19:38 +02:00
|
|
|
FFTYPE *_fvp[3];
|
2004-05-06 11:06:59 +02:00
|
|
|
char _fvi[3];
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
|
2004-05-06 11:06:59 +02:00
|
|
|
#ifdef __VCGLIB_FACE_AS
|
2004-02-13 01:44:53 +01:00
|
|
|
///Vettore di puntatori a faccia, utilizzato per indicare le adiacenze vertice faccia
|
2004-05-10 15:19:38 +02:00
|
|
|
FFTYPE *fs[3];
|
2004-02-13 01:44:53 +01:00
|
|
|
char zs[3];
|
|
|
|
#endif
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Return the pointer to the j-th adjacent face.
|
|
|
|
@param j Index of the edge.
|
|
|
|
*/
|
2004-05-10 15:19:38 +02:00
|
|
|
inline FFTYPE * & FFp( const int j )
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
assert( (_flags & NOTWRITE) == 0 );
|
2004-02-13 01:44:53 +01:00
|
|
|
assert(j>=0);
|
2004-03-03 17:08:38 +01:00
|
|
|
assert(j<3);
|
2004-05-06 11:06:59 +02:00
|
|
|
#if defined(__VCGLIB_FACE_AF)
|
|
|
|
return _ffp[j];
|
|
|
|
#elif defined(__VCGLIB_FACE_AS)
|
2004-02-13 01:44:53 +01:00
|
|
|
return fs[j];
|
|
|
|
#else
|
|
|
|
assert(0);
|
2004-05-12 16:43:36 +02:00
|
|
|
static FFTYPE *dum=0; dum+=j;
|
2004-02-13 01:44:53 +01:00
|
|
|
return dum;
|
2004-05-12 16:43:36 +02:00
|
|
|
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-10-20 10:28:31 +02:00
|
|
|
inline const FFTYPE * FFp( const int j ) const
|
|
|
|
{
|
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
assert(j>=0 && j<3);
|
|
|
|
|
|
|
|
#if defined(__VCGLIB_FACE_AF)
|
|
|
|
return _ffp[j];
|
|
|
|
#elif defined(__VCGLIB_FACE_AS)
|
|
|
|
return fs[j];
|
|
|
|
#else
|
|
|
|
assert(0);
|
|
|
|
static FFTYPE *dum=0; dum+=j;
|
|
|
|
return dum;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
inline FFTYPE * & FFp1( const int j ) { return FFp((j+1)%3);}
|
|
|
|
inline FFTYPE * & FFp2( const int j ) { return FFp((j+2)%3);}
|
|
|
|
inline const FFTYPE * const& FFp1( const int j ) const { return FFp((j+1)%3);}
|
|
|
|
inline const FFTYPE * const& FFp2( const int j ) const { return FFp((j+2)%3);}
|
|
|
|
|
|
|
|
|
2004-10-18 19:13:50 +02:00
|
|
|
inline bool const IsBorder( const int & j ) const
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
2004-02-13 01:44:53 +01:00
|
|
|
assert(j>=0);
|
2004-10-20 10:28:31 +02:00
|
|
|
assert(j<3);
|
2004-05-06 11:06:59 +02:00
|
|
|
#if defined(__VCGLIB_FACE_AF)
|
2004-10-20 10:28:31 +02:00
|
|
|
return (_ffp[j]==this);
|
2004-05-06 11:06:59 +02:00
|
|
|
#elif defined(__VCGLIB_FACE_AS)
|
2004-10-20 10:28:31 +02:00
|
|
|
return (fs[j]==this);
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
2004-10-20 10:28:31 +02:00
|
|
|
assert(0);
|
2004-10-25 10:22:40 +02:00
|
|
|
return ((FFTYPE *)this==0);
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
2004-10-18 19:13:50 +02:00
|
|
|
|
2004-02-13 01:44:53 +01:00
|
|
|
|
|
|
|
/** Return the pointer to the j-th adjacent face.
|
|
|
|
@param j Index of the edge.
|
|
|
|
*/
|
2004-05-10 15:19:38 +02:00
|
|
|
inline FFTYPE * & UberF( const int j )
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
|
|
|
assert(j>=0);
|
2004-03-03 17:08:38 +01:00
|
|
|
assert(j<3);
|
2004-05-06 11:06:59 +02:00
|
|
|
#if defined(__VCGLIB_FACE_AF)
|
|
|
|
return _ffp[j];
|
|
|
|
#elif defined(__VCGLIB_FACE_AS)
|
2004-02-13 01:44:53 +01:00
|
|
|
return fs[j];
|
|
|
|
#else
|
|
|
|
assert(0); // if you stop here you are probably trying to use FF topology in a face without it
|
2004-05-10 15:19:38 +02:00
|
|
|
return *((FFTYPE **)(_flags));
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-05-10 15:19:38 +02:00
|
|
|
inline const FFTYPE * const & UberF( const int j ) const
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
|
|
|
assert(j>=0);
|
2004-03-03 17:08:38 +01:00
|
|
|
assert(j<3);
|
2004-05-06 11:06:59 +02:00
|
|
|
#if defined(__VCGLIB_FACE_AF)
|
|
|
|
return _ffp[j];
|
|
|
|
#elif defined(__VCGLIB_FACE_AS)
|
2004-02-13 01:44:53 +01:00
|
|
|
return fs[j];
|
|
|
|
#else
|
|
|
|
assert(0); // if you stop here you are probably trying to use FF topology in a face without it
|
2004-05-10 15:19:38 +02:00
|
|
|
return *((FFTYPE **)(_flags));
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-10 15:19:38 +02:00
|
|
|
inline FFTYPE * & VFp( const int j )
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
assert( (_flags & NOTWRITE) == 0 );
|
2004-02-13 01:44:53 +01:00
|
|
|
assert(j>=0);
|
2004-03-03 17:08:38 +01:00
|
|
|
assert(j<3);
|
2004-05-06 11:06:59 +02:00
|
|
|
#ifdef __VCGLIB_FACE_AV
|
|
|
|
return _fvp[j];
|
|
|
|
#elif defined(__VCGLIB_FACE_AS)
|
2004-02-13 01:44:53 +01:00
|
|
|
return fs[j];
|
|
|
|
#else
|
|
|
|
assert(0); // you are probably trying to use VF topology in a vertex without it
|
2004-05-10 15:19:38 +02:00
|
|
|
return *((FFTYPE **)(_flags));
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-05-10 15:19:38 +02:00
|
|
|
inline const FFTYPE * const & VFp( const int j ) const
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
2004-02-13 01:44:53 +01:00
|
|
|
assert(j>=0);
|
2004-03-03 17:08:38 +01:00
|
|
|
assert(j<3);
|
2004-05-06 11:06:59 +02:00
|
|
|
#ifdef __VCGLIB_FACE_AV
|
|
|
|
return _fvp[j];
|
|
|
|
#elif defined(__VCGLIB_FACE_AS)
|
2004-02-13 01:44:53 +01:00
|
|
|
return fs[j];
|
|
|
|
#else
|
|
|
|
assert(0);
|
2004-05-10 15:19:38 +02:00
|
|
|
return (FFTYPE *)this;
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Return the index that the face have in the j-th adjacent face.
|
|
|
|
@param j Index of the edge.
|
|
|
|
*/
|
2004-05-06 11:06:59 +02:00
|
|
|
inline char & FFi( const int j )
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
assert( (_flags & NOTWRITE) == 0 );
|
2004-02-13 01:44:53 +01:00
|
|
|
assert(j>=0);
|
2004-03-03 17:08:38 +01:00
|
|
|
assert(j<3);
|
2004-05-06 11:06:59 +02:00
|
|
|
#if defined(__VCGLIB_FACE_AF)
|
|
|
|
return _ffi[j];
|
|
|
|
#elif defined(__VCGLIB_FACE_AS)
|
2004-02-13 01:44:53 +01:00
|
|
|
return zs[j];
|
|
|
|
#else
|
|
|
|
assert(0);
|
2004-03-03 17:08:38 +01:00
|
|
|
return *(char *)&_flags; // tanto per farlo compilare...
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-05-06 11:06:59 +02:00
|
|
|
inline const char & FFi( const int j ) const
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
2004-02-13 01:44:53 +01:00
|
|
|
assert(j>=0);
|
2004-03-03 17:08:38 +01:00
|
|
|
assert(j<3);
|
2004-05-06 11:06:59 +02:00
|
|
|
#if defined(__VCGLIB_FACE_AF)
|
|
|
|
return _ffi[j];
|
|
|
|
#elif defined(__VCGLIB_FACE_AS)
|
2004-02-13 01:44:53 +01:00
|
|
|
return zs[j];
|
|
|
|
#else
|
|
|
|
assert(0);
|
2004-03-03 17:08:38 +01:00
|
|
|
return *(char *)&_flags;
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Return the index that the face have in the j-th adjacent face.
|
|
|
|
@param j Index of the edge.
|
|
|
|
*/
|
2004-03-03 17:08:38 +01:00
|
|
|
inline char & UberZ( const int j )
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
|
|
|
assert(j>=0);
|
2004-03-03 17:08:38 +01:00
|
|
|
assert(j<3);
|
2004-05-06 11:06:59 +02:00
|
|
|
#if defined(__VCGLIB_FACE_AF)
|
|
|
|
return _ffi[j];
|
|
|
|
#elif defined(__VCGLIB_FACE_AS)
|
2004-02-13 01:44:53 +01:00
|
|
|
return zs[j];
|
|
|
|
#else
|
|
|
|
assert(0);
|
2004-03-03 17:08:38 +01:00
|
|
|
return *(char *)&_flags;
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
inline const char & UberZ( const int j ) const
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
|
|
|
assert(j>=0);
|
2004-03-03 17:08:38 +01:00
|
|
|
assert(j<3);
|
2004-05-06 11:06:59 +02:00
|
|
|
#if defined(__VCGLIB_FACE_AF)
|
|
|
|
return _ffi[j];
|
|
|
|
#elif defined(__VCGLIB_FACE_AS)
|
2004-03-03 17:08:38 +01:00
|
|
|
return zs[j];
|
|
|
|
#else
|
|
|
|
assert(0);
|
|
|
|
return *(char *)&_flags;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-10 15:19:38 +02:00
|
|
|
inline char & VFi( const int j )
|
2004-03-03 17:08:38 +01:00
|
|
|
{
|
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
assert( (_flags & NOTWRITE) == 0 );
|
|
|
|
assert(j>=0);
|
|
|
|
assert(j<3);
|
2004-05-06 11:06:59 +02:00
|
|
|
#ifdef __VCGLIB_FACE_AV
|
|
|
|
return _fvi[j];
|
|
|
|
#elif defined(__VCGLIB_FACE_AS)
|
2004-02-13 01:44:53 +01:00
|
|
|
return zs[j];
|
|
|
|
#else
|
|
|
|
assert(0);
|
2004-03-03 17:08:38 +01:00
|
|
|
return *(char *)&_flags;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-05-10 15:19:38 +02:00
|
|
|
inline const char & VFi( const int j ) const
|
2004-03-03 17:08:38 +01:00
|
|
|
{
|
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
assert(j>=0);
|
|
|
|
assert(j<3);
|
2004-05-06 11:06:59 +02:00
|
|
|
#ifdef __VCGLIB_FACE_AV
|
|
|
|
return _fvi[j];
|
|
|
|
#elif defined(__VCGLIB_FACE_AS)
|
2004-03-03 17:08:38 +01:00
|
|
|
return zs[j];
|
|
|
|
#else
|
|
|
|
assert(0);
|
|
|
|
return *(char *)&_flags;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
//@}
|
|
|
|
|
|
|
|
/***********************************************/
|
|
|
|
/** @name Mark
|
|
|
|
blah
|
|
|
|
blah
|
|
|
|
**/
|
|
|
|
//@{
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __VCGLIB_FACE_FM
|
|
|
|
/// Incremental mark (defines if FACE_I is defined)
|
|
|
|
int imark;
|
|
|
|
inline int & IMark()
|
|
|
|
{
|
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
assert( (_flags & NOTWRITE) == 0 );
|
|
|
|
return imark;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const int & IMark() const
|
|
|
|
{
|
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
return imark;
|
|
|
|
}
|
|
|
|
#endif // Mark
|
|
|
|
|
|
|
|
/// Initialize the imark system of the face
|
|
|
|
inline void InitIMark()
|
|
|
|
{
|
2004-05-04 04:46:23 +02:00
|
|
|
#ifdef __VCGLIB_FACE_FM
|
2004-03-03 17:08:38 +01:00
|
|
|
imark = 0;
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
|
|
|
|
//@}
|
|
|
|
/***********************************************/
|
|
|
|
/** @name Flags
|
|
|
|
blah
|
|
|
|
blah
|
|
|
|
**/
|
|
|
|
//@{
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
BORDER2 = 0x00000100,
|
|
|
|
// Face Orientation Flags, used efficiently compute point face distance
|
|
|
|
NORMX = 0x00000200,
|
|
|
|
NORMY = 0x00000400,
|
|
|
|
NORMZ = 0x00000800,
|
|
|
|
// Crease _flags, it is assumed that FEATUREi = FEATURE0<<i
|
|
|
|
FEATURE0 = 0x00008000,
|
|
|
|
FEATURE1 = 0x00010000,
|
|
|
|
FEATURE2 = 0x00020000,
|
|
|
|
// 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() {_flags=0;}
|
2004-02-13 01:44:53 +01:00
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
/// Return the _flags.
|
|
|
|
inline int & Flags ()
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
return _flags;
|
2004-02-13 01:44:53 +01:00
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
inline const int & Flags () const
|
|
|
|
{
|
|
|
|
assert( (_flags & DELETED) == 0 );
|
|
|
|
assert( (_flags & NOTREAD) == 0 );
|
|
|
|
return _flags;
|
2004-02-13 01:44:53 +01:00
|
|
|
}
|
2004-03-03 17:08:38 +01:00
|
|
|
/// Ritorna il _flags senza effettuare alcun controllo sui relativi bit
|
|
|
|
inline int & UberFlags()
|
|
|
|
{
|
|
|
|
return _flags;
|
2004-02-13 01:44:53 +01:00
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
inline const int UberFlags() const
|
|
|
|
{
|
|
|
|
return _flags;
|
2004-02-13 01:44:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// This function checks if the face is deleted
|
2004-03-03 17:08:38 +01:00
|
|
|
bool IsD() const {return (_flags & DELETED) != 0;}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This function mark the face as deleted
|
2004-03-03 17:08:38 +01:00
|
|
|
void SetD() {_flags |=DELETED;}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This function mark the face as not deleted
|
2004-03-03 17:08:38 +01:00
|
|
|
void ClearD() {_flags &= (~DELETED);}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This function checks if the face is deleted
|
|
|
|
bool IsDeleted() const {return IsD();}
|
|
|
|
|
|
|
|
/// This function checks if the face is readable
|
2004-03-03 17:08:38 +01:00
|
|
|
bool IsR() const {return (_flags & NOTREAD) == 0;}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This function marks the face as readable
|
2004-03-03 17:08:38 +01:00
|
|
|
void SetR() {_flags &= (~NOTREAD);}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This function marks the face as not readable
|
2004-03-03 17:08:38 +01:00
|
|
|
void ClearR() {_flags |=NOTREAD;}
|
2004-02-13 01:44:53 +01:00
|
|
|
|
|
|
|
/// This function checks if the face is readable
|
2004-03-03 17:08:38 +01:00
|
|
|
bool IsW() const {return (_flags & NOTWRITE)== 0;}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This function marks the vertex as not writable
|
2004-03-03 17:08:38 +01:00
|
|
|
void SetW() {_flags &=(~NOTWRITE);}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This function marks the face as not writable
|
2004-03-03 17:08:38 +01:00
|
|
|
void ClearW() {_flags |=NOTWRITE;}
|
2004-02-13 01:44:53 +01:00
|
|
|
|
|
|
|
/// This funcion checks whether the face is both readable and modifiable
|
2004-03-03 17:08:38 +01:00
|
|
|
bool IsRW() const {return (_flags & (NOTREAD | NOTWRITE)) == 0;}
|
|
|
|
|
2004-02-13 01:44:53 +01:00
|
|
|
|
|
|
|
/// This function checks if the face is selected
|
2004-03-03 17:08:38 +01:00
|
|
|
bool IsS() const {return (_flags & SELECTED) != 0;}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This function select the face
|
2004-03-03 17:08:38 +01:00
|
|
|
void SetS() {_flags |=SELECTED;}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This funcion execute the inverse operation of SetS()
|
2004-03-03 17:08:38 +01:00
|
|
|
void ClearS() {_flags &= (~SELECTED);}
|
2004-02-13 01:44:53 +01:00
|
|
|
|
|
|
|
/// This function checks if the face is selected
|
2004-03-03 17:08:38 +01:00
|
|
|
bool IsB(int i) const {return (_flags & (BORDER0<<i)) != 0;}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This function select the face
|
2004-03-03 17:08:38 +01:00
|
|
|
void SetB(int i) {_flags |=(BORDER0<<i);}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This funcion execute the inverse operation of SetS()
|
2004-03-03 17:08:38 +01:00
|
|
|
void ClearB(int i) {_flags &= (~(BORDER0<<i));}
|
2004-02-13 01:44:53 +01:00
|
|
|
|
|
|
|
/// This function checks if the face is Crease on side i
|
2004-03-03 17:08:38 +01:00
|
|
|
bool IsFF(int i) const {return (_flags & (FEATURE0<<i)) != 0;}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This function select the face flag
|
2004-03-03 17:08:38 +01:00
|
|
|
void SetFF(int i) {_flags |=(FEATURE0<<i);}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This funcion execute the inverse operation of Set()
|
2004-03-03 17:08:38 +01:00
|
|
|
void ClearFF(int i) {_flags &= (~(FEATURE0<<i));}
|
2004-02-13 01:44:53 +01:00
|
|
|
|
|
|
|
/// This function checks if the given user bit is true
|
2004-03-03 17:08:38 +01:00
|
|
|
bool IsUserBit(int userBit){return (_flags & userBit) != 0;}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This function set the given user bit
|
2004-03-03 17:08:38 +01:00
|
|
|
void SetUserBit(int userBit){_flags |=userBit;}
|
2004-02-13 01:44:53 +01:00
|
|
|
/// This function clear the given user bit
|
2004-03-03 17:08:38 +01:00
|
|
|
void ClearUserBit(int userBit){_flags &= (~userBit);}
|
|
|
|
|
2004-02-13 01:44:53 +01:00
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
//@}
|
2004-02-13 01:44:53 +01:00
|
|
|
/*#*******************
|
2004-03-03 17:08:38 +01:00
|
|
|
* Bounding box *
|
2004-02-13 01:44:53 +01:00
|
|
|
**********************/
|
2004-03-03 17:08:38 +01:00
|
|
|
|
|
|
|
void GetBBox( BoxType & bb )
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
bb.Set( v[0]->P() );
|
|
|
|
bb.Add( v[1]->P() );
|
|
|
|
bb.Add( v[2]->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 HasFaceNormal() {
|
|
|
|
#ifdef __VCGLIB_FACE_FN
|
|
|
|
return true;
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
2004-03-03 17:08:38 +01:00
|
|
|
return false;
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
2004-03-03 17:08:38 +01:00
|
|
|
static bool HasFaceQuality() {
|
|
|
|
#ifdef __VCGLIB_FACE_FQ
|
|
|
|
return true;
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
2004-03-03 17:08:38 +01:00
|
|
|
return false;
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
2004-03-03 17:08:38 +01:00
|
|
|
static bool HasFaceColor() {
|
|
|
|
#ifdef __VCGLIB_FACE_FC
|
|
|
|
return true;
|
2004-02-13 01:44:53 +01:00
|
|
|
#else
|
2004-03-03 17:08:38 +01:00
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
2005-01-28 18:53:13 +01:00
|
|
|
static bool HasEdgePlane() {
|
|
|
|
#ifdef __VCGLIB_FACE_RT
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
2004-03-03 17:08:38 +01:00
|
|
|
static bool HasFFAdjacency() {
|
2004-05-06 11:06:59 +02:00
|
|
|
#if (defined(__VCGLIB_FACE_AF) || defined(__VCGLIB_FACE_AS))
|
2004-03-03 17:08:38 +01:00
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
static bool HasVFAdjacency() {
|
2004-05-06 11:06:59 +02:00
|
|
|
#if (defined(__VCGLIB_FACE_AV) || defined(__VCGLIB_FACE_AS))
|
2004-03-03 17:08:38 +01:00
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
static bool HasSharedAdjacency() {
|
2004-05-06 11:06:59 +02:00
|
|
|
#if defined(__VCGLIB_FACE_AS)
|
2004-03-03 17:08:38 +01:00
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
static bool HasFaceMark() {
|
|
|
|
#ifdef __VCGLIB_FACE_FC
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
static bool HasWedgeColor() {
|
|
|
|
#ifdef __VCGLIB_FACE_WC
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
static bool HasWedgeTexture() {
|
|
|
|
#ifdef __VCGLIB_FACE_WT
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
static bool HasWedgeNormal() {
|
|
|
|
#ifdef __VCGLIB_FACE_WN
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/// operator to compare two faces
|
2004-05-10 15:19:38 +02:00
|
|
|
inline bool operator == ( const FFTYPE & f ) const {
|
2004-03-03 17:08:38 +01:00
|
|
|
for(int i=0; i<3; ++i)
|
|
|
|
if( (V(i) != f.V(0)) && (V(i) != f.V(1)) && (V(i) != f.V(2)) )
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2004-02-13 01:44:53 +01:00
|
|
|
/** 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)
|
2004-03-03 17:08:38 +01:00
|
|
|
@param _c Valore di ritorno per il vertice V(2)
|
2004-02-13 01:44:53 +01:00
|
|
|
@return true se bq appartiene alla faccia, false altrimenti
|
|
|
|
*/
|
2004-03-03 17:08:38 +01:00
|
|
|
bool InterpolationParameters(const CoordType & bq, ScalarType &a, ScalarType &b, ScalarType &_c ) const
|
|
|
|
{
|
|
|
|
const ScalarType EPSILON = ScalarType(0.000001);
|
2004-02-13 01:44:53 +01:00
|
|
|
|
|
|
|
|
2004-05-04 04:46:23 +02:00
|
|
|
#define x1 (cV(0)->P()[0])
|
|
|
|
#define y1 (cV(0)->P()[1])
|
|
|
|
#define z1 (cV(0)->P()[2])
|
|
|
|
#define x2 (cV(1)->P()[0])
|
|
|
|
#define y2 (cV(1)->P()[1])
|
|
|
|
#define z2 (cV(1)->P()[2])
|
|
|
|
#define x3 (cV(2)->P()[0])
|
|
|
|
#define y3 (cV(2)->P()[1])
|
|
|
|
#define z3 (cV(2)->P()[2])
|
|
|
|
#define px (bq[0])
|
|
|
|
#define py (bq[1])
|
|
|
|
#define pz (bq[2])
|
2004-02-13 01:44:53 +01:00
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
ScalarType t1 = px*y2;
|
|
|
|
ScalarType t2 = px*y3;
|
|
|
|
ScalarType t3 = py*x2;
|
|
|
|
ScalarType t4 = py*x3;
|
|
|
|
ScalarType t5 = x2*y3;
|
|
|
|
ScalarType t6 = x3*y2;
|
|
|
|
ScalarType t8 = x1*y2;
|
|
|
|
ScalarType t9 = x1*y3;
|
|
|
|
ScalarType t10 = y1*x2;
|
|
|
|
ScalarType t11 = y1*x3;
|
|
|
|
ScalarType t13 = t8-t9-t10+t11+t5-t6;
|
2004-02-13 01:44:53 +01:00
|
|
|
if(fabs(t13)>=EPSILON)
|
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
ScalarType t15 = px*y1;
|
|
|
|
ScalarType t16 = py*x1;
|
2004-02-13 01:44:53 +01:00
|
|
|
a = (t1 -t2-t3 +t4+t5-t6 )/t13;
|
|
|
|
b = -(t15-t2-t16+t4+t9-t11)/t13;
|
2004-03-03 17:08:38 +01:00
|
|
|
_c = (t15-t1-t16+t3+t8-t10)/t13;
|
2004-02-13 01:44:53 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
t1 = px*z2;
|
|
|
|
t2 = px*z3;
|
|
|
|
t3 = pz*x2;
|
|
|
|
t4 = pz*x3;
|
|
|
|
t5 = x2*z3;
|
|
|
|
t6 = x3*z2;
|
|
|
|
t8 = x1*z2;
|
|
|
|
t9 = x1*z3;
|
|
|
|
t10 = z1*x2;
|
|
|
|
t11 = z1*x3;
|
|
|
|
t13 = t8-t9-t10+t11+t5-t6;
|
|
|
|
if(fabs(t13)>=EPSILON)
|
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
ScalarType t15 = px*z1;
|
|
|
|
ScalarType t16 = pz*x1;
|
2004-02-13 01:44:53 +01:00
|
|
|
a = (t1 -t2-t3 +t4+t5-t6 )/t13;
|
|
|
|
b = -(t15-t2-t16+t4+t9-t11)/t13;
|
2004-03-03 17:08:38 +01:00
|
|
|
_c = (t15-t1-t16+t3+t8-t10)/t13;
|
2004-02-13 01:44:53 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
t1 = pz*y2; t2 = pz*y3;
|
|
|
|
t3 = py*z2; t4 = py*z3;
|
|
|
|
t5 = z2*y3; t6 = z3*y2;
|
|
|
|
t8 = z1*y2; t9 = z1*y3;
|
|
|
|
t10 = y1*z2; t11 = y1*z3;
|
|
|
|
t13 = t8-t9-t10+t11+t5-t6;
|
|
|
|
if(fabs(t13)>=EPSILON)
|
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
ScalarType t15 = pz*y1;
|
|
|
|
ScalarType t16 = py*z1;
|
2004-02-13 01:44:53 +01:00
|
|
|
a = (t1 -t2-t3 +t4+t5-t6 )/t13;
|
|
|
|
b = -(t15-t2-t16+t4+t9-t11)/t13;
|
2004-03-03 17:08:38 +01:00
|
|
|
_c = (t15-t1-t16+t3+t8-t10)/t13;
|
2004-02-13 01:44:53 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef x1
|
|
|
|
#undef y1
|
|
|
|
#undef z1
|
|
|
|
#undef x2
|
|
|
|
#undef y2
|
|
|
|
#undef z2
|
|
|
|
#undef x3
|
|
|
|
#undef y3
|
|
|
|
#undef z3
|
|
|
|
#undef px
|
|
|
|
#undef py
|
|
|
|
#undef pz
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Return the DOUBLE of the area of the face
|
2004-03-03 17:08:38 +01:00
|
|
|
ScalarType Area() const
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-08-25 17:15:27 +02:00
|
|
|
return ( (V(1)->cP() - V(0)->cP()) ^ (V(2)->cP() - V(0)->P()) ).Norm();
|
2004-02-13 01:44:53 +01:00
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
CoordType Barycenter() const
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
2004-03-03 17:08:38 +01:00
|
|
|
return (V(0)->P()+V(1)->P()+V(2)->P())/ScalarType(3.0);
|
2004-02-13 01:44:53 +01:00
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
ScalarType Perimeter() const
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
|
|
|
return Distance(V(0)->P(),V(1)->P())+
|
|
|
|
Distance(V(1)->P(),V(2)->P())+
|
|
|
|
Distance(V(2)->P(),V(0)->P());
|
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
/// Return the _q of the face, the return value is in [0,sqrt(3)/2] = [0 - 0.866.. ]
|
|
|
|
ScalarType QualityFace( ) const
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
|
|
|
|
2004-09-15 13:20:15 +02:00
|
|
|
return Quality(V(0)->cP(), V(1)->cP(), V(2)->cP());
|
2004-02-13 01:44:53 +01:00
|
|
|
/*
|
2004-03-03 17:08:38 +01:00
|
|
|
CoordType d10 = V(1)->P() - V(0)->P();
|
|
|
|
CoordType d20 = V(2)->P() - V(0)->P();
|
|
|
|
CoordType d12 = V(1)->P() - V(2)->P();
|
2004-02-13 01:44:53 +01:00
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
CoordType x = d10^d20;
|
2004-02-13 01:44:53 +01:00
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
ScalarType a = Norm( x ); // doppio dell' Area
|
|
|
|
ScalarType b;
|
2004-02-13 01:44:53 +01:00
|
|
|
|
|
|
|
b = Norm2( d10 );
|
2004-03-03 17:08:38 +01:00
|
|
|
ScalarType t = b;
|
2004-02-13 01:44:53 +01:00
|
|
|
t = Norm2( d20 ); if( b<t ) b = t;
|
|
|
|
t = Norm2( d12 ); if( b<t ) b = t;
|
|
|
|
|
|
|
|
assert(b!=0.0);
|
|
|
|
|
|
|
|
return a/b;*/
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Funzione di supporto
|
2004-03-03 17:08:38 +01:00
|
|
|
inline void Nexts( BaseFaceType *&f,int &z )
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
|
|
|
int t;
|
|
|
|
t = z;
|
|
|
|
z = (*f).Z(z);
|
|
|
|
f = (*f).F(t);
|
|
|
|
}
|
|
|
|
|
2004-03-03 17:08:38 +01:00
|
|
|
// Sezione dist e ray
|
|
|
|
#ifdef __VCGLIB_FACE_RT
|
|
|
|
CoordType edge[3];
|
|
|
|
Plane3<ScalarType> plane;
|
2004-02-13 01:44:53 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/// return the index [0..2] of a vertex in a face
|
2005-03-18 17:35:53 +01:00
|
|
|
inline int VertexIndex( const VertexType * w ) const
|
2004-02-13 01:44:53 +01:00
|
|
|
{
|
|
|
|
if( v[0]==w ) return 0;
|
|
|
|
else if( v[1]==w ) return 1;
|
|
|
|
else if( v[2]==w ) return 2;
|
|
|
|
else return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}; //end Class
|
|
|
|
|
|
|
|
|
2004-10-28 02:56:44 +02:00
|
|
|
//@}
|
2004-02-13 01:44:53 +01:00
|
|
|
|
|
|
|
} // end namespace
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|