Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-03-04 16:06:09 +0000
committerStijn Buys <ingar@osirion.org>2012-03-04 16:06:09 +0000
commit4881ebb6162bde6658431f5723c16576aa2b55bb (patch)
tree9d45080feee096a7c485e83fb37e1a9886a0618e /src/math/vector3f.cc
parent8fbb2425220389ee69749ccd93407a0db73678fd (diff)
Added comparison operators to math:Vector3f.
Diffstat (limited to 'src/math/vector3f.cc')
-rw-r--r--src/math/vector3f.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/math/vector3f.cc b/src/math/vector3f.cc
index 421d84e..03b4307 100644
--- a/src/math/vector3f.cc
+++ b/src/math/vector3f.cc
@@ -36,6 +36,15 @@ void Vector3f::clear()
memset(coord, 0, sizeof(coord));
}
+bool Vector3f::equals(const Vector3f &other) const
+{
+ return(
+ (coord[0] == other.coord[0]) &&
+ (coord[1] == other.coord[1]) &&
+ (coord[2] == other.coord[2])
+ );
+}
+
void Vector3f::assign(const float x, const float y, const float z)
{
coord[0] = x;
@@ -89,14 +98,6 @@ Vector3f &Vector3f::operator+=(const Vector3f &other)
return (*this);
}
-bool Vector3f::operator==(const Vector3f& other) const
-{
- for (int i = 0; i < 3; i++)
- if (coord[i] != other.coord[i])
- return (false);
- return (true);
-}
-
float Vector3f::lengthsquared() const
{
float r = 0;