templated the function VertexClamp wrt input scalar type

This commit is contained in:
Nico Pietroni 2014-09-11 20:42:30 +00:00
parent 7911ad3d93
commit 0a91defac8
1 changed files with 4 additions and 2 deletions

View File

@ -68,11 +68,13 @@ static void VertexConstant(MeshType &m, float q)
/** Clamp each vertex of the mesh with a range of values.
*/
static void VertexClamp(MeshType &m, float qmin, float qmax)
static void VertexClamp(MeshType &m,
typename MeshType::ScalarType qmin,
typename MeshType::ScalarType qmax)
{
tri::RequirePerVertexQuality(m);
for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD())
(*vi).Q()=std::min(qmax, std::max(qmin,(*vi).Q()));
(*vi).Q()=min(qmax, max(qmin,(*vi).Q()));
}
/** Normalize the vertex quality so that it fits in the specified range.