Merge branch 'devel' of https://github.com/cnr-isti-vclab/vcglib into devel
This commit is contained in:
commit
e50c8cbaae
|
@ -199,7 +199,7 @@ private:
|
||||||
|
|
||||||
//push the first one
|
//push the first one
|
||||||
SubDEdges.push_back(Edge0);
|
SubDEdges.push_back(Edge0);
|
||||||
for (size_t i=1;i<Nsub;i++)
|
for (int i=1;i<Nsub;i++)
|
||||||
{
|
{
|
||||||
//find angle interval
|
//find angle interval
|
||||||
ScalarType B=StepAngle*(ScalarType)i;
|
ScalarType B=StepAngle*(ScalarType)i;
|
||||||
|
@ -340,8 +340,8 @@ private:
|
||||||
IndexF1=(interval+1) % OriginalFace.size();
|
IndexF1=(interval+1) % OriginalFace.size();
|
||||||
alpha=1;
|
alpha=1;
|
||||||
}
|
}
|
||||||
assert((IndexF0>=0)&&(IndexF0<OriginalFace.size()));
|
assert((IndexF0>=0)&&(IndexF0<(int)OriginalFace.size()));
|
||||||
assert((IndexF1>=0)&&(IndexF1<OriginalFace.size()));
|
assert((IndexF1>=0)&&(IndexF1<(int)OriginalFace.size()));
|
||||||
|
|
||||||
FaceType* F0=OriginalFace[IndexF0];
|
FaceType* F0=OriginalFace[IndexF0];
|
||||||
FaceType* F1=OriginalFace[IndexF1];
|
FaceType* F1=OriginalFace[IndexF1];
|
||||||
|
@ -394,7 +394,7 @@ private:
|
||||||
const TriangleType &t0,
|
const TriangleType &t0,
|
||||||
const TriangleType &t1,
|
const TriangleType &t1,
|
||||||
CoordType &Interpolated,
|
CoordType &Interpolated,
|
||||||
size_t &Face)
|
int &Face)
|
||||||
{
|
{
|
||||||
//find smallest edge
|
//find smallest edge
|
||||||
ScalarType smallestE=std::numeric_limits<ScalarType>::max();
|
ScalarType smallestE=std::numeric_limits<ScalarType>::max();
|
||||||
|
@ -511,7 +511,7 @@ private:
|
||||||
directions.clear();
|
directions.clear();
|
||||||
faces.clear();
|
faces.clear();
|
||||||
|
|
||||||
for (size_t i=0;i<SwapV.size();i++)
|
for (int i=0;i<(int)SwapV.size();i++)
|
||||||
{
|
{
|
||||||
if (i==IndexDel)continue;
|
if (i==IndexDel)continue;
|
||||||
directions.push_back(SwapV[i]);
|
directions.push_back(SwapV[i]);
|
||||||
|
@ -619,7 +619,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
CoordType InterpDir;
|
CoordType InterpDir;
|
||||||
size_t tri_Index=-1;
|
int tri_Index=-1;
|
||||||
if ((versef0D1 * versef1D1) < ScalarType(0))
|
if ((versef0D1 * versef1D1) < ScalarType(0))
|
||||||
{
|
{
|
||||||
InterpolateDir(Dir1F0,Dir1F1,Bary0,Bary1,t0,t1,InterpDir,tri_Index);
|
InterpolateDir(Dir1F0,Dir1F1,Bary0,Bary1,t0,t1,InterpDir,tri_Index);
|
||||||
|
@ -636,7 +636,7 @@ public:
|
||||||
assert((tri_Index==0)||(tri_Index==1));
|
assert((tri_Index==0)||(tri_Index==1));
|
||||||
int OrigFIndex=((i+tri_Index)%SubFaces.size())/numSub;
|
int OrigFIndex=((i+tri_Index)%SubFaces.size())/numSub;
|
||||||
assert(OrigFIndex>=0);
|
assert(OrigFIndex>=0);
|
||||||
assert(OrigFIndex<OriginalFaces.size());
|
assert(OrigFIndex<(int)OriginalFaces.size());
|
||||||
|
|
||||||
FaceType* currF=OriginalFaces[OrigFIndex];
|
FaceType* currF=OriginalFaces[OrigFIndex];
|
||||||
//add the data
|
//add the data
|
||||||
|
@ -644,7 +644,7 @@ public:
|
||||||
faces.push_back(currF);
|
faces.push_back(currF);
|
||||||
}
|
}
|
||||||
if (expVal==-1)return directions.size();
|
if (expVal==-1)return directions.size();
|
||||||
if (directions.size()<=expVal)return directions.size();
|
if ((int)directions.size()<=expVal)return directions.size();
|
||||||
|
|
||||||
size_t sampledDir=directions.size();
|
size_t sampledDir=directions.size();
|
||||||
int to_erase=directions.size()-expVal;
|
int to_erase=directions.size()-expVal;
|
||||||
|
@ -700,7 +700,7 @@ public:
|
||||||
CoordType dirS=CrossVector(f0,dir0);
|
CoordType dirS=CrossVector(f0,dir0);
|
||||||
CoordType dirR=vcg::tri::CrossField<MeshType>::Rotate(f0,f1,dirS);
|
CoordType dirR=vcg::tri::CrossField<MeshType>::Rotate(f0,f1,dirS);
|
||||||
///then get the closest upf to K*PI/2 rotations
|
///then get the closest upf to K*PI/2 rotations
|
||||||
CoordType dir1=f1.cPD1();
|
//CoordType dir1=f1.cPD1();
|
||||||
//int ret=I_K_PI(dir1,dirR,f1.cN());
|
//int ret=I_K_PI(dir1,dirR,f1.cN());
|
||||||
CoordType dir[4];
|
CoordType dir[4];
|
||||||
CrossVector(f1,dir);
|
CrossVector(f1,dir);
|
||||||
|
@ -936,8 +936,8 @@ public:
|
||||||
const CoordType &t1=f.V(1)->PD1();
|
const CoordType &t1=f.V(1)->PD1();
|
||||||
const CoordType &t2=f.V(2)->PD1();
|
const CoordType &t2=f.V(2)->PD1();
|
||||||
const CoordType &N0=f.V(0)->N();
|
const CoordType &N0=f.V(0)->N();
|
||||||
const CoordType &N1=f.V(0)->N();
|
const CoordType &N1=f.V(1)->N();
|
||||||
const CoordType &N2=f.V(0)->N();
|
const CoordType &N2=f.V(2)->N();
|
||||||
const CoordType &NF=f.N();
|
const CoordType &NF=f.N();
|
||||||
const CoordType bary=CoordType(0.33333,0.33333,0.33333);
|
const CoordType bary=CoordType(0.33333,0.33333,0.33333);
|
||||||
CoordType tF0,tF1;
|
CoordType tF0,tF1;
|
||||||
|
@ -948,7 +948,9 @@ public:
|
||||||
SetCrossVector(f,tF0,tF1);
|
SetCrossVector(f,tF0,tF1);
|
||||||
|
|
||||||
//then set the magnitudo
|
//then set the magnitudo
|
||||||
ScalarType mag1,mag2;
|
ScalarType mag1=0;
|
||||||
|
ScalarType mag2=0;
|
||||||
|
|
||||||
for (int i=0;i<3;i++)
|
for (int i=0;i<3;i++)
|
||||||
{
|
{
|
||||||
vcg::Matrix33<ScalarType> rotN=vcg::RotationMatrix(f.V(i)->N(),f.N());
|
vcg::Matrix33<ScalarType> rotN=vcg::RotationMatrix(f.V(i)->N(),f.N());
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include <vcg/complex/algorithms/closest.h>
|
#include <vcg/complex/algorithms/closest.h>
|
||||||
#include <vcg/complex/algorithms/point_sampling.h>
|
#include <vcg/complex/algorithms/point_sampling.h>
|
||||||
|
|
||||||
|
#include <wrap/io_trimesh/export_obj.h>
|
||||||
|
|
||||||
//define a temporary triangle mesh type
|
//define a temporary triangle mesh type
|
||||||
class TempFace;
|
class TempFace;
|
||||||
class TempVertex;
|
class TempVertex;
|
||||||
|
@ -169,8 +171,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
static bool CollapseBorderSmallEdgesStep(PolyMeshType &poly_m,
|
static bool CollapseBorderSmallEdgesStep(PolyMeshType &poly_m,
|
||||||
const ScalarType edge_limit,
|
const ScalarType edge_limit)
|
||||||
ScalarType angleDeg=100)
|
|
||||||
{
|
{
|
||||||
//update topology
|
//update topology
|
||||||
vcg::tri::UpdateTopology<PolyMeshType>::FaceFace(poly_m);
|
vcg::tri::UpdateTopology<PolyMeshType>::FaceFace(poly_m);
|
||||||
|
@ -356,11 +357,19 @@ public:
|
||||||
vcg::GetPolyTemplatePos(f,TemplatePos,true);
|
vcg::GetPolyTemplatePos(f,TemplatePos,true);
|
||||||
|
|
||||||
CoordType NormT=Normal(TemplatePos);
|
CoordType NormT=Normal(TemplatePos);
|
||||||
|
|
||||||
//get the normal of vertices
|
//get the normal of vertices
|
||||||
CoordType AVN(0,0,0);
|
//CoordType AVN(0,0,0);
|
||||||
|
//CoordType AVN0(0,0,0);
|
||||||
CoordType Origin(0,0,0);
|
CoordType Origin(0,0,0);
|
||||||
for (int j=0;j<f.VN();j++)
|
// for (int j=0;j<f.VN();j++)
|
||||||
AVN+=f.V(j)->N();
|
// AVN0=AVN0+f.V(j)->N();
|
||||||
|
|
||||||
|
CoordType AVN=vcg::PolygonNormal(f);
|
||||||
|
//AVN0.Normalize();
|
||||||
|
// std::cout<<"AVN "<<AVN.X()<<","<<AVN.Y()<<","<<AVN.Z()<<std::endl;
|
||||||
|
// std::cout<<"AVN0 "<<AVN0.X()<<","<<AVN0.Y()<<","<<AVN0.Z()<<std::endl;
|
||||||
|
// std::cout<<"NormT "<<NormT.X()<<","<<NormT.Y()<<","<<NormT.Z()<<std::endl;
|
||||||
|
|
||||||
for (size_t j=0;j<TemplatePos.size();j++)
|
for (size_t j=0;j<TemplatePos.size();j++)
|
||||||
Origin+=TemplatePos[j];
|
Origin+=TemplatePos[j];
|
||||||
|
@ -374,9 +383,9 @@ public:
|
||||||
//apply transformation
|
//apply transformation
|
||||||
for (size_t j=0;j<TemplatePos.size();j++)
|
for (size_t j=0;j<TemplatePos.size();j++)
|
||||||
{
|
{
|
||||||
TemplatePos[j]-=Origin;
|
TemplatePos[j]=TemplatePos[j]-Origin;
|
||||||
TemplatePos[j]=Rot*TemplatePos[j];
|
TemplatePos[j]=Rot*TemplatePos[j];
|
||||||
TemplatePos[j]+=Origin;
|
TemplatePos[j]=TemplatePos[j]+Origin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,12 +411,15 @@ public:
|
||||||
|
|
||||||
ScalarType AvgArea=MeshArea/(ScalarType)poly_m.face.size();
|
ScalarType AvgArea=MeshArea/(ScalarType)poly_m.face.size();
|
||||||
|
|
||||||
|
PolyMeshType TestM;
|
||||||
|
|
||||||
for (size_t s=0;s<(size_t)relax_step;s++)
|
for (size_t s=0;s<(size_t)relax_step;s++)
|
||||||
{
|
{
|
||||||
//initialize the accumulation vector
|
//initialize the accumulation vector
|
||||||
std::vector<CoordType> avgPos(poly_m.vert.size(),CoordType(0,0,0));
|
std::vector<CoordType> avgPos(poly_m.vert.size(),CoordType(0,0,0));
|
||||||
std::vector<ScalarType> weightSum(poly_m.vert.size(),0);
|
std::vector<ScalarType> weightSum(poly_m.vert.size(),0);
|
||||||
//then compute the templated positions
|
//then compute the templated positions
|
||||||
|
|
||||||
for (size_t i=0;i<poly_m.face.size();i++)
|
for (size_t i=0;i<poly_m.face.size();i++)
|
||||||
{
|
{
|
||||||
std::vector<typename PolygonType::CoordType> TemplatePos;
|
std::vector<typename PolygonType::CoordType> TemplatePos;
|
||||||
|
@ -416,8 +428,7 @@ public:
|
||||||
ScalarType val=vcg::PolyArea(poly_m.face[i]);
|
ScalarType val=vcg::PolyArea(poly_m.face[i]);
|
||||||
if (val<(AvgArea*0.00001))
|
if (val<(AvgArea*0.00001))
|
||||||
val=(AvgArea*0.00001);
|
val=(AvgArea*0.00001);
|
||||||
ScalarType W=1.0/val;//poly_m.face[i].Q();
|
ScalarType W=1.0/val;
|
||||||
//ScalarType W=1;
|
|
||||||
|
|
||||||
for (size_t j=0;j<TemplatePos.size();j++)
|
for (size_t j=0;j<TemplatePos.size();j++)
|
||||||
{
|
{
|
||||||
|
@ -426,7 +437,9 @@ public:
|
||||||
//sum up contributes
|
//sum up contributes
|
||||||
avgPos[IndexV]+=Pos*W;
|
avgPos[IndexV]+=Pos*W;
|
||||||
weightSum[IndexV]+=W;
|
weightSum[IndexV]+=W;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//get the laplacian contribute
|
//get the laplacian contribute
|
||||||
|
@ -440,7 +453,9 @@ public:
|
||||||
// if (alpha>1)alpha=1;
|
// if (alpha>1)alpha=1;
|
||||||
// if (isnan(alpha))alpha=1;
|
// if (isnan(alpha))alpha=1;
|
||||||
CoordType newP=avgPos[i]/weightSum[i];
|
CoordType newP=avgPos[i]/weightSum[i];
|
||||||
|
//std::cout<<"W "<<weightSum[i]<<std::endl;
|
||||||
newP=newP*(1-alpha)+AvVert[i]*alpha;
|
newP=newP*(1-alpha)+AvVert[i]*alpha;
|
||||||
|
//newP=AvVert[i];
|
||||||
if ((fixB)&&(poly_m.vert[i].IsB()))continue;
|
if ((fixB)&&(poly_m.vert[i].IsB()))continue;
|
||||||
if ((FixS)&&(poly_m.vert[i].IsS()))continue;
|
if ((FixS)&&(poly_m.vert[i].IsS()))continue;
|
||||||
poly_m.vert[i].P()=poly_m.vert[i].P()*Damp+
|
poly_m.vert[i].P()=poly_m.vert[i].P()*Damp+
|
||||||
|
@ -900,49 +915,6 @@ public:
|
||||||
return MeshArea;
|
return MeshArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static void InitQualityVertVoronoiArea(PolyMeshType &poly_m)
|
|
||||||
// {
|
|
||||||
// for (size_t i=0;i<poly_m.vert.size();i++)
|
|
||||||
// poly_m.vert[i].Q()=0;
|
|
||||||
|
|
||||||
// //set the sum of angle for each face
|
|
||||||
|
|
||||||
// std::vector<ScalarType> SumAngle(poly_m.face.size(),0);
|
|
||||||
// for (size_t i=0;i<poly_m.face.size();i++)
|
|
||||||
// {
|
|
||||||
// size_t sizeV=poly_m.face[i].VN()-1;
|
|
||||||
// for (size_t j=0;j<sizeV;j++)
|
|
||||||
// {
|
|
||||||
// CoordType P0=poly_m.face[i].P((j+1)%sizeV);
|
|
||||||
// CoordType P1=poly_m.face[i].P(j);
|
|
||||||
// CoordType P2=poly_m.face[i].P1(j);
|
|
||||||
// CoordType dir0=P0-P1;
|
|
||||||
// CoordType dir1=P2-P1;
|
|
||||||
// dir0.Normalize();
|
|
||||||
// dir1.Normalize();
|
|
||||||
// SumAngle[i]+=vcg::Angle(dir0,dir1);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// for (size_t i=0;i<poly_m.face.size();i++)
|
|
||||||
// {
|
|
||||||
// ScalarType AreaF=vcg::PolyArea(poly_m.face[i]);
|
|
||||||
// size_t sizeV=poly_m.face[i].VN()-1;
|
|
||||||
// for (size_t j=0;j<poly_m.face[i].VN();j++)
|
|
||||||
// {
|
|
||||||
// CoordType P0=poly_m.face[i].P((j+1)%sizeV);
|
|
||||||
// CoordType P1=poly_m.face[i].P(j);
|
|
||||||
// CoordType P2=poly_m.face[i].P1(j);
|
|
||||||
// CoordType dir0=P0-P1;
|
|
||||||
// CoordType dir1=P2-P1;
|
|
||||||
// dir0.Normalize();
|
|
||||||
// dir1.Normalize();
|
|
||||||
// ScalarType CurrAngle=vcg::Angle(dir0,dir1);
|
|
||||||
// poly_m.face[i].V(j)->Q()+=AreaF * CurrAngle/SumAngle[i];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
static void InitQualityVertVoronoiArea(PolyMeshType &poly_m)
|
static void InitQualityVertVoronoiArea(PolyMeshType &poly_m)
|
||||||
{
|
{
|
||||||
for (size_t i=0;i<poly_m.vert.size();i++)
|
for (size_t i=0;i<poly_m.vert.size();i++)
|
||||||
|
|
|
@ -186,7 +186,7 @@ static void FaceFromVertex( MeshType &m)
|
||||||
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD())
|
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD())
|
||||||
{
|
{
|
||||||
(*fi).Q() =0;
|
(*fi).Q() =0;
|
||||||
for (size_t i=0;i<(*fi).VN();i++)
|
for (int i=0;i<(*fi).VN();i++)
|
||||||
(*fi).Q() += (*fi).V(i)->Q();
|
(*fi).Q() += (*fi).V(i)->Q();
|
||||||
(*fi).Q()/=(FaceQualityType)(*fi).VN();
|
(*fi).Q()/=(FaceQualityType)(*fi).VN();
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,10 +74,11 @@ public:
|
||||||
const ScalarType &size,
|
const ScalarType &size,
|
||||||
const bool oneside,
|
const bool oneside,
|
||||||
const bool onlyPD1,
|
const bool onlyPD1,
|
||||||
const ScalarType maxN)
|
const ScalarType maxN,
|
||||||
|
const ScalarType minN)
|
||||||
{
|
{
|
||||||
CoordType center=(f.cP(0)+f.cP(1)+f.cP(2))/3;
|
CoordType center=(f.cP(0)+f.cP(1)+f.cP(2))/3;
|
||||||
CoordType normal=f.cN();
|
//CoordType normal=f.cN();
|
||||||
CoordType dir[4];
|
CoordType dir[4];
|
||||||
vcg::tri::CrossField<MeshType>::CrossVector(f,dir);
|
vcg::tri::CrossField<MeshType>::CrossVector(f,dir);
|
||||||
|
|
||||||
|
@ -92,10 +93,10 @@ public:
|
||||||
ScalarType IntervW=MaxW-MinW;
|
ScalarType IntervW=MaxW-MinW;
|
||||||
if (Norm0>maxN)Norm0=maxN;
|
if (Norm0>maxN)Norm0=maxN;
|
||||||
if (Norm1>maxN)Norm1=maxN;
|
if (Norm1>maxN)Norm1=maxN;
|
||||||
vcg::Color4b Col0=vcg::Color4b::ColorRamp(0,maxN,Norm0);
|
vcg::Color4b Col0=vcg::Color4b::ColorRamp(minN,maxN,Norm0);
|
||||||
vcg::Color4b Col1=vcg::Color4b::ColorRamp(0,maxN,Norm1);
|
vcg::Color4b Col1=vcg::Color4b::ColorRamp(minN,maxN,Norm1);
|
||||||
ScalarType W0=(Norm0/maxN)*IntervW+MinW;
|
ScalarType W0=(Norm0/(maxN-minN))*IntervW+MinW;
|
||||||
ScalarType W1=(Norm1/maxN)*IntervW+MinW;
|
ScalarType W1=(Norm1/(maxN-minN))*IntervW+MinW;
|
||||||
GLDrawField(dir,center,size,W0,W1,Col0,Col1,oneside,onlyPD1);
|
GLDrawField(dir,center,size,W0,W1,Col0,Col1,oneside,onlyPD1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,7 +133,8 @@ public:
|
||||||
bool onlyPD1,
|
bool onlyPD1,
|
||||||
bool oneside,
|
bool oneside,
|
||||||
ScalarType GlobalScale=0.002,
|
ScalarType GlobalScale=0.002,
|
||||||
const ScalarType maxN=0)
|
const ScalarType maxN=0,
|
||||||
|
const ScalarType minN=0)
|
||||||
{
|
{
|
||||||
|
|
||||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||||
|
@ -144,7 +146,7 @@ public:
|
||||||
for (unsigned int i=0;i<mesh.face.size();i++)
|
for (unsigned int i=0;i<mesh.face.size();i++)
|
||||||
{
|
{
|
||||||
if (mesh.face[i].IsD())continue;
|
if (mesh.face[i].IsD())continue;
|
||||||
GLDrawSingleFaceField(mesh.face[i],size,oneside,onlyPD1,maxN);
|
GLDrawSingleFaceField(mesh.face[i],size,oneside,onlyPD1,maxN,minN);
|
||||||
}
|
}
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,11 +341,8 @@ public:
|
||||||
Ndir=4;
|
Ndir=4;
|
||||||
curvRing=2;
|
curvRing=2;
|
||||||
alpha_curv=0.0;
|
alpha_curv=0.0;
|
||||||
|
|
||||||
align_borders=false;
|
align_borders=false;
|
||||||
|
|
||||||
SmoothM=SMMiq;
|
SmoothM=SMMiq;
|
||||||
|
|
||||||
sharp_thr=0.0;
|
sharp_thr=0.0;
|
||||||
curv_thr=0.4;
|
curv_thr=0.4;
|
||||||
}
|
}
|
||||||
|
@ -488,10 +485,10 @@ public:
|
||||||
//for the moment only cross and line field
|
//for the moment only cross and line field
|
||||||
|
|
||||||
//initialize direction by curvature if needed
|
//initialize direction by curvature if needed
|
||||||
if ((SParam.alpha_curv>0)||
|
// if ((SParam.alpha_curv>0)||
|
||||||
(SParam.sharp_thr>0)||
|
// (SParam.sharp_thr>0)||
|
||||||
(SParam.curv_thr>0))
|
// (SParam.curv_thr>0))
|
||||||
InitByCurvature(mesh,SParam.curvRing);
|
InitByCurvature(mesh,SParam.curvRing);
|
||||||
|
|
||||||
SelectConstraints(mesh,SParam);
|
SelectConstraints(mesh,SParam);
|
||||||
//then do the actual smooth
|
//then do the actual smooth
|
||||||
|
|
|
@ -109,33 +109,33 @@ public:
|
||||||
printf("%d\n",period);
|
printf("%d\n",period);
|
||||||
fscanf(f,"%c",&final);
|
fscanf(f,"%c",&final);
|
||||||
fseek(f, -1, SEEK_CUR);
|
fseek(f, -1, SEEK_CUR);
|
||||||
printf("%s\n",&final[0]);
|
//printf("%s\n",&final[0]);
|
||||||
}while(strcmp(final,"\"")!=0);
|
}while(strcmp(final,"\"")!=0);
|
||||||
|
|
||||||
// printf("%s\n",skipstr);
|
// printf("%s\n",skipstr);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
// for (int i=0;i<mesh.fn;i++)
|
for (int i=0;i<mesh.fn;i++)
|
||||||
// {
|
{
|
||||||
// int i0=-1;
|
int i0=-1;
|
||||||
// int i1=-1;
|
int i1=-1;
|
||||||
// int i2=-1;
|
int i2=-1;
|
||||||
// double u0,v0,u1,v1,u2,v2;
|
double u0,v0,u1,v1,u2,v2;
|
||||||
// int readed1=fscanf(f,"%d %d %d %lf %lf %lf %lf %lf %lf",&i0,&i1,&i2,&u0,&v0,&u1,&v1,&u2,&v2);
|
int readed1=fscanf(f,"%d %d %d %lf %lf %lf %lf %lf %lf",&i0,&i1,&i2,&u0,&v0,&u1,&v1,&u2,&v2);
|
||||||
// assert(readed1==9);
|
assert(readed1==9);
|
||||||
// vcg::Point2<ScalarType> UV[3];
|
vcg::Point2<ScalarType> UV[3];
|
||||||
// UV[0]= vcg::Point2<ScalarType>(u0,v0);
|
UV[0]= vcg::Point2<ScalarType>(u0,v0);
|
||||||
// UV[1]= vcg::Point2<ScalarType>(u1,v1);
|
UV[1]= vcg::Point2<ScalarType>(u1,v1);
|
||||||
// UV[2]= vcg::Point2<ScalarType>(u2,v2);
|
UV[2]= vcg::Point2<ScalarType>(u2,v2);
|
||||||
// CoordType dir1;
|
CoordType dir1;
|
||||||
// CoordType dir2;
|
CoordType dir2;
|
||||||
// vcg::tri::CrossField<MeshType>::GradientToCross(mesh.face[i],UV[0],UV[1],UV[2],dir1,dir2);
|
vcg::tri::CrossField<MeshType>::GradientToCross(mesh.face[i],UV[0],UV[1],UV[2],dir1,dir2);
|
||||||
// dir1.Normalize();
|
dir1.Normalize();
|
||||||
// dir2.Normalize();
|
dir2.Normalize();
|
||||||
// mesh.face[i].PD1()=dir1;
|
mesh.face[i].PD1()=dir1;
|
||||||
// mesh.face[i].PD2()=dir2;
|
mesh.face[i].PD2()=dir2;
|
||||||
// }
|
}
|
||||||
// fclose(f);
|
fclose(f);
|
||||||
// return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///load a field on the mesh, it could be a vfield file (per vertex)
|
///load a field on the mesh, it could be a vfield file (per vertex)
|
||||||
|
|
Loading…
Reference in New Issue