diff --git a/vcg/space/triangle3.h b/vcg/space/triangle3.h index 541c69ab..3df34970 100644 --- a/vcg/space/triangle3.h +++ b/vcg/space/triangle3.h @@ -83,6 +83,12 @@ Point3 TriangleNormal(const TriangleType &t) { return (( t.cP(1) - t.cP(0)) ^ (t.cP(2) - t.cP(0))); } +/// Returns the normal to the plane passing through p0,p1,p2 +template +Point3 NormalizedTriangleNormal(const TriangleType &t) +{ + return (( t.cP(1) - t.cP(0)) ^ (t.cP(2) - t.cP(0))).Normalize(); +} template Point3Type Normal( Point3Type const &p0, Point3Type const & p1, Point3Type const & p2) { @@ -147,7 +153,7 @@ bool InterpolationParameters2(const Point2 &V1, template bool InterpolationParameters(const TriangleType t, const Point3 & P, Point3 & L) { - vcg::Point3 N=vcg::Normal(t); + vcg::Point3 N=vcg::TriangleNormal(t); return (InterpolationParameters(t,N,P,L)); }