|
Public Member Functions |
| Vector4 () |
| Default constructor. Initialises data to 0.0f.
|
| Vector4 (const float vx, const float vy, const float vz, const float vw) |
| Constructor that builds the vector data from floats given through arguments.
|
| Vector4 (const Vector4 &v) |
| Copy Constructor.
|
float | Magnitude () |
| Returns the magnitude of a vector. Primarily used for normalizing vectors.
|
float | Magnitude2 () |
| Returns the squared magnitude of a vector.
|
bool | IsZero () |
| Is the vector equal to (0, 0, 0, 0) ?
|
void | Normalize () |
| Normalises a given vector. In clear words, changes the vector so that its "length" is 1.
|
float | Distance (const Vector4 &v2) |
| returns the distance between two Vector4's used as vertices
|
std::string | ToString () |
| Returns a string that represents the actual object.
|
Vector4 & | operator= (const Vector4 &v) |
| Affectation operator.
|
float & | operator[] (unsigned int i) |
| Indexing operator.
|
const float & | operator[] (unsigned int i) const |
| Indexing operator.
|
Vector4 & | operator+= (const Vector4 &v) |
| Adds a Vector4 to this one.
|
Vector4 & | operator-= (const Vector4 &v) |
| Subtracts a Vector4 from this one.
|
Vector4 & | operator *= (float f) |
| Multiplies this Vector4 by a float.
|
Vector4 & | operator/= (float f) |
| Divides the Vector4 by a float.
|
Static Public Member Functions |
static float | DotProduct (const Vector4 &v1, const Vector4 &v2) |
| Returns the dot product of 2 vectors. v1.v2 == |v1|*|v2|*cos(v1,v2). So this gives the cosine of the angle between 2 vectors.
|
static Vector4 | Average (const Vector4 &v1, const Vector4 &v2) |
| averages 2 vectors
|
Public Attributes |
float | x |
| Accessors.
|
float | y |
float | z |
float | w |
Friends |
bool | operator== (const Vector4 &v1, const Vector4 &v2) |
| Comparison Operator.
|
bool | operator!= (const Vector4 &v1, const Vector4 &v2) |
| Difference Operator.
|
Vector4 | operator- (const Vector4 &v) |
| Negates this vector.
|
Vector4 | operator+ (const Vector4 &v1, const Vector4 &v2) |
| Adds 2 Vector4.
|
Vector4 | operator- (const Vector4 &v1, const Vector4 &v2) |
| Subtracts one Vector2 from another.
|
Vector4 | operator * (const Vector4 &v, float f) |
| Multiplies a Vector4 by a float.
|
Vector4 | operator * (float f, const Vector4 &v) |
| Multiplies a Vector4 by a float.
|
Vector4 | operator/ (const Vector4 &v, float f) |
| Divides a Vector4 by a float.
|