Vector64 Struct Reference

#include <ge_lvector.h>

Detailed Description

Represents a double precision vector.

Components

Float64 x
 
Float64 y
 
Float64 z
 

Constructors

 Vector64 ()
 
 Vector64 (Float64 ix, Float64 iy, Float64 iz)
 
 Vector64 (_DONTCONSTRUCT v)
 
 Vector64 (const Vector32 &v)
 
 Vector64 (Float64 in)
 

Get/Set Components

Float64operator[] (Int l)
 
const Float64operator[] (Int l) const
 

Math Operations

Bool IsZero () const
 
Bool IsNotZero () const
 
void SetZero ()
 
Bool IsEqual (const Vector64 &v2, const Float64 &epsilon=0.01) const
 
Float64 GetAverage () const
 
Float64 GetSum () const
 
Float64 GetMin () const
 
Float64 GetMax () const
 
Vector64 Clamp01 () const
 
Float64 GetLength (void) const
 
Float64 GetSquaredLength (void) const
 
Vector64 GetNormalized (void) const
 
void Normalize (void)
 
Float64 GetAngle (const Vector64 &v1, const Vector64 &v2)
 
Float64 Dot (const Vector64 &v1, const Vector64 &v2)
 
Vector64 Cross (const Vector64 &v1, const Vector64 &v2)
 
Float64 Len (const Vector64 &v)
 

Operators

const Vector64operator+= (Float64 s)
 
const Vector64operator+= (const Vector64 &v)
 
const Vector64operator-= (Float64 s)
 
const Vector64operator-= (const Vector64 &v)
 
const Vector64operator*= (Float64 s)
 
const Vector64operator/= (Float64 s)
 
const Vector64operator*= (const Vector64 &v)
 
const Vector64 operator! (const Vector64 &v)
 
const Vector64 operator* (Float64 s, const Vector64 &v)
 
const Vector64 operator* (const Vector64 &v, Float64 s)
 
const Vector64 operator/ (const Vector64 &v, Float64 s)
 
const Vector64 operator* (const Vector64 &v1, const Vector64 &v2)
 
const Vector64 operator+ (Float64 s, const Vector64 &v)
 
const Vector64 operator+ (const Vector64 &v, Float64 s)
 
const Vector64 operator+ (const Vector64 &v1, const Vector64 &v2)
 
const Vector64 operator- (Float64 s, const Vector64 &v)
 
const Vector64 operator- (const Vector64 &v, Float64 s)
 
const Vector64 operator- (const Vector64 &v1, const Vector64 &v2)
 
const Vector64 operator- (const Vector64 &v)
 
Bool operator== (const Vector64 &v1, const Vector64 &v2)
 
Bool operator== (const Vector64 &v1, Float64 r)
 
Bool operator!= (const Vector64 &v1, Float64 r)
 
Bool operator!= (const Vector64 &v1, const Vector64 &v2)
 

Constructor & Destructor Documentation

§ Vector64() [1/5]

Vector64 ( )

Default constructor. Sets components to zero.

§ Vector64() [2/5]

Vector64 ( Float64  ix,
Float64  iy,
Float64  iz 
)
explicit

Constructs a vector with the given coordinates.

Parameters
[in]ixAssigned to x.
[in]iyAssigned to y.
[in]izAssigned to z.

§ Vector64() [3/5]

Vector64 ( _DONTCONSTRUCT  v)
explicit

Constructs an uninitialized vector.

Parameters
[in]vDummy argument. Pass DC.

§ Vector64() [4/5]

Vector64 ( const Vector32 v)
explicit

Constructs a double precision vector from a single precision vector.

Parameters
[in]vA single precision vector.

§ Vector64() [5/5]

Vector64 ( Float64  in)
explicit

Constructs a vector setting each component to the same in value.

Parameters
[in]inAssigned to x, y and z.

Member Function Documentation

§ operator[]() [1/2]

Float64& operator[] ( Int  l)

Sets a vector component.

Parameters
[in]lThe component index in the vector. 0 <= l < 2.
0 returns x, 1 returns y and 2 returns z.
Any other value must not be used and will crash.
Returns
The vector component to set.

§ operator[]() [2/2]

const Float64& operator[] ( Int  l) const

Gets a vector component.

Parameters
[in]lThe component index in the vector. 0 <= l < 2.
0 returns x, 1 returns y and 2 returns z.
Any other value must not be used and will crash.
Returns
The vector component to get.

§ IsZero()

Bool IsZero ( ) const

Checks if each component is zero.

Returns
true if each component is zero, otherwise false.

§ IsNotZero()

Bool IsNotZero ( ) const

Checks if one of the components is not zero.

Returns
true if one of the components is not zero, otherwise false.

§ SetZero()

void SetZero ( )

Sets all components to zero.

§ IsEqual()

Bool IsEqual ( const Vector64 v2,
const Float64 epsilon = 0.01 
) const

Checks component-wise if the difference between the vector and vector v2 is no bigger than epsilon.

Parameters
[in]v2The other vector to compare against.
[in]epsilonThe epsilon value.
Returns
true if the difference is no bigger than epsilon, otherwise false.

§ GetAverage()

Float64 GetAverage ( ) const

Calculates the average value of x, y and z components.

Returns
The average value of the vector components.

§ GetSum()

Float64 GetSum ( ) const

Calculates the sum of x, y and z components.

Returns
The sum of the vector components.

§ GetMin()

Float64 GetMin ( void  ) const

Gets the minimum of x, y and z components.

Returns
The minimum of the vector components.

§ GetMax()

Float64 GetMax ( void  ) const

Gets the maximum of x, y and z components.

Returns
The maximum of the vector components.

§ Clamp01()

Vector64 Clamp01 ( ) const

Gets the vector clamped to the range [0.0 .. 1.0].

Returns
The vector clamped to the range [0.0 .. 1.0].

§ GetLength()

Float64 GetLength ( void  ) const

Calculates the length of the vector.

See also
Len()
Returns
The length of the vector.

§ GetSquaredLength()

Float64 GetSquaredLength ( void  ) const

Calculates the squared length of the vector.

Returns
The squared length of the vector.

§ GetNormalized()

Vector64 GetNormalized ( void  ) const

Calculates the normalized vector, so that GetLength()==1.0.

See also
operator!()
Returns
The normalized vector.

§ Normalize()

void Normalize ( void  )

Normalizes the vector, so that GetLength()==1.0.

§ operator+=() [1/2]

const Vector64& operator+= ( Float64  s)

Adds scalar s to each vector component.

Parameters
[in]sThe scalar to add.
Returns
This vector.

§ operator+=() [2/2]

const Vector64& operator+= ( const Vector64 v)

Adds the vector and vector v.

Parameters
[in]vThe vector to add.
Returns
This vector.

§ operator-=() [1/2]

const Vector64& operator-= ( Float64  s)

Subtracts scalar s from each vector component.

Parameters
[in]sThe scalar to subtract.
Returns
This vector.

§ operator-=() [2/2]

const Vector64& operator-= ( const Vector64 v)

Subtracts vector v from the vector.

Parameters
[in]vThe vector to subtract.
Returns
This vector.

§ operator*=() [1/2]

const Vector64& operator*= ( Float64  s)

Multiplies each vector component by scalar s.

Parameters
[in]sThe scalar to multiply.
Returns
This vector.

§ operator/=()

const Vector64& operator/= ( Float64  s)

Divides each vector component by scalar s.

Parameters
[in]sThe dividing scalar.
Returns
This vector.

§ operator*=() [2/2]

const Vector64& operator*= ( const Vector64 v)

Multiplies the vector component-wise by vector v.

Parameters
[in]vThe vector to multiply.
Returns
This vector.

Friends And Related Function Documentation

§ GetAngle

Float64 GetAngle ( const Vector64 v1,
const Vector64 v2 
)
friend

Calculates the angle (in radians) between v1 and v2.

Parameters
[in]v1The first vector.
[in]v2The second vector.
Returns
The angle between v1 and v2.

§ Dot

Float64 Dot ( const Vector64 v1,
const Vector64 v2 
)
friend

Calculates the dot product of vectors v1 and v2.

Parameters
[in]v1The first vector.
[in]v2The second vector.
Returns
The dot product of v1 and v2.

§ Cross

Vector64 Cross ( const Vector64 v1,
const Vector64 v2 
)
friend

Calculates the cross product of vectors v1 and v2.

Parameters
[in]v1The first vector.
[in]v2The second vector.
Returns
The cross product of v1 and v2.

§ Len

