Cyclone Cyclone: cyclone::Vector3 Class Reference

cyclone::Vector3 Class Reference

>Vector More...

#include <core.h>

Collaboration diagram for cyclone::Vector3:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Vector3 ()
 The default constructor creates a zero vector.
 Vector3 (const real x, const real y, const real z)
 The explicit constructor creates a vector with the given components.VectorIntro.
real operator[] (unsigned i) const
 <Omit;Vector
realoperator[] (unsigned i)
void operator+= (const Vector3 &v)
 Adds the given vector to this.
Vector3 operator+ (const Vector3 &v) const
 Returns the value of the given vector added to this.VectorAddition.
void operator-= (const Vector3 &v)
 Subtracts the given vector from this.
Vector3 operator- (const Vector3 &v) const
 Returns the value of the given vector subtracted from this.VectorSubtraction.
void operator *= (const real value)
 Multiplies this vector by the given scalar.
Vector3 operator * (const real value) const
 Returns a copy of this vector scaled the given value.ScalarMultiply.
Vector3 componentProduct (const Vector3 &vector) const
 Calculates and returns a component-wise product of this vector with the given vector.
void componentProductUpdate (const Vector3 &vector)
 Performs a component-wise product with the given vector and sets this vector to its result.ComponentProduct.
Vector3 vectorProduct (const Vector3 &vector) const
 Calculates and returns the vector product of this vector with the given vector.
void operator%= (const Vector3 &vector)
 Updates this vector to be the vector product of its current value and the given vector.
Vector3 operator% (const Vector3 &vector) const
 Calculates and returns the vector product of this vector with the given vector.VectorProduct.
real scalarProduct (const Vector3 &vector) const
 Calculates and returns the scalar product of this vector with the given vector.
real operator * (const Vector3 &vector) const
 Calculates and returns the scalar product of this vector with the given vector.ScalarProduct.
void addScaledVector (const Vector3 &vector, real scale)
 Adds the given vector to this, scaled by the given amount.ScaledVectorAddition.
real magnitude () const
 Gets the magnitude of this vector.
real squareMagnitude () const
 Gets the squared magnitude of this vector.
void normalise ()
 Turns a non-zero vector into a vector of unit length.Normalise.
bool operator== (const Vector3 &other) const
 Checks if the two vectors have identical components.
bool operator!= (const Vector3 &other) const
 Checks if the two vectors have non-identical components.
bool operator< (const Vector3 &other) const
 Checks if this vector is component-by-component less than the other.
bool operator> (const Vector3 &other) const
 Checks if this vector is component-by-component less than the other.
bool operator<= (const Vector3 &other) const
 Checks if this vector is component-by-component less than the other.
bool operator>= (const Vector3 &other) const
 Checks if this vector is component-by-component less than the other.
void clear ()
 Zero all the components of the vector.
void invert ()
 Flips all the components of the vector.

Public Attributes

real x
 Holds the value along the x axis.
real y
 Holds the value along the y axis.
real z
 Holds the value along the z axis.

Static Public Attributes

static const Vector3 GRAVITY
static const Vector3 HIGH_GRAVITY
static const Vector3 UP
static const Vector3 RIGHT
static const Vector3 OUT
static const Vector3 X
static const Vector3 Y
static const Vector3 Z

Detailed Description

>Vector

Four data members are allocated to ensure alignment in an array. /<VectorIntro

Note:
This class contains a lot of inline methods for basic mathematics. The implementations are included in the header file. />VectorIntro


Constructor & Destructor Documentation

cyclone::Vector3::Vector3  )  [inline]
 

The default constructor creates a zero vector.

cyclone::Vector3::Vector3 const real  x,
const real  y,
const real  z
[inline]
 

The explicit constructor creates a vector with the given components.VectorIntro.


Member Function Documentation

void cyclone::Vector3::addScaledVector const Vector3 vector,
real  scale
[inline]
 

Adds the given vector to this, scaled by the given amount.ScaledVectorAddition.

void cyclone::Vector3::clear  )  [inline]
 

Zero all the components of the vector.

Vector3 cyclone::Vector3::componentProduct const Vector3 vector  )  const [inline]
 

Calculates and returns a component-wise product of this vector with the given vector.

