From d8a7e0069f153818d5aa013ed08d9c676cb54ba6 Mon Sep 17 00:00:00 2001 From: nicopietroni Date: Fri, 3 Jul 2015 09:54:40 +0000 Subject: [PATCH] added parameters in GetPolyTemplatePos to force isotropy --- vcg/space/polygon3.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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