# CSIBCVector4D Class Reference

General purpuse 4D vector class. More...

`#include <SIBCVector.h>`

List of all members.

## Public Member Functions
| CSIBCVector4D ()
| CSIBCVector4D (const CSIBCVector4D &i_vVector)
| CSIBCVector4D (const SI_Float i_fX, const SI_Float i_fY, const SI_Float i_fZ, const SI_Float i_fW)
| CSIBCVector4D (const CSIBCVector3D &i_vVct, const SI_Float i_fW=1.0f)
SI_Bool | IsAlmostEqualTo (const CSIBCVector4D &i_vVector, const SI_Float i_fEpsilon)
SI_Bool | IsOrthogonalTo (const CSIBCVector4D &i_vVector)
SI_Bool | IsNull () const
SI_Float | GetDot (const CSIBCVector4D &i_vVector) const
SI_Float | GetDistanceFrom (const CSIBCVector4D &i_vVector) const
SI_Float | GetLength () const
SI_Float | GetSquaredLength () const
SI_Float | GetMaxComponent (SI_Int *o_nIndex) const
SI_Float | GetMinComponent (SI_Int *o_nIndex) const
void | Get (SI_Float *o_fX, SI_Float *o_fY, SI_Float *o_fZ, SI_Float *o_fW) const
CSIBCVector4D & | Set (SI_Float i_fX, SI_Float i_fY, SI_Float i_fZ, SI_Float i_fW)
CSIBCVector4D & | Normalize ()
CSIBCVector4D & | SetNull ()
CSIBCVector4D & | SetLength (const SI_Float i_fLength)
CSIBCVector4D & | Negate ()
CSIBCVector4D & | Add (const CSIBCVector4D &i_vVector)
CSIBCVector4D & | Sub (const CSIBCVector4D &i_vVector)
CSIBCVector4D & | Scale (const SI_Float i_fScale)
CSIBCVector4D & | MulComp (const CSIBCVector4D &i_vVector)
CSIBCVector4D & | DivComp (const CSIBCVector4D &i_vVector)
SI_Bool | operator== (const CSIBCVector4D &i_vVector) const
SI_Bool | operator!= (const CSIBCVector4D &i_vVector) const
CSIBCVector4D | operator+ (const CSIBCVector4D &i_vVector)
CSIBCVector4D | operator- (const CSIBCVector4D &i_vVector)
CSIBCVector4D | operator/ (const CSIBCVector4D &i_vVector)
CSIBCVector4D & | operator= (const CSIBCVector3D &i_vVector)
void | Dump ()
## Public Attributes
float | m_fX
float | m_fY
float | m_fZ
float | m_fW

## Detailed Description

General purpuse 4D vector class.

Representation of a 4D vector, defining operations to access, modify and perform calculations on 2D vectors. This class uses single precision floating-point numbers for represent its data, and in its operations. There are seperate similar classes for 2D and 3D vectors, CSIBCVector2D and CSIBCVector3D, respectively, which also use single precision.

Furthermore, there is another set of vector classes which use double precision floating-point numbers, CSIBCVector2Dd, CSIBCVector3Dd and CSIBCVector4Dd for 2D, 3D and 4D vectors respectively. Quaternions represented as 4D vectors are also available in CSIBCQuaternion and CSIBCQuaterniond with single precision and double precision, repspectively.

## Constructor & Destructor Documentation

CSIBCVector4D | ( |  | ) | `[inline]`

Default constructor. Sets the values of each component of this vector to zero.

CSIBCVector4D | ( | const CSIBCVector4D & | i_vVector | ) | `[inline]`

Copy constructor. Sets the new vector's component values to be the same as `i_vVector`.

Parameters:

  | i_vVector | Vector to use for new vector's component values.

CSIBCVector4D | ( | const SI_Float | i_fX,
|  | const SI_Float | i_fY,
|  | const SI_Float | i_fZ,
|  | const SI_Float | i_fW |
| ) |  |  | `[inline]`

