Add vector equality operator
This commit is contained in:
parent
10b127415a
commit
0946382b71
@ -109,6 +109,14 @@ vector::operator= (const vector &rhs) {
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
vector::operator== (const vector &rhs) const {
|
||||
return almost_equal (x, rhs.x) &&
|
||||
almost_equal (y, rhs.y) &&
|
||||
almost_equal (z, rhs.z);
|
||||
}
|
||||
|
||||
|
||||
double
|
||||
vector::magnitude (void) const {
|
||||
return sqrt (x * x + y * y + z * z);
|
||||
|
@ -40,6 +40,8 @@ namespace util {
|
||||
|
||||
vector& operator =(const vector &);
|
||||
|
||||
bool operator== (const vector &) const;
|
||||
|
||||
double magnitude (void) const;
|
||||
double magnitude2 (void) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user