Removed two old useless wrong stupid functions that have been left into wrap/trimesh.h for unforgivable lazyness...

This commit is contained in:
Paolo Cignoni 2012-10-08 05:30:34 +00:00
parent a2f65f19ca
commit 194d9eb4d7
1 changed files with 0 additions and 176 deletions

View File

@ -872,182 +872,6 @@ void DrawBBox(ColorMode cm)
};// end class };// end class
/*
Crease Angle
Assume che:
la mesh abbia la topologia ff
la mesh non abbia complex (o se li aveva fossero stati detached)
Abbia le normali per faccia normalizzate!!
Prende una mesh e duplica tutti gli edge le cui normali nelle facce incidenti formano un angolo maggiore
di <angle> (espresso in rad).
foreach face
foreach unvisited vert vi
scan the star of triangles around vi duplicating vi each time we encounter a crease angle.
the new (and old) vertexes are put in a std::vector that is swapped with the original one at the end.
*/
// uncomment one of the following line to enable the Verbose Trace for Crease
#define VCTRACE (void)0
//#define VCTRACE TRACE
template<class MESH_TYPE>
void Crease(MESH_TYPE &m, typename MESH_TYPE::scalar_type angleRad)
{
assert(HasFFTopology(m));
typename MESH_TYPE::scalar_type cosangle=Cos(angleRad);
std::vector<GLW::VertToSplit<MESH_TYPE> > SPL;
std::vector<typename MESH_TYPE::VertexType> newvert;
newvert.reserve(m.fn*3);
// indica se un il vertice z della faccia e' stato processato
enum {VISITED_0= MESH_TYPE::FaceType::USER0,
VISITED_1= MESH_TYPE::FaceType::USER0<<1,
VISITED_2= MESH_TYPE::FaceType::USER0<<2} ;
int vis[3]={VISITED_0,VISITED_1,VISITED_2};
//int _t2=clock();
typename MESH_TYPE::FaceIterator fi;
for(fi=m.face.begin();fi!=m.face.end();++fi)
if(!(*fi).IsD()) (*fi).Supervisor_Flags()&= (~(VISITED_0 | VISITED_1 | VISITED_2));
for(fi=m.face.begin();fi!=m.face.end();++fi)
if(!(*fi).IsD())
for(int j=0;j<3;++j)
if(!((*fi).Supervisor_Flags() & (vis[j])))
{
//VCTRACE("Face %i Spinning around vertex %i\n",fi-m.face.begin(), (*fi).V(j)-m.vert.begin());
//(*fi).Supervisor_Flags() |= vis[j];
typename MESH_TYPE::hedgepos_type he(&*fi,j,(*fi).V(j));
typename MESH_TYPE::hedgepos_type she=he;
typename MESH_TYPE::face_base_pointer nextf;
GLW::VertToSplit<MESH_TYPE> spl;
spl.newp=false;
spl.edge=-1;
//Primo giro per trovare un bordo da cui partire
do {
he.FlipF();
he.FlipE();
if(he.IsBorder()) break;
} while(he!=she);
if(he==she) // non c'e'bordi allora si cerca un crease
{
do {
he.FlipF();
he.FlipE();
nextf=he.f->F(he.z);
typename MESH_TYPE::scalar_type ps=nextf->N()*he.f->N();
if(ps<cosangle) break;
int vz=0;
if(he.v == he.f->V(he.z)) vz=he.z;
if(he.v == he.f->V((he.z+1)%3)) vz=(he.z+1)%3;
assert((he.f->Supervisor_Flags() & vis[vz] )==0);
} while(he!=she);
}
he.FlipE();
she=he;
newvert.push_back(*(*fi).V(j));
typename MESH_TYPE::vertex_pointer curvert=&newvert.back();
// VCTRACE("Starting from face %i edge %i vert %i \n",he.f-m.face.begin(), he.z, he.v-m.vert.begin());
// Secondo giro in cui si riempie il vettore SPL con tutte le info per fare i nuovi vertici
do{
//TRACE(" -- spinning face %i edge %i vert %i\n",he.f-m.face.begin(), he.z, he.v-m.vert.begin());
spl.v=curvert;
spl.f=he.f;
spl.z=-1;
if(he.v == he.f->V(he.z)) spl.z=he.z;
if(he.v == he.f->V((he.z+1)%3)) spl.z=(he.z+1)%3;
assert(spl.z>=0);
//VCTRACE(" -- spinning face vert %i Adding spl face %i vert %i\n",
// he.v-m.vert.begin(), spl.f-m.face.begin(), spl.z );
assert((spl.f->Supervisor_Flags() & vis[spl.z] )==0);
spl.f->Supervisor_Flags() |= vis[spl.z];
SPL.push_back(spl);
spl.newp=false;
spl.edge=-1;
if(he.IsBorder()) break;
nextf=he.f->F(he.z);
if(nextf==she.f) break;
typename MESH_TYPE::scalar_type ps=nextf->N()*he.f->N();
if(ps<cosangle){
// VCTRACE("splitting faces %i-%i edge %i vert %i\n",nextf-m.face.begin(),he.f-m.face.begin(), he.z, he.v-m.vert.begin());
newvert.push_back(*(he.v));
curvert=&newvert.back();
spl.newp=true;
//spl.edge=he.z;
}
he.FlipF();
if(spl.newp) spl.edge=he.z;
he.FlipE();
}while(he!=she);
}
assert(SPL.size()==m.fn*3);
typename std::vector<GLW::VertToSplit<MESH_TYPE> >::iterator vsi;
for(vsi=SPL.begin();vsi!=SPL.end();++vsi)
{
(*vsi).f->V((*vsi).z)=(*vsi).v;
if((*vsi).newp){
assert((*vsi).edge>=0 && (*vsi).edge<3);
if(!(*vsi).f->IsBorder( (*vsi).edge) )
(*vsi).f->Detach((*vsi).edge);
}
}
m.vert.math::Swap(newvert);
m.vn=m.vert.size();
}
/*
Secondo tipo di crease angle. ha bisogno del per wedge normal
e delle adiacence per vertice faccia gia fatte;
Assume che le normali per faccia siano gia'state fatte (se ci sono)
*/
/*template<class MESH_TYPE>
void CreaseWN(MESH_TYPE &m, typename MESH_TYPE::scalar_type angle)
{
if(!(MESH_TYPE::FaceType::OBJ_TYPE & MESH_TYPE::FaceType::OBJ_TYPE_WN) )
{
assert(0); // You needs a mesh with faces having per wedge normals
return;
}
typename MESH_TYPE::scalar_type cosangle=Cos(angle);
typename MESH_TYPE::FaceIterator fi;
// Clear the per wedge normals
for(fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD())
{
(*fi).WN(0)=MESH_TYPE::vectorial_type(0,0,0);
(*fi).WN(1)=MESH_TYPE::vectorial_type(0,0,0);
(*fi).WN(2)=MESH_TYPE::vectorial_type(0,0,0);
}
typename MESH_TYPE::FaceType::vectorial_type nn;
for(fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD())
{
nn=(*fi).cN();
for(int i=0;i<3;++i)
{
VEdgePosB<MESH_TYPE::FaceType::face_base> x;
for(x.f = (*fi).V(i)->Fp(), x.z = (*fi).V(i)->Zp(); x.f!=0; x.NextF() ) {
assert(x.f->V(x.z)==(*fi).V(i));
if(x.f->cN()*nn > cosangle) x.f->WN(x.z)+=nn;
}
}
}
}*/
} // end namespace } // end namespace
#endif #endif