summaryrefslogtreecommitdiffstats
path: root/src/math/Vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/Vector.h')
-rw-r--r--src/math/Vector.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/math/Vector.h b/src/math/Vector.h
index 082b296f..02128454 100644
--- a/src/math/Vector.h
+++ b/src/math/Vector.h
@@ -1,23 +1,22 @@
#pragma once
-class CVector
+class CVector : public RwV3d
{
public:
- float x, y, z;
CVector(void) {}
- CVector(float x, float y, float z) : x(x), y(y), z(z) {}
-#ifdef RWCORE_H
- CVector(const RwV3d &v) : x(v.x), y(v.y), z(v.z) {}
-
- operator RwV3d (void) const {
- RwV3d vecRw = { this->x, this->y, this->z };
- return vecRw;
+ CVector(float x, float y, float z)
+ {
+ this->x = x;
+ this->y = y;
+ this->z = z;
}
-
- operator RwV3d *(void) {
- return (RwV3d*)this;
+
+ CVector(const RwV3d &v)
+ {
+ x = v.x;
+ y = v.y;
+ z = v.z;
}
-#endif
// (0,1,0) means no rotation. So get right vector and its atan
float Heading(void) const { return Atan2(-x, y); }
float Magnitude(void) const { return Sqrt(x*x + y*y + z*z); }
@@ -65,11 +64,11 @@ public:
return CVector(-x, -y, -z);
}
- const bool operator==(CVector const &right) {
+ const bool operator==(CVector const &right) const {
return x == right.x && y == right.y && z == right.z;
}
- const bool operator!=(CVector const &right) {
+ const bool operator!=(CVector const &right) const {
return x != right.x || y != right.y || z != right.z;
}