From 71f3accd9c6a8fccd8b44beb4d121f56f86907cf Mon Sep 17 00:00:00 2001 From: nicopietroni Date: Fri, 12 Oct 2007 10:02:41 +0000 Subject: [PATCH] added Mirror function --- vcg/space/line2.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vcg/space/line2.h b/vcg/space/line2.h index 2411c1d2..c756ef63 100644 --- a/vcg/space/line2.h +++ b/vcg/space/line2.h @@ -197,6 +197,16 @@ ScalarType Distance(const Line2 &l, return (o - p).Norm(); } +template +vcg::Point2 Mirror(const vcg::Line2 &l, + const vcg::Point2 &p) +{ + vcg::Point2 nearest=vcg::ClosestPoint(l,p); + vcg::Point2 dir=(nearest - p); + nearest+=dir; + return nearest; +} + /*@}*/ } // end namespace