Changed to trisplit to make it c++ 01 compliant

This commit is contained in:
Paolo Cignoni 2014-03-04 17:18:03 +00:00
parent dc71da4424
commit 323362697a
2 changed files with 236 additions and 229 deletions

View File

@ -239,7 +239,7 @@ int main(int argc,char ** argv){
{
f1=f2;
f2++;
TriSplit<MyMesh,CenterPoint<MyMesh> >(vf[i],&(*f1),&(*f2),&(*vertp),CenterPoint<MyMesh>() );
TriSplit<MyMesh,CenterPointBarycenter<MyMesh> >::Apply(vf[i],&(*f1),&(*f2),&(*vertp),CenterPointBarycenter<MyMesh>() );
f1->SetS();
f2->SetS();
for(int itr=0;itr<3;itr++)

View File

@ -882,14 +882,20 @@ struct CenterPointBarycenter : public std::unary_function<typename TRIMESH_TYPE:
template<class TRIMESH_TYPE, class CenterPoint=CenterPointBarycenter <TRIMESH_TYPE> >
void TriSplit(typename TRIMESH_TYPE::FacePointer f,
typename TRIMESH_TYPE::FacePointer f1,typename TRIMESH_TYPE::FacePointer f2,
typename TRIMESH_TYPE::VertexPointer vB, CenterPoint Center)
class TriSplit
{
public:
typedef typename TRIMESH_TYPE::FaceType FaceType;
typedef typename TRIMESH_TYPE::VertexType VertexType;
static void Apply(FaceType *f,
FaceType * f1,FaceType * f2,
VertexType * vB, CenterPoint Center)
{
vB->P() = Center(f);
//i tre vertici della faccia da dividere
typename TRIMESH_TYPE::VertexType* V0,*V1,*V2;
VertexType *V0,*V1,*V2;
V0 = f->V(0);
V1 = f->V(1);
V2 = f->V(2);
@ -912,7 +918,7 @@ void TriSplit(typename TRIMESH_TYPE::FacePointer f,
f->FFp(2)->FFp(f->FFi(2)) = f2;
//adiacenza ff
typename TRIMESH_TYPE::FacePointer FF0,FF1,FF2;
FaceType * FF0,*FF1,*FF2;
FF0 = f->FFp(0);
FF1 = f->FFp(1);
FF2 = f->FFp(2);
@ -949,7 +955,8 @@ void TriSplit(typename TRIMESH_TYPE::FacePointer f,
(*f2).FFp(2) = FF2;
(*f2).FFi(2) = FFi2;
}
}
}
}; // end class TriSplit
} // namespace tri
} // namespace vcg