Float64 Len ( const Vector64 v)
friend

Calculates the length of vector v.

See also
GetLength()
Parameters
[in]vThe vector.
Returns
The length of the vector.

§ operator!

const Vector64 operator! ( const Vector64 v)
friend

Calculates the normalized vector v.

See also
GetNormalized()
Parameters
[in]vThe vector.
Returns
The normalized vector.

§ operator* [1/3]

const Vector64 operator* ( Float64  s,
const Vector64 v 
)
friend

Multiplies each component of vector v by scalar s.

Parameters
[in]sThe scalar.
[in]vThe vector.
Returns
The scaled vector.

§ operator* [2/3]

const Vector64 operator* ( const Vector64 v,
Float64  s 
)
friend

Multiplies each component of vector v by scalar s.

Parameters
[in]vThe vector.
[in]sThe scalar.
Returns
The scaled vector.

§ operator/

const Vector64 operator/ ( const Vector64 v,
Float64  s 
)
friend

Divides each component of vector v by scalar s.

Parameters
[in]vThe vector.
[in]sThe scalar.
Returns
The scaled vector.

§ operator* [3/3]

const Vector64 operator* ( const Vector64 v1,
const Vector64 v2 
)
friend

Multiplies vectors v1 and v2 component-wise.

Parameters
[in]v1The first vector.
[in]v2The second vector.
Returns
The result of the vectors multiplication.

§ operator+ [1/3]

const Vector64 operator+ ( Float64  s,
const Vector64 v 
)
friend

Adds scalar s to each component of vector v.

Parameters
[in]sThe scalar.
[in]vThe vector.
Returns
The result vector.

§ operator+ [2/3]

const Vector64 operator+ ( const Vector64 v,
Float64  s 
)
friend

Adds scalar s to each component of vector v.

Parameters
[in]vThe vector.
[in]sThe scalar.
Returns
The result vector.

§ operator+ [3/3]

const Vector64 operator+ ( const Vector64 v1,
const Vector64 v2 
)
friend

Adds vectors v1 and v2 component-wise.

Parameters
[in]v1The first vector.
[in]v2The second vector.
Returns
The result of the vectors sum.

§ operator- [1/4]

const Vector64 operator- ( Float64  s,
const Vector64 v 
)
friend

Subtracts each component of vector v from scalar s.

Parameters
[in]sThe scalar.
[in]vThe vector.
Returns
The result vector.

§ operator- [2/4]

const Vector64 operator- ( const Vector64 v,
Float64  s 
)
friend

Subtracts scalar s from each component of vector v.

Parameters
[in]vThe vector.
[in]sThe scalar.
Returns
The result vector.

§ operator- [3/4]

const Vector64 operator- ( const Vector64 v1,
const Vector64 v2 
)
friend

Subtracts vector v1 and v2 component-wise.

Parameters
[in]v1The first vector.
[in]v2The second vector.
Returns
The result of the vectors subtraction.

§ operator- [4/4]

const Vector64 operator- ( const Vector64 v)
friend

Gets the negative of vector v.

Parameters
[in]vThe vector.
Returns
The negative vector.

§ operator== [1/2]

Bool operator== ( const Vector64 v1,
const Vector64 v2 
)
friend

Checks if vectors v1 and v2 are equal component-wise.

Parameters
[in]v1The first vector.
[in]v2The second vector.
Returns
true if the vectors are equal, otherwise false.

§ operator== [2/2]

Bool operator== ( const Vector64 v1,
Float64  r 
)
friend

Checks if each component of vector v1 is equal to scalar r.

Parameters
[in]v1The vector.
[in]rThe scalar.
Returns
true if the components are all equal to the scalar, otherwise false.

§ operator!= [1/2]

Bool operator!= ( const Vector64 v1,
Float64  r 
)
friend

Checks if any component of vector v1 is different to scalar r.

Parameters
[in]v1The vector.
[in]rThe scalar.
Returns
true if any component is different to the scalar, otherwise false.

§ operator!= [2/2]

Bool operator!= ( const Vector64 v1,
const Vector64 v2 
)
friend

Checks if vectors v1 and v2 are not equal component-wise.

Parameters
[in]v1The first vector.
[in]v2The second vector.
Returns
true if the vectors are not equal, otherwise false.

Member Data Documentation

§ x

X component.

§ y

Y component.

§ z

Z component.