From 46bdf27759a293636f231170f8138c370c636a09 Mon Sep 17 00:00:00 2001 From: Pierre Kraemer Date: Mon, 30 May 2011 10:22:58 +0200 Subject: [PATCH] operator!= on vectors --- include/Geometry/vector_gen.h | 3 +++ include/Geometry/vector_gen.hpp | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/Geometry/vector_gen.h b/include/Geometry/vector_gen.h index f86dfd19..632b33ff 100644 --- a/include/Geometry/vector_gen.h +++ b/include/Geometry/vector_gen.h @@ -132,6 +132,9 @@ public: // Equal bool operator==(const Vector& v) const ; + // Different + bool operator!=(const Vector& v) const ; + bool hasNan() const ; /**********************************************/ diff --git a/include/Geometry/vector_gen.hpp b/include/Geometry/vector_gen.hpp index a7f12751..8d714c3d 100644 --- a/include/Geometry/vector_gen.hpp +++ b/include/Geometry/vector_gen.hpp @@ -277,6 +277,15 @@ inline bool Vector::operator==(const Vector& v) const return true ; } +template +inline bool Vector::operator!=(const Vector& v) const +{ + for(unsigned int i = 0 ; i < DIM ; ++i) + if(v[i] != m_data[i]) + return true ; + return false ; +} + template inline bool Vector::hasNan() const { @@ -314,7 +323,6 @@ inline Vector operator*(T a, const Vector& v) return v * a ; } - template inline Vector operator/(T a, const Vector& v) { @@ -346,7 +354,6 @@ inline Vector slerp(const Vector &v1, const Vector &v2, con return res ; } - } // namespace Geom } // namespace CGoGN -- GitLab