From ba65c9601e214b8dc278e59de32e9cb3121078ec Mon Sep 17 00:00:00 2001 From: Francois Henrotte <francois.henrotte@ulg.ac.be> Date: Mon, 4 Mar 2013 15:22:42 +0000 Subject: [PATCH] added beware comment for normalize() --- Geo/SVector3.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Geo/SVector3.h b/Geo/SVector3.h index 8e36d65777..0de0a89d12 100644 --- a/Geo/SVector3.h +++ b/Geo/SVector3.h @@ -29,9 +29,11 @@ class SVector3 { inline double y(void) const { return P.y(); } inline double z(void) const { return P.z(); } inline double norm() const { return sqrt(P[0] * P[0] + P[1] * P[1] + P[2] * P[2]); } - inline double normSq() { return (P[0] * P[0] + P[1] * P[1] + P[2] * P[2]); } - double normalize() - { + inline double normSq() const{ return (P[0] * P[0] + P[1] * P[1] + P[2] * P[2]); } + // Beware that " w = v.normalize() " produces the vector + // w = (v.norm(), v.norm(), v.norm()), which is NOT a unit vector! + // Use " w = v.unit() " to affect to "w" the unit vector parallel to "v". + double normalize(){ double n = norm(); if(n){ P[0] /= n; P[1] /= n; P[2] /= n; } return n; } -- GitLab