added Mirror function

This commit is contained in:
Nico Pietroni 2007-10-12 10:02:41 +00:00
parent 00f3907e1b
commit 71f3accd9c
1 changed files with 10 additions and 0 deletions

View File

@ -197,6 +197,16 @@ ScalarType Distance(const Line2<ScalarType, NORM> &l,
return (o - p).Norm();
}
template <class ScalarType, bool NORM>
vcg::Point2<ScalarType> Mirror(const vcg::Line2<ScalarType, NORM> &l,
const vcg::Point2<ScalarType> &p)
{
vcg::Point2<ScalarType> nearest=vcg::ClosestPoint<ScalarType,NORM>(l,p);
vcg::Point2<ScalarType> dir=(nearest - p);
nearest+=dir;
return nearest;
}
/*@}*/
} // end namespace