ImportLocal to ImportData. Adjacencies are no more handle by ImportData, but

by speficic functions in append.h (ImportPerxxxAdj(..))
This commit is contained in:
ganovelli 2010-06-16 16:29:07 +00:00
parent d0bdf4665f
commit e92adc2095
2 changed files with 11 additions and 10 deletions

View File

@ -369,15 +369,15 @@ static void MakePureByRefine(MeshType &m){
assert(nvi!=m.vert.end()); assert(nvi!=m.vert.end());
VertexType *nv = &*nvi; nvi++; VertexType *nv = &*nvi; nvi++;
//*nv = *fi->V0( 0 ); // lazy: copy everything from the old vertex //*nv = *fi->V0( 0 ); // lazy: copy everything from the old vertex
nv->ImportLocal(*(fi->V0( 0 ))); // lazy: copy everything from the old vertex nv->ImportData(*(fi->V0( 0 ))); // lazy: copy everything from the old vertex
nv->P() = ( fi->V(0)->P() + fi->V(1)->P() + fi->V(2)->P() ) /3.0; nv->P() = ( fi->V(0)->P() + fi->V(1)->P() + fi->V(2)->P() ) /3.0;
FaceType *fa = &*fi; FaceType *fa = &*fi;
FaceType *fb = &*nfi; nfi++; FaceType *fb = &*nfi; nfi++;
FaceType *fc = &*nfi; nfi++; FaceType *fc = &*nfi; nfi++;
fb->ImportLocal(*fa); CopyTopology(fb,fa); fb->ImportData(*fa); CopyTopology(fb,fa);
fc->ImportLocal(*fa); CopyTopology(fc,fa); fc->ImportData(*fa); CopyTopology(fc,fa);
fa->V(0) = nv; fa->V(0) = nv;
fb->V(1) = nv; fb->V(1) = nv;
@ -443,7 +443,7 @@ static void MakePureByRefine(MeshType &m){
assert(nvi!=m.vert.end()); assert(nvi!=m.vert.end());
VertexType *nv = &*nvi; nvi++; VertexType *nv = &*nvi; nvi++;
// *nv = * fa->V0( ea2 ); // *nv = * fa->V0( ea2 );
nv->ImportLocal(*(fa->V0( ea2 ) )); // lazy: copy everything from the old vertex nv->ImportData(*(fa->V0( ea2 ) )); // lazy: copy everything from the old vertex
//nv->P() = ( fa->V(ea2)->P() + fa->V(ea0)->P() ) /2.0; //nv->P() = ( fa->V(ea2)->P() + fa->V(ea0)->P() ) /2.0;
Interpolator::Apply(*(fa->V(ea2)),*(fa->V(ea0)),0.5,*nv); Interpolator::Apply(*(fa->V(ea2)),*(fa->V(ea0)),0.5,*nv);
// split faces: add 2 faces (one per side) // split faces: add 2 faces (one per side)
@ -452,8 +452,8 @@ static void MakePureByRefine(MeshType &m){
assert(nfi!=m.face.end()); assert(nfi!=m.face.end());
FaceType *fd = &*nfi; nfi++; FaceType *fd = &*nfi; nfi++;
fc->ImportLocal(*fa ); CopyTopology(fc,fa); // lazy: copy everything from the old vertex fc->ImportData(*fa ); CopyTopology(fc,fa); // lazy: copy everything from the old vertex
fd->ImportLocal(*fb ); CopyTopology(fd,fb);// lazy: copy everything from the old vertex fd->ImportData(*fb ); CopyTopology(fd,fb);// lazy: copy everything from the old vertex
fa->V(ea2) = fc->V(ea0) = fa->V(ea2) = fc->V(ea0) =
fb->V(eb2) = fd->V(eb0) = nv ; fb->V(eb2) = fd->V(eb0) = nv ;
@ -547,13 +547,13 @@ static void MakePureByRefine(MeshType &m){
// create new vert in center of faux edge // create new vert in center of faux edge
VertexType *nv = &*nvi; nvi++; VertexType *nv = &*nvi; nvi++;
//*nv = * fa->V0( ea2 ); //*nv = * fa->V0( ea2 );
nv->ImportLocal(*(fa->V0( ea2 ) )); // lazy: copy everything from the old vertex nv->ImportData(*(fa->V0( ea2 ) )); // lazy: copy everything from the old vertex
nv->P() = ( fa->V(ea2)->P() + fa->V(ea0)->P() ) /2.0; nv->P() = ( fa->V(ea2)->P() + fa->V(ea0)->P() ) /2.0;
Interpolator::Apply(*(fa->V(ea2)),*(fa->V(ea0)),0.5,*nv); Interpolator::Apply(*(fa->V(ea2)),*(fa->V(ea0)),0.5,*nv);
// split face: add 1 face // split face: add 1 face
FaceType *fc = &*nfi; nfi++; FaceType *fc = &*nfi; nfi++;
fc->ImportLocal(*fa);CopyTopology(fc,fa); // lazy: copy everything from the old vertex fc->ImportData(*fa);CopyTopology(fc,fa); // lazy: copy everything from the old vertex
fa->V(ea2) = fc->V(ea0) = nv ; fa->V(ea2) = fc->V(ea0) = nv ;

View File

@ -337,7 +337,7 @@ namespace vcg
} }
} }
if( HasHEAdjacency(m) ) if( HasHEAdjacency(m) && (m.en!=0))
{ {
if( ! ep->HEp()) if( ! ep->HEp())
return false; //halfedge must point to an edge return false; //halfedge must point to an edge
@ -363,6 +363,7 @@ namespace vcg
if( ep->HNp()->IsD()) if( ep->HNp()->IsD())
return false; // return false; //
if(hasHP)
if( ep->HNp()->HPp() != ep) if( ep->HNp()->HPp() != ep)
return false; // return false; //