mElite
1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
|
A simple 3d vector and basic operations. More...
#include <Vector3.h>
Public Member Functions | |
Vector3 (float x, float y, float z) | |
Vector3 (const Vector3 &v) | |
Vector3 (void) | |
~Vector3 (void) | |
Vector3 | operator+ (const Vector3 &v) |
Vector3 | operator- (const Vector3 &v) |
Vector3 | operator* (const Vector3 &v) |
Vector3 | operator* (float t) |
Vector3 | operator/ (float t) |
Vector3 | operator- (void) |
Vector3 | operator= (const Vector3 &v) |
float | at (Vector3Index index) |
float | at (unsigned __int8 index) |
float | length (void) |
void | normalize (void) |
float | innerProduct (const Vector3 &v) |
void | copy (const Vector3 &v) |
void | set (float x, float y, float z) |
Vector3 | scalarMult (float a) |
Public Attributes | |
float | x |
float | y |
float | z |
A simple 3d vector and basic operations.
This class provides vector arithmetics for a 3-dimensional vactor. All members are public, so the three components can directly be accessed. The basic operations with vectors are supported through operator overloading. Some other operations are available as member functions.
Vector3::Vector3 | ( | float | x, |
float | y, | ||
float | z | ||
) |
Definition at line 21 of file Vector3.cpp.
Vector3::Vector3 | ( | const Vector3 & | v | ) |
Definition at line 15 of file Vector3.cpp.
Vector3::Vector3 | ( | void | ) |
Definition at line 9 of file Vector3.cpp.
Vector3::~Vector3 | ( | void | ) |
Definition at line 27 of file Vector3.cpp.
float Vector3::at | ( | Vector3Index | index | ) |
Definition at line 30 of file Vector3.cpp.
float Vector3::at | ( | unsigned __int8 | index | ) |
Definition at line 45 of file Vector3.cpp.
void Vector3::copy | ( | const Vector3 & | v | ) |
Copys the value of a Vector3 into this instance.
Definition at line 172 of file Vector3.cpp.
float Vector3::innerProduct | ( | const Vector3 & | v | ) |
Calculates the inner product with an vector.
Definition at line 165 of file Vector3.cpp.
float Vector3::length | ( | void | ) |
Calculates the euclidian length of a vector.
Definition at line 144 of file Vector3.cpp.
void Vector3::normalize | ( | void | ) |
Normalizes the vector.
Definition at line 151 of file Vector3.cpp.
Cross product.
Definition at line 123 of file Vector3.cpp.
Vector3 Vector3::operator* | ( | float | t | ) |
Scalar multiplikation.
Definition at line 100 of file Vector3.cpp.
Subtraction of an vector.
v | The vector to substract |
Definition at line 78 of file Vector3.cpp.
Vector3 Vector3::operator- | ( | void | ) |
Changes the sign of the vector.
Definition at line 89 of file Vector3.cpp.
Vector3 Vector3::operator/ | ( | float | t | ) |
Scalar division.
Definition at line 112 of file Vector3.cpp.
Definition at line 132 of file Vector3.cpp.
Vector3 Vector3::scalarMult | ( | float | a | ) |
Multiplikates this vector with a scalar value.
Definition at line 190 of file Vector3.cpp.
void Vector3::set | ( | float | x, |
float | y, | ||
float | z | ||
) |
Sets the value of all components of the vector at the same time.
Definition at line 181 of file Vector3.cpp.