Commit 50a03f3a authored by paps's avatar paps

ajout operator == et != pour LrVector

parent e31d87c0
......@@ -56,7 +56,7 @@ bool operator == (const LrPoint &lhs, const LrPoint &rhs)
bool operator != (const LrPoint &lhs, const LrPoint &rhs)
{
return !((lhs.x == rhs.x) && (lhs.y == rhs.y) && (lhs.z == rhs.z));
return !(lhs == rhs);
}
/*---------------------------------------------------------------------------*
* methodes de classe *
......
......@@ -109,6 +109,17 @@ LrVector operator - (const LrVector & v_1, const LrVector & v_2)
tmp -= v_2;
return tmp;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool operator == (const LrVector & v_1, const LrVector & v_2)
{
return ((v_1.composantes[X] == v_2.composantes[X]) && (v_1.composantes[Y] == v_2.composantes[Y])
&& (v_1.composantes[Z] == v_2.composantes[Z]));
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool operator != (const LrVector & v_1, const LrVector & v_2)
{
return !(v_1 == v_2);
}
//produit scalaire ////////////////////////////////////////////////////////////////////////////////////////
float operator * (const LrVector & v_1, const LrVector & v_2)
{
......
......@@ -71,6 +71,8 @@ class LrVector
LrVector & operator += (const LrVector & source);
LrVector & operator -= (const LrVector &);
friend bool operator == (const LrVector & v_1, const LrVector & v_2);
friend bool operator != (const LrVector & v_1, const LrVector & v_2);
friend LrVector operator + (const LrVector & v_1, const LrVector & v_2);
friend LrVector operator - (const LrVector & v_1, const LrVector & v_2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment