basefacetype to facetype
This commit is contained in:
parent
0243e21354
commit
3edc5d70bf
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.6 2004/07/06 06:25:44 cignoni
|
||||||
|
changed the VFIterator ++ to return a facepointer instead of a bool
|
||||||
|
|
||||||
Revision 1.5 2004/06/02 16:25:45 ganovelli
|
Revision 1.5 2004/06/02 16:25:45 ganovelli
|
||||||
changed F(.. to FFp
|
changed F(.. to FFp
|
||||||
changed Z( to FFi(
|
changed Z( to FFi(
|
||||||
|
@ -61,23 +64,22 @@ namespace face {
|
||||||
It contain a pointer to the current face,
|
It contain a pointer to the current face,
|
||||||
the index of one edge and a edge's incident vertex.
|
the index of one edge and a edge's incident vertex.
|
||||||
*/
|
*/
|
||||||
template <typename FaceType>
|
template <class FaceType>
|
||||||
class Pos
|
class Pos
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// The vertex type
|
/// The vertex type
|
||||||
typedef typename FaceType::VertexType VertexType;
|
typedef typename FaceType::VertexType VertexType;
|
||||||
typedef typename FaceType::BaseFaceType BaseFaceType;
|
|
||||||
///The HEdgePos type
|
///The HEdgePos type
|
||||||
typedef Pos<FaceType> BasePosType;
|
typedef Pos<FaceType> PosType;
|
||||||
/// The vector type
|
/// The vector type
|
||||||
typedef typename VertexType::CoordType CoordType;
|
typedef typename VertexType::CoordType CoordType;
|
||||||
/// The scalar type
|
/// The scalar type
|
||||||
typedef typename VertexType::ScalarType ScalarType;
|
typedef typename VertexType::ScalarType ScalarType;
|
||||||
|
|
||||||
/// Pointer to the face of the half-edge
|
/// Pointer to the face of the half-edge
|
||||||
typename FaceType::BaseFaceType *f;
|
typename FaceType::FaceType *f;
|
||||||
/// Index of the edge
|
/// Index of the edge
|
||||||
int z;
|
int z;
|
||||||
/// Pointer to the vertex
|
/// Pointer to the vertex
|
||||||
|
@ -86,27 +88,30 @@ public:
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
Pos(){}
|
Pos(){}
|
||||||
/// Constructor which associates the half-edge elementet with a face, its edge and its vertex
|
/// Constructor which associates the half-edge elementet with a face, its edge and its vertex
|
||||||
Pos(BaseFaceType * const fp, int const zp, VertexType * const vp){f=fp; z=zp; v=vp;}
|
Pos(FaceType * const fp, int const zp, VertexType * const vp){f=fp; z=zp; v=vp;}
|
||||||
Pos(BaseFaceType * const fp, int const zp){f=fp; z=zp; v=f.V[zp];}
|
Pos(FaceType * const fp, int const zp){f=fp; z=zp; v=f->V(zp);}
|
||||||
|
|
||||||
|
// access functions
|
||||||
|
VertexType *& V(const int & i){assert( (i>=0) && (i<2)); return f->UberV( (z +i) %3);}
|
||||||
|
|
||||||
/// Operator to compare two half-edge
|
/// Operator to compare two half-edge
|
||||||
inline bool operator == ( BasePosType const & p ) const {
|
inline bool operator == ( FaceType const & p ) const {
|
||||||
return (f==p.f && z==p.z && v==p.v);
|
return (f==p.f && z==p.z && v==p.v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Operator to compare two half-edge
|
/// Operator to compare two half-edge
|
||||||
inline bool operator != ( BasePosType const & p ) const {
|
inline bool operator != ( FaceType const & p ) const {
|
||||||
return (f!=p.f || z!=p.z || v!=p.v);
|
return (f!=p.f || z!=p.z || v!=p.v);
|
||||||
}
|
}
|
||||||
/// Operator to order half-edge; it's compare at the first the face pointers, then the index of the edge and finally the vertex pointers
|
/// Operator to order half-edge; it's compare at the first the face pointers, then the index of the edge and finally the vertex pointers
|
||||||
inline bool operator <= ( BasePosType const & p) const {
|
inline bool operator <= ( FaceType const & p) const {
|
||||||
return (f!=p.f)?(f<f.p):
|
return (f!=p.f)?(f<f.p):
|
||||||
(z!=p.z)?(z<p.z):
|
(z!=p.z)?(z<p.z):
|
||||||
(v<=p.v);
|
(v<=p.v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Assignment operator
|
/// Assignment operator
|
||||||
inline BasePosType & operator = ( const BasePosType & h ){
|
inline FaceType & operator = ( const FaceType & h ){
|
||||||
f=h.f;
|
f=h.f;
|
||||||
z=h.z;
|
z=h.z;
|
||||||
v=h.v;
|
v=h.v;
|
||||||
|
@ -241,7 +246,7 @@ public:
|
||||||
int StarSize()
|
int StarSize()
|
||||||
{
|
{
|
||||||
int n=0;
|
int n=0;
|
||||||
BasePosType ht=*this;
|
FaceType ht=*this;
|
||||||
bool bf=false;
|
bool bf=false;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -259,7 +264,7 @@ public:
|
||||||
@param zp Indice dell'edge
|
@param zp Indice dell'edge
|
||||||
@param vp Puntatore al vertice
|
@param vp Puntatore al vertice
|
||||||
*/
|
*/
|
||||||
void Set(BaseFaceType * const fp, int const zp, VertexType * const vp)
|
void Set(FaceType * const fp, int const zp, VertexType * const vp)
|
||||||
{
|
{
|
||||||
f=fp;z=zp;v=vp;
|
f=fp;z=zp;v=vp;
|
||||||
assert(f->V((z+2)%3)!=v && (f->V((z+1)%3)==v || f->V((z+0)%3)==v));
|
assert(f->V((z+2)%3)!=v && (f->V((z+1)%3)==v || f->V((z+0)%3)==v));
|
||||||
|
@ -268,7 +273,7 @@ public:
|
||||||
void Assert()
|
void Assert()
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
{
|
{
|
||||||
BasePosType ht=*this;
|
FaceType ht=*this;
|
||||||
ht.FlipF();
|
ht.FlipF();
|
||||||
ht.FlipF();
|
ht.FlipF();
|
||||||
assert(ht==*this);
|
assert(ht==*this);
|
||||||
|
@ -312,7 +317,7 @@ public:
|
||||||
This class is used as an iterator over the VF adjacency.
|
This class is used as an iterator over the VF adjacency.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <typename FaceType>
|
template <class FaceType>
|
||||||
class VFIterator
|
class VFIterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -320,25 +325,25 @@ public:
|
||||||
/// The vertex type
|
/// The vertex type
|
||||||
typedef typename FaceType::VertexType VertexType;
|
typedef typename FaceType::VertexType VertexType;
|
||||||
/// The Base face type
|
/// The Base face type
|
||||||
typedef typename FaceType::BaseFaceType BaseFaceType;
|
typedef typename FaceType::FaceType FaceType;
|
||||||
/// The vector type
|
/// The vector type
|
||||||
typedef typename VertexType::CoordType CoordType;
|
typedef typename VertexType::CoordType CoordType;
|
||||||
/// The scalar type
|
/// The scalar type
|
||||||
typedef typename VertexType::ScalarType ScalarType;
|
typedef typename VertexType::ScalarType ScalarType;
|
||||||
|
|
||||||
/// Pointer to the face of the half-edge
|
/// Pointer to the face of the half-edge
|
||||||
typename FaceType::BaseFaceType *f;
|
typename FaceType::FaceType *f;
|
||||||
/// Index of the edge
|
/// Index of the vertex
|
||||||
int z;
|
int z;
|
||||||
|
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
VFIterator(){}
|
VFIterator(){}
|
||||||
/// Constructor which associates the half-edge elementet with a face, its edge and its vertex
|
/// Constructor which associates the half-edge elementet with a face and its vertex
|
||||||
VFIterator(VertexType * const vp){f=vp->VFb();z=vp->VFi();}
|
VFIterator(FaceType * _f, const int & _z){f = _f; z = _z;}
|
||||||
|
|
||||||
bool End() const {return f==0;}
|
bool End() const {return f==0;}
|
||||||
BaseFaceType *operator++() {
|
FaceType *operator++() {
|
||||||
BaseFaceType* t = f;
|
FaceType* t = f;
|
||||||
f = t->VFp(z);
|
f = t->VFp(z);
|
||||||
z = t->VFi(z);
|
z = t->VFi(z);
|
||||||
return f;
|
return f;
|
||||||
|
|
Loading…
Reference in New Issue