Constructor. Sets the new vector to have `i_fX`, `i_fY`, `i_fZ` and `i_fW` for its X, Y, Z and W components, respectively.

Parameters:

  | i_fX | The value for the X component of the new vector.
  | i_fY | The value for the Y component of the new vector.
  | i_fZ | The value for the Z component of the new vector.
  | i_fW | The value for the W component of the new vector.

CSIBCVector4D | ( | const CSIBCVector3D & | i_vVct,
|  | const SI_Float | i_fW = `1.0f` |
| ) |  |  | `[inline]`

Constructor. Sets the new vector to have the X, Y and Z components values of `i_vVct`, and the W component `i_fW`.

Parameters:

  | i_vVct | The vector containing the X, Y and Z components to use for the new vector.
  | i_fW | The W value for the new vector (defaults to 1.0f).

## Member Function Documentation

SI_Bool IsAlmostEqualTo | ( | const CSIBCVector4D & | i_vVector,
|  | const SI_Float | i_fEpsilon |
| ) |  |  | `[inline]`

Determines whether this vector and `i_vVector` are equal to each other, within a threshhold value given by i_fEpsilon.

Parameters:

  | i_vVector | Vector to compare equality with.
  | i_fEpsilon | Error range for floating-point comparison.

Returns:
  SI_Bool TRUE if the vectors are equal, FALSE otherwise.

See also:
  CSIBCVector4D::IsOrthogonalTo

  CSIBCVector4D::IsNull

  CSIBCVector4D::operator==

SI_Bool IsOrthogonalTo | ( | const CSIBCVector4D & | i_vVector | ) | `[inline]`

Determines whether this vector and `i_vVector` are orthogonal (at 90 degrees to each other). This function uses a floating-point comparison error of SIBCVECTOR_EPS.

Parameters:

  | i_vVector | The vector to compare orthogonality with.

Returns:
  SI_Bool TRUE if the vectors are orthogonal, FALSE otherwise.

See also:
  CSIBCVector4D::IsAlmostEqualTo

  CSIBCVector4D::IsNull

  CSIBCVector4D::GetDot

SI_Bool IsNull | ( |  | ) | const`[inline]`

Determines whether all of the components of this vector are zero. This function uses a floating-point comparison error of SIBCVECTOR_EPS.

Returns:
  SI_Bool TRUE if all of the vector's components are zero, FALSE otherwise.

See also:
  CSIBCVector4D::IsAlmostEqualTo

  CSIBCVector4D::IsNull

SI_Float GetDot | ( | const CSIBCVector4D & | i_vVector | ) | const`[inline]`

Computes the dot product between this vector and `i_vVector`.

Parameters:

  | i_vVector | Vector to dot-product with this vector.

Returns:
  SI_Float Dot product of the two vectors.

See also:
  CSIBCVector4D::IsOrthogonalTo

SI_Float GetDistanceFrom | ( | const CSIBCVector4D & | i_vVector | ) | const`[inline]`

Returns the distance between this vector and `i_vVector`.

Parameters:

  | i_vVector | Vector to determine distance from.

Returns:
  SI_Float Distance from this vector to `i_vVector`.

See also:
  CSIBCVector4D::GetLength

SI_Float GetLength | ( |  | ) | const`[inline]`

Returns the length of this vector.

Returns:
  SI_Float The length of this vector.

See also:
  CSIBCVector4D::GetSquaredLength

  CSIBCVector4D::GetMaxComponent

  CSIBCVector4D::GetMinComponent

SI_Float GetSquaredLength | ( |  | ) | const`[inline]`

Returns the squared length of this vector.

Returns:
  SI_Float The squared length of this vector.

See also:
  CSIBCVector4D::GetLength

  CSIBCVector4D::GetMaxComponent

  CSIBCVector4D::GetMinComponent

SI_Float GetMaxComponent | ( | SI_Int * | o_nIndex | ) | const

Returns the value and index of the maximum component of this vector.

