CRITICAL CHANGE: the commonly used function Normal() used to compute the normal of a triangle has been changed into TriangleNormal()

This commit is contained in:
Paolo Cignoni 2014-11-12 00:04:26 +00:00
parent 3bc278c224
commit 16f4795588
1 changed files with 74 additions and 88 deletions

View File

@ -79,7 +79,7 @@ public:
/// Returns the normal to the plane passing through p0,p1,p2
template<class TriangleType>
Point3<typename TriangleType::ScalarType> Normal(const TriangleType &t)
Point3<typename TriangleType::ScalarType> TriangleNormal(const TriangleType &t)
{
return (( t.cP(1) - t.cP(0)) ^ (t.cP(2) - t.cP(0)));
}
@ -89,20 +89,6 @@ Point3Type Normal( Point3Type const &p0, Point3Type const & p1, Point3Type cons
return (( p1 - p0) ^ (p2 - p0));
}
/// Like the above, it returns the normal to the plane passing through p0,p1,p2, but normalized.
template<class TriangleType>
typename TriangleType::CoordType NormalizedNormal(const TriangleType &t)
{
return (( t.cP(1) - t.cP(0)) ^ (t.cP(2) - t.cP(0))).Normalize();
}
template<class Point3Type>
Point3Type NormalizedNormal( Point3Type const &p0, Point3Type const & p1, Point3Type const & p2)
{
return (( p1 - p0) ^ (p2 - p0)).Normalize();
}
/********************** Interpolation **********************/
// The function to computing barycentric coords of a point inside a triangle.