From fab6d05157e72d896794d62aece1957250992319 Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 1 Feb 1999 21:08:28 +0000 Subject: [PATCH] Optimizations from Norman Vine. --- Math/point3d.hxx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Math/point3d.hxx b/Math/point3d.hxx index b1a0ff12..ec0e51df 100644 --- a/Math/point3d.hxx +++ b/Math/point3d.hxx @@ -120,7 +120,8 @@ public: friend ostream& operator<< ( ostream&, const Point3D& ); // Special functions - double distance3D(const Point3D& a) const; // distance between + double distance3D(const Point3D& a) const; // distance between + double distance3Dsquared(const Point3D& a) const; // distance between ^ 2 }; @@ -316,10 +317,27 @@ Point3D::distance3D(const Point3D& a ) const return sqrt(x*x + y*y + z*z); } + +inline double +Point3D::distance3Dsquared(const Point3D& a ) const +{ + double x, y, z; + + x = n[PX] - a.n[PX]; + y = n[PY] - a.n[PY]; + z = n[PZ] - a.n[PZ]; + + return(x*x + y*y + z*z); +} + + #endif // _POINT3D_HXX // $Log$ +// Revision 1.9 1999/02/01 21:08:28 curt +// Optimizations from Norman Vine. +// // Revision 1.8 1999/01/27 04:46:18 curt // Portability tweaks by Bernie Bright. // -- 2.39.2