Vec3¶
-
Vec3 inherits ObjectConstruction:
Vec3 newObj = Vec3();
Clone:Vec3 newObj = Vec3(other);
Vec3 provides storage of a 3d vector, and related methods to manipulate them.
Static Methods¶
- static double Dot(Vec3 a, Vec3 b)¶
Returns the dot product of a . b = a.x * b.x + a.y * b.y + a.z * b.z
Methods¶
- double Get(int index)¶
Returns the index component where index is in [0,2].
- double Magnitude()¶
Returns the magnitude or length of the vector.
- double MagnitudeSquared()¶
Returns the square of the magnitude or length of the vector.
- double Normalize()¶
Changes this vector to normal form, same as Scale(1.0/Magnitude). Returns the magnitude of the vector before normalizing.
- void Scale(double scale)¶
Multiplies each component of the vector by scale.
- void Negate()¶
Negates the vector. Effectively the same as scaling the vector by -1, resulting in a vector of the same magnitude but opposite in direction.