diff --git a/vcg/space/polygon3.h b/vcg/space/polygon3.h index 811fedef..7444c561 100644 --- a/vcg/space/polygon3.h +++ b/vcg/space/polygon3.h @@ -412,7 +412,9 @@ void getBaseTemplatePolygon(int N, //described by "Static Aware Grid Shells" by Pietroni et Al. template void GetPolyTemplatePos(const PolygonType &F, - std::vector &TemplatePos) + std::vector &TemplatePos, + typename PolygonType::ScalarType TargetArea=-1, + bool force_isotropy=false) { typedef typename PolygonType::FaceType FaceType; typedef typename PolygonType::CoordType CoordType; @@ -433,6 +435,13 @@ void GetPolyTemplatePos(const PolygonType &F, CoordType dirY=PCA[1]; CoordType dirZ=PCA[2]; + if (force_isotropy) + { + dirX.Normalize(); + dirY.Normalize(); + dirZ.Normalize(); + } + ///set the Rotation matrix ToPCA.SetColumn(0,dirX); ToPCA.SetColumn(1,dirY); @@ -455,6 +464,11 @@ void GetPolyTemplatePos(const PolygonType &F, ScalarType AreaTemplate=Area(TemplatePos); ScalarType AreaUniform=Area(UniformPos); +// if (TargetArea>0) +// { +// AreaUniform*=(AreaUniform/TargetArea); +// } + ScalarType Scale=sqrt(AreaTemplate/AreaUniform); for (size_t i=0;i