Parameters:

  | o_nIndex | Pointer to an SI_Int to hold the value of the index that had the maximum component (0 == X, 1 == Y, 2 == Z, 3 == W).

Returns:
  SI_Float The value of the maximum component of this vector.

See also:
  CSIBCVector4D::Get

SI_Float GetMinComponent | ( | SI_Int * | o_nIndex | ) | const

Returns the value and index of the minimum component of this vector.

Parameters:

  | o_nIndex | Pointer to an SI_Int to hold the value of the index that had the maximum component (0 == X, 1 == Y, 2 == Z, 3 == W).

Returns:
  SI_Float The value of the maximum component of this vector.

See also:
  CSIBCVector4D::Get

void Get | ( | SI_Float * | o_fX,
|  | SI_Float * | o_fY,
|  | SI_Float * | o_fZ,
|  | SI_Float * | o_fW |
| ) |  |  | const`[inline]`

Gets the values of the vector components.

Parameters:

  | o_fX | Pointer to an SI_Float to receive the value of the X component.
  | o_fY | Pointer to an SI_Float to receive the value of the Y component.
  | o_fZ | Pointer to an SI_Float to receive the value of the Z component.
  | o_fW | Pointer to an SI_Float to receive the value of the W component.

See also:
  CSIBCVector4D::Set

CSIBCVector4D & Set | ( | SI_Float | i_fX,
|  | SI_Float | i_fY,
|  | SI_Float | i_fZ,
|  | SI_Float | i_fW |
| ) |  |  | `[inline]`

Sets the values of the X, Y, Z and W components of this vector.

Parameters:

  | i_fX | The new value for the X component of this vector.
  | i_fY | The new value for the Y component of this vector.
  | i_fZ | The new value for the Z component of this vector.
  | i_fW | The new value for the W component of this vector.

Returns:
  CSIBCVector4D& Reference to this vector.

See also:
  CSIBCVector4D::Get

  CSIBCVector4D::operator=

CSIBCVector4D & Normalize | ( |  | ) | `[inline]`

Normalizes the vector to a length of one. If the vector is null, then it is initialized to (1.0f, 0.0f, 0.0f, 0.0f).

Returns:
  CSIBCVector4D& Reference to this vector.

See also:
  CSIBCVector4D::SetLength

  CSIBCVector4D::GetLength

CSIBCVector4D & SetNull | ( |  | ) | `[inline]`

Sets this vector to null. (Components equal 0.0f).

Returns:
  CSIBCVector4D& Reference to this vector.

See also:
  CSIBCVector4D::IsNull

  CSIBCVector4D::Set

CSIBCVector4D & SetLength | ( | const SI_Float | i_fLength | ) | `[inline]`

Sets the length of this vector to be `i_fLength`. If the vector is null (See CSIBCVector4D::IsNull), then the vector is unchanged.

Parameters:

  | i_fLength | New length of the vector.

Returns:
  CSIBCVector4D& Reference to this vector.

See also:
  CSIBCVector4D::GetLength

  CSIBCVector4D::Set

CSIBCVector4D & Negate | ( |  | ) | `[inline]`

Sets all the components of this vector to be the negatives of their current values.

Returns:
  CSIBCVector4D& Reference to this vector.

See also:
  CSIBCVector4D::Set

CSIBCVector4D & Add | ( | const CSIBCVector4D & | i_vVector | ) | `[inline]`

Adds this vector to `i_vVector`, and stores the result in this vector.

Parameters:

  | i_vVector | The vector to add to this vector.

Returns:
  CSIBCVector4D& Reference to this vector.

See also:
  CSIBCVector4D::Sub

CSIBCVector4D & Sub | ( | const CSIBCVector4D & | i_vVector | ) | `[inline]`

Subtracts `i_vVector` from this vector, and stores the result in this vector.

Parameters:

  | i_vVector | The vector to subtract from this vector.

Returns:
  CSIBCVector4D& Reference to this vector.

See also:
  CSIBCVector4D::Add

