*** empty log message ***

This commit is contained in:
Paolo Cignoni 2006-08-23 15:29:44 +00:00
parent 3cd4a11422
commit 4c34a7674c
2 changed files with 49 additions and 36 deletions

View File

@ -24,6 +24,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.8 2006/03/27 04:18:35 cignoni
Double->Scalar in dodecahedron
Revision 1.7 2006/01/30 08:09:05 cignoni
Corrected Grid
@ -330,14 +333,15 @@ void Hexahedron(MeshType &in)
VertexPointer ivp[8];
VertexIterator vi=in.vert.begin();
ivp[0]=&*vi;(*vi).P()=CoordType (-1,-1,-1); ++vi;
ivp[1]=&*vi;(*vi).P()=CoordType ( 1,-1,-1); ++vi;
ivp[2]=&*vi;(*vi).P()=CoordType (-1, 1,-1); ++vi;
ivp[3]=&*vi;(*vi).P()=CoordType ( 1, 1,-1); ++vi;
ivp[4]=&*vi;(*vi).P()=CoordType (-1,-1, 1); ++vi;
ivp[5]=&*vi;(*vi).P()=CoordType ( 1,-1, 1); ++vi;
ivp[6]=&*vi;(*vi).P()=CoordType (-1, 1, 1); ++vi;
ivp[7]=&*vi;(*vi).P()=CoordType ( 1, 1, 1);
ivp[7]=&*vi;(*vi).P()=CoordType (-1,-1,-1); ++vi;
ivp[6]=&*vi;(*vi).P()=CoordType ( 1,-1,-1); ++vi;
ivp[5]=&*vi;(*vi).P()=CoordType (-1, 1,-1); ++vi;
ivp[4]=&*vi;(*vi).P()=CoordType ( 1, 1,-1); ++vi;
ivp[3]=&*vi;(*vi).P()=CoordType (-1,-1, 1); ++vi;
ivp[2]=&*vi;(*vi).P()=CoordType ( 1,-1, 1); ++vi;
ivp[1]=&*vi;(*vi).P()=CoordType (-1, 1, 1); ++vi;
ivp[0]=&*vi;(*vi).P()=CoordType ( 1, 1, 1);
FaceIterator fi=in.face.begin();
(*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2]; ++fi;
@ -393,20 +397,20 @@ void Sphere(MeshType &in, const int subdiv = 3 )
typedef typename MeshType::FaceIterator FaceIterator;
if(in.vn==0 && in.fn==0) Icosahedron(in);
VertexIterator vi;
for(vi = in.vert.begin(); vi!=in.vert.end();++vi)
vi->P().Normalize();
VertexIterator vi;
for(vi = in.vert.begin(); vi!=in.vert.end();++vi)
vi->P().Normalize();
tri::UpdateFlags<MeshType>::FaceBorderFromNone(in);
int lastsize = 0;
for(int i=0;i<subdiv;++i)
tri::UpdateFlags<MeshType>::FaceBorderFromNone(in);
size_t lastsize = 0;
for(int i = 0 ; i < subdiv; ++i)
{
Refine<MeshType, MidPoint<MeshType> >(in,MidPoint<MeshType>(),0);
for(vi = in.vert.begin()+lastsize;vi!=in.vert.end();++vi)
vi->P().Normalize();
Refine< MeshType, MidPoint<MeshType> >(in, MidPoint<MeshType>(), 0);
for(vi = in.vert.begin() + lastsize; vi != in.vert.end(); ++vi)
vi->P().Normalize();
lastsize = in.vert.size();
}
}

View File

@ -185,7 +185,14 @@ void Set( const FacePointer pf, const int nz )
v[1] = pf->V((nz+1)%3);
assert(v[0] != v[1]);
if( v[0] > v[1] ) swap(v[0],v[1]);
if( v[0] > v[1] )
{
// swap(v[0],v[1]);
VertexPointer t = v[0];
v[0] = v[1];
v[1] = t;
}
f = pf;
z = nz;
}
@ -234,19 +241,22 @@ static void FaceBorderFromNone(MeshType &m)
sort(e.begin(), e.end()); // Lo ordino per vertici
typename std::vector<EdgeSorter>::iterator pe,ps;
for(ps = e.begin(), pe=e.begin(); pe<=e.end(); ++pe) // Scansione vettore ausiliario
for(ps = e.begin(), pe = e.begin(); pe != e.end(); ++pe) // Scansione vettore ausiliario
{
if( pe==e.end() || *pe != *ps ) // Trovo blocco di edge uguali
if( pe == e.end() || *pe != *ps ) // Trovo blocco di edge uguali
{
if(pe-ps==1) {
if(pe - ps == 1)
{
//++nborder;
ps->f->SetB(ps->z);
} else
if(pe-ps!=2) { // Caso complex!!
for(;ps!=pe;++ps)
}
else if (pe - ps != 2)
{ // Caso complex!!
for(; ps != pe; ++ps)
ps->f->SetB(ps->z); // Si settano border anche i complex.
}
ps = pe;
// ++ne; // Aggiorno il numero di edge
}
}
@ -254,7 +264,7 @@ static void FaceBorderFromNone(MeshType &m)
}
/// Compute the PerVertex Border flag deriving it from the faces
/// Bisogna carlcolare il border flag delle facce
static void VertexBorderFromFace(MeshType &m)
{
assert(HasPerFaceFlags(m));
@ -265,15 +275,14 @@ static void VertexBorderFromFace(MeshType &m)
(*v).ClearB();
for(f=m.face.begin();f!=m.face.end();++f)
if(!(*f).IsD())
{
for(int z=0;z<3;++z)
if( (*f).IsB(z) )
{
(*f).V0(z)->SetB();
(*f).V1(z)->SetB();
}
}
{
for(int z=0;z<3;++z)
if( (*f).IsB(z) )
{
(*f).V0(z)->SetB();
(*f).V1(z)->SetB();
}
}
}