From 048b884a3e77ac04806a8d21445537179fae2796 Mon Sep 17 00:00:00 2001 From: cignoni Date: Wed, 18 Jan 2012 11:22:40 +0000 Subject: [PATCH] Added tri:UpdatePosition::Scale(mesh) --- vcg/complex/algorithms/update/position.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/vcg/complex/algorithms/update/position.h b/vcg/complex/algorithms/update/position.h index 129b502f..a339900f 100644 --- a/vcg/complex/algorithms/update/position.h +++ b/vcg/complex/algorithms/update/position.h @@ -80,6 +80,21 @@ static void Translate(ComputeMeshType &m, const Point3 &t) if(!(*vi).IsD()) (*vi).P()+=t; } +static void Scale(ComputeMeshType &m, const ScalarType s) +{ + Scale(m,Point3(s,s,s)); +} + +static void Scale(ComputeMeshType &m, const Point3 &s) +{ + VertexIterator vi; + for(vi=m.vert.begin();vi!=m.vert.end();++vi) + if(!(*vi).IsD()) { + (*vi).P()[0]*=s[0]; + (*vi).P()[1]*=s[1]; + (*vi).P()[2]*=s[2]; + } +} }; // end class