PixelLightAPI
.
|
4D vector More...
#include <Vector4.h>
Public Types | |
enum | Component { X = 0, Y = 1, Z = 2, W = 3 } |
Vector component. More... | |
Public Member Functions | |
Vector4 () | |
Default constructor setting the components to (0, 0, 0, 1) | |
Vector4 (float fX, float fY, float fZ=0.0f, float fW=1.0f) | |
Vector4 (const float fV[]) | |
PLMATH_API | Vector4 (const Vector2 &vV, float fZ=0.0f, float fW=1.0f) |
PLMATH_API | Vector4 (const Vector3 &vV, float fW=1.0f) |
Vector4 (const Vector4 &vV) | |
Vector4 (const PLCore::String &sString) | |
~Vector4 () | |
Vector4 & | operator= (const float fV[]) |
PLMATH_API Vector4 & | operator= (const Vector2 &vV) |
PLMATH_API Vector4 & | operator= (const Vector3 &vV) |
Vector4 & | operator= (const Vector4 &vV) |
bool | operator== (const Vector4 &vV) const |
Compares two vectors. | |
bool | operator!= (const Vector4 &vV) const |
Compares two vectors. | |
bool | operator< (const Vector4 &vV) const |
Compares two vectors lexicographically. | |
bool | operator> (const Vector4 &vV) const |
Compares two vectors lexicographically. | |
bool | operator<= (const Vector4 &vV) const |
Compares two vectors lexicographically. | |
bool | operator>= (const Vector4 &vV) const |
Compares two vectors lexicographically. | |
Vector4 | operator+ (const Vector4 &vV) const |
Vector4 | operator+ (float fN) const |
Vector4 & | operator+= (const Vector4 &vV) |
Vector4 & | operator+= (float fN) |
Vector4 | operator- () const |
Vector4 | operator- (const Vector4 &vV) const |
Vector4 | operator- (float fN) const |
Vector4 & | operator-= (const Vector4 &vV) |
Vector4 & | operator-= (float fN) |
Vector4 | operator* (const Vector4 &vV) const |
Per component multiplication. | |
Vector4 | operator* (float fS) const |
Vector4 & | operator*= (const Vector4 &vV) |
Per component multiplication. | |
Vector4 & | operator*= (float fS) |
PLMATH_API Vector4 & | operator*= (const Matrix4x4 &mTrans) |
Transforms the vector. | |
Vector4 | operator/ (const Vector4 &vV) const |
Per component division. | |
Vector4 | operator/ (float fS) const |
Vector4 & | operator/= (const Vector4 &vV) |
Per component division. | |
Vector4 & | operator/= (float fS) |
PLMATH_API | operator Vector3 () |
operator float * () | |
operator const float * () const | |
float & | operator[] (int nIndex) |
const float & | operator[] (int nIndex) const |
void | GetXYZW (float &fX, float &fY, float &fZ, float &fW) const |
float | GetX () const |
float | GetY () const |
float | GetZ () const |
float | GetW () const |
void | SetXYZ (float fX=0.0f, float fY=0.0f, float fZ=0.0f) |
void | SetXYZ (const float fV[]) |
PLMATH_API void | SetXYZ (const Vector3 &vV) |
void | SetXYZW (float fX=0.0f, float fY=0.0f, float fZ=0.0f, float fW=1.0f) |
void | SetXYZW (const float fV[]) |
PLMATH_API void | SetXYZW (const Vector3 &vV, float fW=1.0f) |
void | SetX (float fX=0.0f) |
void | SetY (float fY=0.0f) |
void | SetZ (float fZ=0.0f) |
void | SetW (float fW=1.0f) |
void | IncXYZW (float fX=0.0f, float fY=0.0f, float fZ=0.0f, float fW=0.0f) |
void | IncXYZW (const float fV[]) |
void | IncX (float fX) |
void | IncY (float fY) |
void | IncZ (float fZ) |
void | IncW (float fW) |
bool | IsNull () const |
Returns whether the vector is null or not. | |
bool | IsPacked () const |
Returns whether the vector is packed (within range of 0-1) or not. | |
void | PackTo01 () |
Packs/clamps the vector into a range of 0-1. | |
Vector4 | GetPackedTo01 () const |
Returns a vector which is packed/clamped into the range of 0-1. | |
void | UnpackFrom01 () |
Unpacks the packed vector into a range of -1 to 1. | |
Vector4 | GetUnpackedFrom01 () const |
Returns a unpacked vector of the range of -1 to 1. | |
Component | GetSmallestComponent () const |
Returns the smallest component. | |
float | GetSmallestValue () const |
Returns the value of the smallest component. | |
Component | GetGreatestComponent () const |
Returns the greatest component. | |
float | GetGreatestValue () const |
Returns the value of the greatest component. | |
void | Invert () |
Inverts the vector. | |
Vector4 | GetInverted () const |
Returns the inverted vector. | |
float | GetLength () const |
Returns the length of the vector (also called magnitude) | |
float | GetSquaredLength () const |
Returns the squared length of the vector (also called norm) | |
void | SetLength (float fLength=1.0f) |
Sets the vector to the given length. | |
Vector4 & | Normalize () |
Normalizes the vector. | |
Vector4 | GetNormalized () const |
Returns the normalized vector. | |
float | GetDistance (const Vector4 &vV) const |
Returns the distance to another vector. | |
float | GetSquaredDistance (const Vector4 &vV) const |
Returns the squared distance to another vector. | |
float | DotProduct (const Vector4 &vV) const |
Returns the dot product of two vectors. | |
Vector4 | ProjectVector (const Vector4 &vA, const Vector4 &vB) const |
Project vector a onto another vector b. | |
float | GetAngle (const Vector4 &vV) const |
Calculates the angle between two vectors. | |
PLMATH_API Vector4 & | GetProjection (const Vector4 &vX, const Vector4 &vN) |
Calculates a normalized projection vector. | |
PLMATH_API Vector4 & | ProjectPlane (const Vector4 &vV1, const Vector4 &vV2) |
Project the vector on to the plane created by two direction vectors. | |
PLMATH_API PLCore::String | ToString () const |
To string. | |
PLMATH_API bool | FromString (const PLCore::String &sString) |
From string. | |
Public Attributes | |
union { | |
float fV [4] | |
Vertex element array access. | |
struct { | |
float x | |
float y | |
float z | |
float w | |
} | |
Known vertex element names when dealing with positions or directions. | |
}; | |
Some direct vertex element accesses. | |
Static Public Attributes | |
static PLMATH_API const Vector4 | Zero |
static PLMATH_API const Vector4 | One |
static PLMATH_API const Vector4 | NegativeOne |
static PLMATH_API const Vector4 | UnitX |
static PLMATH_API const Vector4 | UnitY |
static PLMATH_API const Vector4 | UnitZ |
static PLMATH_API const Vector4 | UnitW |
static PLMATH_API const Vector4 | NegativeUnitX |
static PLMATH_API const Vector4 | NegativeUnitY |
static PLMATH_API const Vector4 | NegativeUnitZ |
static PLMATH_API const Vector4 | NegativeUnitW |
4D vector
PLMath::Vector4::Vector4 | ( | ) | [inline] |
Default constructor setting the components to (0, 0, 0, 1)
PLMath::Vector4::Vector4 | ( | float | fX, |
float | fY, | ||
float | fZ = 0.0f , |
||
float | fW = 1.0f |
||
) | [inline] |
PLMath::Vector4::Vector4 | ( | const float | fV[] | ) | [inline] |
PLMATH_API PLMath::Vector4::Vector4 | ( | const Vector2 & | vV, |
float | fZ = 0.0f , |
||
float | fW = 1.0f |
||
) |
PLMATH_API PLMath::Vector4::Vector4 | ( | const Vector3 & | vV, |
float | fW = 1.0f |
||
) |
PLMath::Vector4::Vector4 | ( | const Vector4 & | vV | ) | [inline] |
PLMath::Vector4::Vector4 | ( | const PLCore::String & | sString | ) | [inline] |
PLMath::Vector4::~Vector4 | ( | ) | [inline] |
Vector4 & PLMath::Vector4::operator= | ( | const float | fV[] | ) | [inline] |
bool PLMath::Vector4::operator== | ( | const Vector4 & | vV | ) | const [inline] |
Compares two vectors.
[in] | vV | Vector to compare with |
bool PLMath::Vector4::operator!= | ( | const Vector4 & | vV | ) | const [inline] |
Compares two vectors.
[in] | vV | Vector to compare with |
bool PLMath::Vector4::operator< | ( | const Vector4 & | vV | ) | const [inline] |
Compares two vectors lexicographically.
[in] | vV | Vector to compare with |
bool PLMath::Vector4::operator> | ( | const Vector4 & | vV | ) | const [inline] |
Compares two vectors lexicographically.
[in] | vV | Vector to compare with |
bool PLMath::Vector4::operator<= | ( | const Vector4 & | vV | ) | const [inline] |
Compares two vectors lexicographically.
[in] | vV | Vector to compare with |
bool PLMath::Vector4::operator>= | ( | const Vector4 & | vV | ) | const [inline] |
Compares two vectors lexicographically.
[in] | vV | Vector to compare with |
Vector4 PLMath::Vector4::operator+ | ( | float | fN | ) | const [inline] |
Vector4 & PLMath::Vector4::operator+= | ( | float | fN | ) | [inline] |
Vector4 PLMath::Vector4::operator- | ( | ) | const [inline] |
Vector4 PLMath::Vector4::operator- | ( | float | fN | ) | const [inline] |
Vector4 & PLMath::Vector4::operator-= | ( | float | fN | ) | [inline] |
Per component multiplication.
[in] | vV | Vector to multiplicate with |
Vector4 PLMath::Vector4::operator* | ( | float | fS | ) | const [inline] |
Per component multiplication.
[in] | vV | Vector to multiplicate with |
Vector4 & PLMath::Vector4::operator*= | ( | float | fS | ) | [inline] |
Transforms the vector.
[in] | mTrans | Matrix which transforms the vector |
Per component division.
[in] | vV | Vector to divide through |
Vector4 PLMath::Vector4::operator/ | ( | float | fS | ) | const [inline] |
Per component division.
[in] | vV | Vector to divide through |
Vector4 & PLMath::Vector4::operator/= | ( | float | fS | ) | [inline] |
PLMATH_API PLMath::Vector4::operator Vector3 | ( | ) |
PLMath::Vector4::operator float * | ( | ) | [inline] |
PLMath::Vector4::operator const float * | ( | ) | const [inline] |
float & PLMath::Vector4::operator[] | ( | int | nIndex | ) | [inline] |
const float & PLMath::Vector4::operator[] | ( | int | nIndex | ) | const [inline] |
void PLMath::Vector4::GetXYZW | ( | float & | fX, |
float & | fY, | ||
float & | fZ, | ||
float & | fW | ||
) | const [inline] |
float PLMath::Vector4::GetX | ( | ) | const [inline] |
float PLMath::Vector4::GetY | ( | ) | const [inline] |
float PLMath::Vector4::GetZ | ( | ) | const [inline] |
float PLMath::Vector4::GetW | ( | ) | const [inline] |
void PLMath::Vector4::SetXYZ | ( | float | fX = 0.0f , |
float | fY = 0.0f , |
||
float | fZ = 0.0f |
||
) | [inline] |
void PLMath::Vector4::SetXYZ | ( | const float | fV[] | ) | [inline] |
PLMATH_API void PLMath::Vector4::SetXYZ | ( | const Vector3 & | vV | ) |
void PLMath::Vector4::SetXYZW | ( | float | fX = 0.0f , |
float | fY = 0.0f , |
||
float | fZ = 0.0f , |
||
float | fW = 1.0f |
||
) | [inline] |
void PLMath::Vector4::SetXYZW | ( | const float | fV[] | ) | [inline] |
PLMATH_API void PLMath::Vector4::SetXYZW | ( | const Vector3 & | vV, |
float | fW = 1.0f |
||
) |
void PLMath::Vector4::SetX | ( | float | fX = 0.0f | ) | [inline] |
void PLMath::Vector4::SetY | ( | float | fY = 0.0f | ) | [inline] |
void PLMath::Vector4::SetZ | ( | float | fZ = 0.0f | ) | [inline] |
void PLMath::Vector4::SetW | ( | float | fW = 1.0f | ) | [inline] |
void PLMath::Vector4::IncXYZW | ( | float | fX = 0.0f , |
float | fY = 0.0f , |
||
float | fZ = 0.0f , |
||
float | fW = 0.0f |
||
) | [inline] |
void PLMath::Vector4::IncXYZW | ( | const float | fV[] | ) | [inline] |
void PLMath::Vector4::IncX | ( | float | fX | ) | [inline] |
void PLMath::Vector4::IncY | ( | float | fY | ) | [inline] |
void PLMath::Vector4::IncZ | ( | float | fZ | ) | [inline] |
void PLMath::Vector4::IncW | ( | float | fW | ) | [inline] |
bool PLMath::Vector4::IsNull | ( | ) | const [inline] |
Returns whether the vector is null or not.
bool PLMath::Vector4::IsPacked | ( | ) | const [inline] |
Returns whether the vector is packed (within range of 0-1) or not.
void PLMath::Vector4::PackTo01 | ( | ) | [inline] |
Packs/clamps the vector into a range of 0-1.
Vector4 PLMath::Vector4::GetPackedTo01 | ( | ) | const [inline] |
Returns a vector which is packed/clamped into the range of 0-1.
void PLMath::Vector4::UnpackFrom01 | ( | ) | [inline] |
Unpacks the packed vector into a range of -1 to 1.
Vector4 PLMath::Vector4::GetUnpackedFrom01 | ( | ) | const [inline] |
Returns a unpacked vector of the range of -1 to 1.
Vector4::Component PLMath::Vector4::GetSmallestComponent | ( | ) | const [inline] |
Returns the smallest component.
float PLMath::Vector4::GetSmallestValue | ( | ) | const [inline] |
Returns the value of the smallest component.
Vector4::Component PLMath::Vector4::GetGreatestComponent | ( | ) | const [inline] |
Returns the greatest component.
float PLMath::Vector4::GetGreatestValue | ( | ) | const [inline] |
Returns the value of the greatest component.
void PLMath::Vector4::Invert | ( | ) | [inline] |
Inverts the vector.
Vector4 PLMath::Vector4::GetInverted | ( | ) | const [inline] |
float PLMath::Vector4::GetLength | ( | ) | const [inline] |
Returns the length of the vector (also called magnitude)
float PLMath::Vector4::GetSquaredLength | ( | ) | const [inline] |
Returns the squared length of the vector (also called norm)
void PLMath::Vector4::SetLength | ( | float | fLength = 1.0f | ) | [inline] |
Sets the vector to the given length.
[in] | fLength | Length to set |
Vector4 & PLMath::Vector4::Normalize | ( | ) | [inline] |
Normalizes the vector.
Vector4 PLMath::Vector4::GetNormalized | ( | ) | const [inline] |
float PLMath::Vector4::GetDistance | ( | const Vector4 & | vV | ) | const [inline] |
Returns the distance to another vector.
[in] | vV | The other vector |
float PLMath::Vector4::GetSquaredDistance | ( | const Vector4 & | vV | ) | const [inline] |
Returns the squared distance to another vector.
[in] | vV | The other vector |
float PLMath::Vector4::DotProduct | ( | const Vector4 & | vV | ) | const [inline] |
Returns the dot product of two vectors.
[in] | vV | Second vector |
Vector4 PLMath::Vector4::ProjectVector | ( | const Vector4 & | vA, |
const Vector4 & | vB | ||
) | const [inline] |
Project vector a onto another vector b.
Project the vector onto another vector.
[in] | vA | Vector to project |
[in] | vB | Vector to project onto |
^. / . / . a / . / . a.DotProduct(b) / . projb(a) = b * ----------------- / . b.DotProduct(b) / . --->____. b ^= projb(a)
float PLMath::Vector4::GetAngle | ( | const Vector4 & | vV | ) | const [inline] |
Calculates the angle between two vectors.
[in] | vV | Second vector |
v1.DotProduct(v2) cos A = -------------------------------- v1.GetLength() * v2.GetLength()
PLMATH_API Vector4& PLMath::Vector4::GetProjection | ( | const Vector4 & | vX, |
const Vector4 & | vN | ||
) |
Calculates a normalized projection vector.
[in] | vX | The first vector to calculate the projection from |
[in] | vN | The second vector to calculate the projection from |
PLMATH_API Vector4& PLMath::Vector4::ProjectPlane | ( | const Vector4 & | vV1, |
const Vector4 & | vV2 | ||
) |
Project the vector on to the plane created by two direction vectors.
[in] | vV1 | First of the two direction vectors creating the plane |
[in] | vV2 | Second of the two direction vectors creating the plane |
PLMATH_API PLCore::String PLMath::Vector4::ToString | ( | ) | const |
To string.
PLMATH_API bool PLMath::Vector4::FromString | ( | const PLCore::String & | sString | ) |
From string.
[in] | sString | String with the data |
PLMATH_API const Vector4 PLMath::Vector4::Zero [static] |
0.0, 0.0, 0.0, 0.0
PLMATH_API const Vector4 PLMath::Vector4::One [static] |
1.0, 1.0, 1.0, 1.0
PLMATH_API const Vector4 PLMath::Vector4::NegativeOne [static] |
-1.0, -1.0, -1.0, -1.0
PLMATH_API const Vector4 PLMath::Vector4::UnitX [static] |
1.0, 0.0, 0.0, 1.0
PLMATH_API const Vector4 PLMath::Vector4::UnitY [static] |
0.0, 1.0, 0.0, 1.0
PLMATH_API const Vector4 PLMath::Vector4::UnitZ [static] |
0.0, 0.0, 1.0, 1.0
PLMATH_API const Vector4 PLMath::Vector4::UnitW [static] |
0.0, 0.0, 0.0, 1.0
PLMATH_API const Vector4 PLMath::Vector4::NegativeUnitX [static] |
-1.0, 0.0, 0.0, 1.0
PLMATH_API const Vector4 PLMath::Vector4::NegativeUnitY [static] |
0.0, -1.0, 0.0, 1.0
PLMATH_API const Vector4 PLMath::Vector4::NegativeUnitZ [static] |
0.0, 0.0, -1.0, 1.0
PLMATH_API const Vector4 PLMath::Vector4::NegativeUnitW [static] |
0.0, 0.0, 0.0, -1.0
float PLMath::Vector4::fV[4] |
Vertex element array access.
float PLMath::Vector4::x |
float PLMath::Vector4::y |
float PLMath::Vector4::z |
float PLMath::Vector4::w |
union { ... } |
Some direct vertex element accesses.
|