void cyclone::Vector3::componentProductUpdate const Vector3 vector  )  [inline]
 

Performs a component-wise product with the given vector and sets this vector to its result.ComponentProduct.

void cyclone::Vector3::invert  )  [inline]
 

Flips all the components of the vector.

real cyclone::Vector3::magnitude  )  const [inline]
 

Gets the magnitude of this vector.

void cyclone::Vector3::normalise  )  [inline]
 

Turns a non-zero vector into a vector of unit length.Normalise.

real cyclone::Vector3::operator * const Vector3 vector  )  const [inline]
 

Calculates and returns the scalar product of this vector with the given vector.ScalarProduct.

Vector3 cyclone::Vector3::operator * const real  value  )  const [inline]
 

Returns a copy of this vector scaled the given value.ScalarMultiply.

void cyclone::Vector3::operator *= const real  value  )  [inline]
 

Multiplies this vector by the given scalar.

bool cyclone::Vector3::operator!= const Vector3 other  )  const [inline]
 

Checks if the two vectors have non-identical components.

Vector3 cyclone::Vector3::operator% const Vector3 vector  )  const [inline]
 

Calculates and returns the vector product of this vector with the given vector.VectorProduct.

void cyclone::Vector3::operator%= const Vector3 vector  )  [inline]
 

Updates this vector to be the vector product of its current value and the given vector.

Vector3 cyclone::Vector3::operator+ const Vector3 v  )  const [inline]
 

Returns the value of the given vector added to this.VectorAddition.

void cyclone::Vector3::operator+= const Vector3 v  )  [inline]
 

Adds the given vector to this.

Vector3 cyclone::Vector3::operator- const Vector3 v  )  const [inline]
 

Returns the value of the given vector subtracted from this.VectorSubtraction.

void cyclone::Vector3::operator-= const Vector3 v  )  [inline]
 

Subtracts the given vector from this.

bool cyclone::Vector3::operator< const Vector3 other  )  const [inline]
 

Checks if this vector is component-by-component less than the other.

Note:
This does not behave like a single-value comparison: !(a < b) does not imply (b >= a).

bool cyclone::Vector3::operator<= const Vector3 other  )  const [inline]
 

Checks if this vector is component-by-component less than the other.

Note:
This does not behave like a single-value comparison: !(a <= b) does not imply (b > a).

bool cyclone::Vector3::operator== const Vector3 other  )  const [inline]
 

Checks if the two vectors have identical components.

bool cyclone::Vector3::operator> const Vector3 other  )  const [inline]
 

Checks if this vector is component-by-component less than the other.

Note:
This does not behave like a single-value comparison: !(a < b) does not imply (b >= a).

bool cyclone::Vector3::operator>= const Vector3 other  )  const [inline]
 

Checks if this vector is component-by-component less than the other.

Note:
This does not behave like a single-value comparison: !(a <= b) does not imply (b > a).

real& cyclone::Vector3::operator[] unsigned  i  )  [inline]
 

real cyclone::Vector3::operator[] unsigned  i  )  const [inline]
 

<Omit;Vector

real cyclone::Vector3::scalarProduct const Vector3 vector  )  const [inline]
 

Calculates and returns the scalar product of this vector with the given vector.

real cyclone::Vector3::squareMagnitude  )  const [inline]
 

Gets the squared magnitude of this vector.

Vector3 cyclone::Vector3::vectorProduct const Vector3 vector  )  const [inline]
 

Calculates and returns the vector product of this vector with the given vector.


Member Data Documentation

const Vector3 cyclone::Vector3::GRAVITY [static]
 

const Vector3 cyclone::Vector3::HIGH_GRAVITY [static]
 

const Vector3 cyclone::Vector3::OUT [static]
 

const Vector3 cyclone::Vector3::RIGHT [static]
 

const Vector3 cyclone::Vector3::UP [static]
 

const Vector3 cyclone::Vector3::X [static]
 

real cyclone::Vector3::x
 

Holds the value along the x axis.

const Vector3 cyclone::Vector3::Y [static]
 

real cyclone::Vector3::y
 

Holds the value along the y axis.

const Vector3 cyclone::Vector3::Z [static]
 

real cyclone::Vector3::z
 

Holds the value along the z axis.


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