modified test topology funtion and added function to test VT topology
This commit is contained in:
parent
f682054c6d
commit
57294c89e0
|
@ -31,6 +31,7 @@ Initial commit
|
||||||
#ifndef __VCG_TETRA_UPDATE_TOPOLOGY
|
#ifndef __VCG_TETRA_UPDATE_TOPOLOGY
|
||||||
#define __VCG_TETRA_UPDATE_TOPOLOGY
|
#define __VCG_TETRA_UPDATE_TOPOLOGY
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <vcg\simplex\tetrahedron\pos.h>
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
namespace tetra {
|
namespace tetra {
|
||||||
|
@ -241,26 +242,26 @@ void DetachVTTopology(VertexType *v,TetraType *t)
|
||||||
{
|
{
|
||||||
TetraType *lastt;
|
TetraType *lastt;
|
||||||
int lastz;
|
int lastz;
|
||||||
EdgePosT<TetraType> Et(v->Fp(),v->Zp());
|
VTIterator<TetraType> Et(v->VTb(),v->VTi());
|
||||||
if (Et.t==t)
|
if (Et.Vt()==t)
|
||||||
{
|
{
|
||||||
v->Fp()=(TetraType *)t->tv[v->Zp()];
|
v->VTb()=(TetraType *)t->TVp(v->VTi());
|
||||||
v->Zp()=t->zv[v->Zp()];
|
v->VTi()=t->TVi(v->VTi());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lastz=Et.z;
|
lastz=Et.Vi();
|
||||||
while((Et.t!=t)&&(Et.t!=NULL))
|
while((Et.Vt()!=t)&&(!Et.End()))
|
||||||
{
|
{
|
||||||
lastz=Et.z;
|
lastz=Et.Vi();
|
||||||
lastt=Et.t;
|
lastt=Et.Vt();
|
||||||
Et.NextT();
|
Et++;
|
||||||
}
|
}
|
||||||
//in the list of the vertex v must be present the
|
//in the list of the vertex v must be present the
|
||||||
//tetrahedron that you want to detach
|
//tetrahedron that you want to detach
|
||||||
assert(Et.t!=NULL);
|
assert(Et.Vt()!=NULL);
|
||||||
lastt->tv[lastz]=Et.t->tv[Et.z];
|
lastt->TVp(lastz)=Et.Vt()->TVp(Et.Vi());
|
||||||
lastt->zv[lastz]=Et.t->zv[Et.z];
|
lastt->TVi(lastz)=Et.Vt()->TVi(Et.Vi());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,10 +270,10 @@ void InsertVTTopology(VertexType *v,int z,TetraType *t)
|
||||||
{
|
{
|
||||||
if( ! (*t).IsD())
|
if( ! (*t).IsD())
|
||||||
{
|
{
|
||||||
(*t).tv[z] = v->Fp();
|
t->TVp(z) = v->VTb();
|
||||||
(*t).zv[z] = v->Zp();
|
t->TVi(z) = v->VTi();
|
||||||
v->Fp() = &(*t);
|
v->VTb() = &(*t);
|
||||||
v->Zp() = z;
|
v->VTi() = z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,6 +289,30 @@ void InsertVTTopology(TetraType *t)
|
||||||
InsertVTTopology(t->V(k),k,t);
|
InsertVTTopology(t->V(k),k,t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///Test the Tetrahedron-Tetrahedron Topology (by Face)
|
||||||
|
void TestVTTopology(VertexContainer &vert,TetraContainer &tetra)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (VertexIterator vi=vert.begin();vi!=vert.end();vi++)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!(*vi).IsD())
|
||||||
|
{
|
||||||
|
TetraType *nextT=vi->VTb();
|
||||||
|
int nextI=vi->VTi();
|
||||||
|
int oldI;
|
||||||
|
while(nextT!=NULL)
|
||||||
|
{
|
||||||
|
assert((nextT->V(nextI)==&(*vi)));
|
||||||
|
oldI=nextI;
|
||||||
|
nextI=nextT->TVi(nextI);
|
||||||
|
nextT=nextT->TVp(oldI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
/** @Tetrahedron-Tetrahedron Topology Funtions
|
/** @Tetrahedron-Tetrahedron Topology Funtions
|
||||||
|
@ -374,7 +399,7 @@ void TestTTTopology(VertexContainer &vert,TetraContainer &tetra)
|
||||||
{
|
{
|
||||||
for (i=0;i<4;i++)
|
for (i=0;i<4;i++)
|
||||||
{
|
{
|
||||||
if ((!(*ti).IsD())&&((*ti).TTp(i)!=&(*ti)))
|
if ((!(*ti).IsD()))
|
||||||
{
|
{
|
||||||
assert( ((((*ti).TTp(i))->TTp((*ti).TTi(i)))==&(*ti)));
|
assert( ((((*ti).TTp(i))->TTp((*ti).TTi(i)))==&(*ti)));
|
||||||
|
|
||||||
|
@ -383,6 +408,7 @@ void TestTTTopology(VertexContainer &vert,TetraContainer &tetra)
|
||||||
VertexType *v2=(*ti).V(Tetra3<double>::VofF(i,2));
|
VertexType *v2=(*ti).V(Tetra3<double>::VofF(i,2));
|
||||||
|
|
||||||
TetraType *t1=(TetraType*)(*ti).TTp(i);
|
TetraType *t1=(TetraType*)(*ti).TTp(i);
|
||||||
|
assert (!t1->IsD());
|
||||||
int z1=(*ti).TTi(i);
|
int z1=(*ti).TTi(i);
|
||||||
|
|
||||||
VertexType *vo0=(*t1).V(Tetra3<double>::VofF(z1,0));
|
VertexType *vo0=(*t1).V(Tetra3<double>::VofF(z1,0));
|
||||||
|
|
Loading…
Reference in New Issue