CSIBCVector4D & Scale | ( | const SI_Float | i_fScale | ) | `[inline]`

Scales all components of this vector by `i_fScale`.

Parameters:

  | i_fScale | The amount to scale each of the components of this vector by.

Returns:
  CSIBCVector4D& Reference to this vector.

See also:
  CSIBCVector4D::SetLength

CSIBCVector4D & MulComp | ( | const CSIBCVector4D & | i_vVector | ) | `[inline]`

Multiplies each component in this vector by its corresponding component in `i_vVector`. The result is stored in this vector.

Parameters:

  | i_vVector | Vector to multiply components with this vector.

Returns:
  CSIBCVector4D& Reference to this vector

See also:
  CSIBCVector4D::DivComp

CSIBCVector4D & DivComp | ( | const CSIBCVector4D & | i_vVector | ) | `[inline]`

Divides each component in this vector by its corresponding component in `i_vVector`. The result is stored in this vector.

Parameters:

  | i_vVector | Vector to divide components with this vector.

Returns:
  CSIBCVector4D& Reference to this vector.

See also:
  CSIBCVector4D::operator/

  CSIBCVector4D::MulComp

SI_Bool operator== | ( | const CSIBCVector4D & | i_vVector | ) | const`[inline]`

Determines whether this vector and `i_vVector` are equal. Note that this function does not use any floating-point comparison error, thus the two vectors must be exactly the same.

Parameters:

  | i_vVector | Vector to compare equality with.

Returns:
  SI_Bool TRUE if the vectors are equal, FALSE otherwise.

See also:
  CSIBCVector4D::IsAlmostEqualTo

  CSIBCVector4D::operator!=

SI_Bool operator!= | ( | const CSIBCVector4D & | i_vVector | ) | const`[inline]`

Determines whether this vector and `i_vVector` are not-equal. Note that this function does not use any floating-point comparison error, thus the two vectors must be exactly the same for a FALSE return value.

Parameters:

  | i_vVector | Vector to compare inequality with.

Returns:
  SI_Bool TRUE if the vectors are not equal, FALSE otherwise.

See also:
  CSIBCVector4D::IsAlmostEqualTo

  CSIBCVector4D::operator==

CSIBCVector4D operator+ | ( | const CSIBCVector4D & | i_vVector | ) | `[inline]`

Computes the vector addition between this vector and `i_vVector`.

Parameters:

  | i_vVector | The vector to add this vector with.

Returns:
  CSIBCVector4D The result of the addition.

See also:
  CSIBCVector4D::Add

  CSIBCVector4D::operator-

CSIBCVector4D operator- | ( | const CSIBCVector4D & | i_vVector | ) | `[inline]`

Computes the vector subtraction of `i_vVector` from this vector.

Parameters:

  | i_vVector | The vector to subtract from this vector.

Returns:
  CSIBCVector4D The result of the subtraction.

See also:
  CSIBCVector4D::Sub

  CSIBCVector4D::operator+

CSIBCVector4D operator/ | ( | const CSIBCVector4D & | i_vVector | ) | `[inline]`

Divides each component in this vector by its corresponding component in `i_vVector`.

Parameters:

  | i_vVector | Vector to divide components with this vector.

Returns:
  CSIBCVector4D The result of the divisions.

See also:
  CSIBCVector4D::DivComp

CSIBCVector4D & operator= | ( | const CSIBCVector3D & | i_vVector | ) | `[inline]`

Sets this vector to be equal to `i_vVector`.

Parameters:

  | i_vVector | The vector to copy data from.

Returns:
  CSIBCVector4D& Reference to this vector.

See also:
  CSIBCVector4D::Set

void Dump | ( |  | ) |

Outputs the memory location of this object, and the values of each of its components.

See also:
  SIBCVector4D::Get

## Member Data Documentation

float m_fX

The X component of this vector.

float m_fY

The Y component of this vector.

float m_fZ

The Z component of this vector.

float m_fW

The W component of this vector.

The documentation for this class was generated from the following file:

- SIBCVector.h