summaryrefslogtreecommitdiff
path: root/src/vhc/Vector3D.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vhc/Vector3D.h')
-rw-r--r--src/vhc/Vector3D.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vhc/Vector3D.h b/src/vhc/Vector3D.h
index e5e2ffe..f15b4c1 100644
--- a/src/vhc/Vector3D.h
+++ b/src/vhc/Vector3D.h
@@ -87,10 +87,12 @@ public:
/** Vecteur unitaire de ce vecteur. */
Vector3D operator~() const {
- if (getLength() != 0.0) return (*this) / getLength();
+ if (getNorm() != 0.0) return (*this) / getNorm();
else throw std::domain_error("Unit vector.");
};
+ Vector3D getUnit() const {return ~(*this);}
+
/** Retourne la norme du vecteur. */
double getNorm() const {return sqrt(dot(*this));};