16 Vec3() : x(0.0f), y(0.0f), z(0.0f) {}
24 Vec3(
float x,
float y,
float z) : x(x), y(y), z(z) {}
32 Vec3(
int x,
int y,
int z) : x((float)x), y((float)y), z((float)z) {}
66 return float(sqrt((x*x) + (y*y) + (z*z)));
76 Vec3 normalised =
Vec3(x / magnitude, y / magnitude, z / magnitude);
104 vecOut.
x = vecInA.
x - vecInB.
x;
105 vecOut.
y = vecInA.
y - vecInB.
y;
106 vecOut.
z = vecInA.
z - vecInB.
z;
119 vecOut.
x = vecInA.
x + vecInB.
x;
120 vecOut.
y = vecInA.
y + vecInB.
y;
121 vecOut.
z = vecInA.
z + vecInB.
z;
134 vecOut.
x = vecInA.
x / scalar;
135 vecOut.
y = vecInA.
y / scalar;
136 vecOut.
z = vecInA.
z / scalar;
149 vecOut.
x = vecInA.
x * scalar;
150 vecOut.
y = vecInA.
y * scalar;
151 vecOut.
z = vecInA.
z * scalar;
164 vecOut.
x = vecInA.
x * vecInB.
x;
165 vecOut.
y = vecInA.
y * vecInB.
y;
166 vecOut.
z = vecInA.
z * vecInB.
z;
float y
Definition: Vec3.h:11
Vec3 operator-(Vec3 vecIn)
Overloads the - operator allowing a Vec3 to be inverted.
Definition: Vec3.h:86
float x
Position variables.
Definition: Vec3.h:11
Vec3(float x, float y, float z)
Constructs the Vec3 setting the values to the input coordinates.
Definition: Vec3.h:24
Vec3 getNormalised()
Returns a normalised version of the Vec3.
Definition: Vec3.h:73
Vec3 * operator+=(Vec3 vecIn)
Overloads the += operator.
Definition: Vec3.h:39
Vec3 operator+(Vec3 vecInA, Vec3 vecInB)
Overloads the + operator.
Definition: Vec3.h:116
Vec3(int x, int y, int z)
Constructs the Vec3 setting the values to the input coordinates.
Definition: Vec3.h:32
Contains the Vec3 structure with functions and overloaded operators.
Definition: Vec3.h:8
float getLength()
Returns the length of the Vec3.
Definition: Vec3.h:64
Vec3()
Constructs the Vec3 setting the values to 0,0,0.
Definition: Vec3.h:16
float z
Definition: Vec3.h:11
Vec3 * operator-=(Vec3 vecIn)
Overloads the -= operator.
Definition: Vec3.h:52
Vec3 operator/(Vec3 vecInA, float scalar)
Overloads the / operator allowing a Vec3 to be divided by a scalar.
Definition: Vec3.h:131
Vec3 operator*(Vec3 vecInA, float scalar)
Overloads the * operator allowing a Vec3 to be multiplied by a scalar.
Definition: Vec3.h:146