#include <vector.h>
Public Member Functions | |
Vector3D (float X=0.0f, float Y=0.0f, float Z=0.0f) | |
Constructs a vector object from given components. | |
Vector3D (const Vector4D &v) | |
Constructs a 2D vector fromthe first 3 components of a 4D vector. | |
Vector3D | operator+ (const Vector3D &v) const |
Adds wto vectors. | |
Vector3D | operator- (const Vector3D &v) const |
Subtracts two vectors. | |
Vector3D | operator * (const float f) const |
Multiplies the vector with a scalar. | |
const float * | toFloatPointer (void) const |
Allows accessing the components via index. | |
float | lengthSq (void) const |
Returns the quared vector length. | |
Vector3D | normalize (void) const |
Returns a vector with the same direction, but length 1.0. | |
float | dotProduct (const Vector3D &v) const |
Calculates the dot product. | |
Vector3D | crossProduct (const Vector3D &v) const |
Caculates the corss procut this x v. | |
Vector3D | absolute (void) const |
Returns the vector with the absolute of each component. | |
float | absoluteCoordMaximum (void) const |
Returns the maximum of the absolute of each component. | |
Public Attributes | |
float | x |
X component. | |
float | y |
Y component. | |
float | z |
Z component. |
A vector class with self-explaining members.
Vector3D::Vector3D | ( | const Vector4D & | v | ) | [inline] |
Constructs a 2D vector fromthe first 3 components of a 4D vector.
Subtracts two vectors.
Vector3D Vector3D::operator * | ( | const float | f | ) | const [inline] |
Multiplies the vector with a scalar.
f | Scaling factor. |
const float* Vector3D::toFloatPointer | ( | void | ) | const [inline] |
Allows accessing the components via index.
float Vector3D::lengthSq | ( | void | ) | const [inline] |
Returns the quared vector length.
Vector3D Vector3D::normalize | ( | void | ) | const [inline] |
Returns a vector with the same direction, but length 1.0.
If this is called on a Null-Vector, a Null-Vector is returned.
float Vector3D::dotProduct | ( | const Vector3D & | v | ) | const [inline] |
Calculates the dot product.
v | Seconds vector. |
Caculates the corss procut this x v.
v | Second vector. |