*** empty log message ***

This commit is contained in:
Nico Pietroni 2005-04-22 09:23:09 +00:00
parent 51040fd364
commit b7fb150c46
2 changed files with 24 additions and 19 deletions

View File

@ -32,10 +32,10 @@ int main( int argc, char ** argv )
#ifdef _TORUS #ifdef _TORUS
//w.simpleGLWidget1->SetExtractionParameters(); //w.simpleGLWidget1->SetExtractionParameters();
//s->SetSegmentParameters(10,0.5f,0.2f,0.8f,0.4f,3.f,vcg::Point3f(1.f,1.f,1.f),1000,15); //s->SetSegmentParameters(10,0.5f,0.2f,0.8f,0.4f,3.f,vcg::Point3f(1.f,1.f,1.f),1000,15);
s->SetSegmentParameters(10,0.5f,0.8f,0.65f,0.4f,3.f,vcg::Point3f(1.f,1.f,1.f),1000,15); s->SetSegmentParameters(10,0.5f,0.8f,0.8f,0.2f,3.f,vcg::Point3f(1.f,1.f,1.f),1000,15);
s->BBox().min=Point3f(-40.f,-40.f,-40.f); s->BBox().min=Point3f(-40.f,-40.f,-40.f);
s->BBox().max=Point3f(40.f,40.f,40.f); s->BBox().max=Point3f(40.f,40.f,40.f);
s->InitSegmentation(Point3f(0.f,25.f,0.f)); s->InitSegmentation(Point3f(-25.f,0.f,0.f));
w.simpleGLWidget1->CenterExtraction=vcg::Point3f(0.f,-25.f,0.f); w.simpleGLWidget1->CenterExtraction=vcg::Point3f(0.f,-25.f,0.f);
s->gray_init=100; s->gray_init=100;
#endif #endif

View File

@ -157,7 +157,11 @@ public:
ScalarType ForceValue(ScalarType l0,ScalarType l1) ScalarType ForceValue(ScalarType l0,ScalarType l1)
{ {
return ((l0-l1)/(l0/l1) *_k); ScalarType diff=(l0-l1);
if (diff>0)//compression
return ((diff/l1)*_k);
else
return (diff *_k);
} }
///update of the internal forces using the dihedral angle ///update of the internal forces using the dihedral angle
@ -203,18 +207,18 @@ public:
} }
} }
///area changing constrain penalize area goes to zero ////area changing constrain penalize area goes to zero
CoordType m0=(V(0)->P()+V(1)->P())/2.f; //CoordType m0=(V(0)->P()+V(1)->P())/2.f;
CoordType m1=(V(1)->P()+V(2)->P())/2.f; //CoordType m1=(V(1)->P()+V(2)->P())/2.f;
CoordType m2=(V(2)->P()+V(0)->P())/2.f; //CoordType m2=(V(2)->P()+V(0)->P())/2.f;
m0=(V(2)->P()-m0).Normalize();//directions //m0=(V(2)->P()-m0).Normalize();//directions
m1=(V(0)->P()-m1).Normalize(); //m1=(V(0)->P()-m1).Normalize();
m2=(V(1)->P()-m2).Normalize(); //m2=(V(1)->P()-m2).Normalize();
ScalarType FArea=AreaRep/Area()*_k; //ScalarType FArea=((ScalarType)1/AreaRep-Area())*_k;
V(0)->IntForce()+=m0*FArea/3.f; //V(0)->IntForce()+=m0*FArea/3.f;
V(1)->IntForce()+=m1*FArea/3.f; //V(1)->IntForce()+=m1*FArea/3.f;
V(2)->IntForce()+=m2*FArea/3.f; //V(2)->IntForce()+=m2*FArea/3.f;
///end area constrain ////end area constrain
return(__super::Update()); return(__super::Update());
///new ///new
@ -357,18 +361,19 @@ private:
return (fatt2<=conf); return (fatt2<=conf);
} }
float getColor(MyTriMesh::CoordType p) float getColor(MyTriMesh::CoordType p)
{ {
MyTriMesh::CoordType p1=MyTriMesh::CoordType(p.X(),p.Z(),p.Y()); MyTriMesh::CoordType p1=MyTriMesh::CoordType(p.X(),p.Z(),p.Y());
//MyTriMesh::CoordType p2=MyTriMesh::CoordType(p.Z(),p.Y(),p.X()); MyTriMesh::CoordType p2=MyTriMesh::CoordType(p.Z(),p.Y(),p.X());
if (InTorus(p)||InTorus(p1)||InTorus(p2))
if (InTorus(p)||InTorus(p1))//||InTorus(p2))
return (100.f); return (100.f);
else else
return (0.f); return (0.f);
} }
#else #else
///return integer coordinete in volumetric dataset ///return integer coordinete in volumetric dataset
float getColor(MyTriMesh::CoordType p) float getColor(MyTriMesh::CoordType p)