From 12d0d04898e3d0fd5f36ce6205bd8c20ce066450 Mon Sep 17 00:00:00 2001 From: cignoni Date: Sun, 7 Mar 2004 22:45:32 +0000 Subject: [PATCH] Moved quality and normal functions to the triangle class. --- vcg/space/point3.h | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/vcg/space/point3.h b/vcg/space/point3.h index 0c0fa05a..259f4a37 100644 --- a/vcg/space/point3.h +++ b/vcg/space/point3.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.14 2004/03/05 17:55:01 tarini +errorino: upper case in Zero() + Revision 1.13 2004/03/03 14:22:48 cignoni Yet against cr lf mismatch @@ -418,41 +421,6 @@ double stable_dot ( Point3 const & p0, Point3 const } } -/// Compute a shape quality measure of the triangle composed by points p0,p1,p2 -/// It Returns 2*AreaTri/(MaxEdge^2), -/// the range is range [0.0, 0.866] -/// e.g. Equilateral triangle sqrt(3)/2, halfsquare: 1/2, ... up to a line that has zero quality. -template -P3ScalarType Quality( Point3 const &p0, Point3 const & p1, Point3 const & p2) -{ - Point3 d10=p1-p0; - Point3 d20=p2-p0; - Point3 d12=p1-p2; - Point3 x = d10^d20; - - P3ScalarType a = Norm( x ); - if(a==0) return 0; // Area zero triangles have surely quality==0; - P3ScalarType b = SquaredNorm( d10 ); - P3ScalarType t = b; - t = SquaredNorm( d20 ); if ( b -Point3 Normal(const Point3 & p0, const Point3 & p1, const Point3 & p2) -{ - return ((p1 - p0) ^ (p2 - p0)); -} - -/// Like the above, it returns the normal to the plane passing through p0,p1,p2, but normalized. -template -Point3 NormalizedNormal(const Point3 & p0, const Point3 & p1, const Point3 & p2) -{ - return ((p1 - p0) ^ (p2 - p0)).Normalize(); -} /// Point(p) Edge(v1-v2) dist, q is the point in v1-v2 with min dist