Game Development Reference
x += v.x;
y += v.y;
z += v.z;
* Returns the value of the given vector added to this.
Vector3 operator+(const Vector3& v) const
return Vector3(x+v.x, y+v.y, z+v.z);
In the same way vector subtraction is also performed by subtracting the compo-
nents of each vector:
a x −
a y −
which is implemented in the same way as addition:
Excerpt from include/cyclone/core.h
// ... Other Vector3 code as before ...
/** Subtracts the given vector from this. */
void operator-=(const Vector3& v)
x -= v.x;
y -= v.y;
z -= v.z;
* Returns the value of the given vector subtracted from this.
Vector3 operator-(const Vector3& v) const
return Vector3(x-v.x, y-v.y, z-v.z);