BasicVector3< Element > Class Template Reference

#include <Vector3.h>

Collaboration diagram for BasicVector3< Element >:
Collaboration graph
[legend]

Public Member Functions

 BasicVector3 ()
template<typename OtherElement >
 BasicVector3 (const BasicVector3< OtherElement > &other)
 BasicVector3 (const Element &x_, const Element &y_, const Element &z_)
 BasicVector3 (const Element *array)
 BasicVector3 (const std::string &str)
void set (const Element &x, const Element &y, const Element &z)
Element & x ()
Element & y ()
Element & z ()
const Element & x () const
const Element & y () const
const Element & z () const
bool operator== (const BasicVector3 &other) const
bool operator!= (const BasicVector3 &other) const
BasicVector3< Element > operator- () const
template<typename OtherElement >
BasicVector3< Element > operator+ (const BasicVector3< OtherElement > &other) const
template<typename OtherElement >
void operator+= (const BasicVector3< OtherElement > &other)
template<typename OtherElement >
BasicVector3< Element > operator- (const BasicVector3< OtherElement > &other) const
template<typename OtherElement >
void operator-= (const BasicVector3< OtherElement > &other)
template<typename OtherElement >
BasicVector3< Element > operator* (const BasicVector3< OtherElement > &other) const
template<typename OtherElement >
void operator*= (const BasicVector3< OtherElement > &other)
template<typename OtherElement >
BasicVector3< Element > operator* (const OtherElement &other) const
template<typename OtherElement >
void operator*= (const OtherElement &other)
template<typename OtherElement >
BasicVector3< Element > operator/ (const BasicVector3< OtherElement > &other) const
template<typename OtherElement >
void operator/= (const BasicVector3< OtherElement > &other)
template<typename OtherElement >
BasicVector3< Element > operator/ (const OtherElement &other) const
template<typename OtherElement >
void operator/= (const OtherElement &other)
double getLength () const
double getLengthSquared () const
BasicVector3< Element > getNormalised () const
template<typename OtherT >
Element dot (const BasicVector3< OtherT > &other) const
template<typename OtherT >
BasicVector3< Element > crossProduct (const BasicVector3< OtherT > &other) const
std::string toString () const
 operator const Element * () const
 operator Element * ()

Private Attributes

Element m_elements [3]

Detailed Description

template<typename Element>
class BasicVector3< Element >

Definition at line 25 of file Vector3.h.


Constructor & Destructor Documentation

template<typename Element>
BasicVector3< Element >::BasicVector3 (  )  [inline]

Definition at line 34 of file Vector3.h.

template<typename Element>
template<typename OtherElement >
BasicVector3< Element >::BasicVector3 ( const BasicVector3< OtherElement > &  other  )  [inline]

Definition at line 40 of file Vector3.h.

template<typename Element>
BasicVector3< Element >::BasicVector3 ( const Element &  x_,
const Element &  y_,
const Element &  z_ 
) [inline]

Construct a BasicVector3 with the 3 provided components.

Definition at line 49 of file Vector3.h.

template<typename Element>
BasicVector3< Element >::BasicVector3 ( const Element *  array  )  [inline]

Construct a BasicVector3 from a 3-element array. The array must be valid as no bounds checking is done.

Definition at line 59 of file Vector3.h.

template<typename Element>
BasicVector3< Element >::BasicVector3 ( const std::string str  )  [inline]

Construct a BasicVector3 by parsing the supplied string. The string must contain 3 numeric values separated by whitespace.

Parameters:
str The string from which component values are extracted.

Definition at line 72 of file Vector3.h.


Member Function Documentation

template<typename Element>
template<typename OtherT >
BasicVector3<Element> BasicVector3< Element >::crossProduct ( const BasicVector3< OtherT > &  other  )  const [inline]

Definition at line 315 of file Vector3.h.

Referenced by triangle_cross().

template<typename Element>
template<typename OtherT >
Element BasicVector3< Element >::dot ( const BasicVector3< OtherT > &  other  )  const [inline]
template<typename Element>
double BasicVector3< Element >::getLength (  )  const [inline]

Return the length of this vector.

Returns:
The Pythagorean length of this vector.

Definition at line 265 of file Vector3.h.

Referenced by BasicVector3< float >::getNormalised(), and EntityConnectionLine::render().

template<typename Element>
double BasicVector3< Element >::getLengthSquared (  )  const [inline]

Return the squared length of this vector.

Definition at line 274 of file Vector3.h.

template<typename Element>
BasicVector3<Element> BasicVector3< Element >::getNormalised (  )  const [inline]

Definition at line 283 of file Vector3.h.

Referenced by constrain_to_axis().

template<typename Element>
BasicVector3< Element >::operator const Element * (  )  const [inline]

Implicit cast to C-style array. This allows a Vector3 to be passed directly to GL functions that expect an array (e.g. glFloat3fv()). These functions implicitly provide operator[] as well, since the C-style array provides this function.

Definition at line 337 of file Vector3.h.

template<typename Element>
BasicVector3< Element >::operator Element * (  )  [inline]

Definition at line 342 of file Vector3.h.

template<typename Element>
bool BasicVector3< Element >::operator!= ( const BasicVector3< Element > &  other  )  const [inline]

Compare this BasicVector3 against another for inequality.

Definition at line 130 of file Vector3.h.

template<typename Element>
template<typename OtherElement >
BasicVector3<Element> BasicVector3< Element >::operator* ( const OtherElement &  other  )  const [inline]

Definition at line 205 of file Vector3.h.

template<typename Element>
template<typename OtherElement >
BasicVector3<Element> BasicVector3< Element >::operator* ( const BasicVector3< OtherElement > &  other  )  const [inline]

Definition at line 188 of file Vector3.h.

template<typename Element>
template<typename OtherElement >
void BasicVector3< Element >::operator*= ( const OtherElement &  other  )  [inline]

Definition at line 212 of file Vector3.h.

template<typename Element>
template<typename OtherElement >
void BasicVector3< Element >::operator*= ( const BasicVector3< OtherElement > &  other  )  [inline]

Definition at line 195 of file Vector3.h.

template<typename Element>
template<typename OtherElement >
BasicVector3<Element> BasicVector3< Element >::operator+ ( const BasicVector3< OtherElement > &  other  )  const [inline]

Definition at line 147 of file Vector3.h.

template<typename Element>
template<typename OtherElement >
void BasicVector3< Element >::operator+= ( const BasicVector3< OtherElement > &  other  )  [inline]

Definition at line 154 of file Vector3.h.

template<typename Element>
template<typename OtherElement >
BasicVector3<Element> BasicVector3< Element >::operator- ( const BasicVector3< OtherElement > &  other  )  const [inline]

Definition at line 165 of file Vector3.h.

template<typename Element>
BasicVector3<Element> BasicVector3< Element >::operator- (  )  const [inline]

Definition at line 138 of file Vector3.h.

template<typename Element>
template<typename OtherElement >
void BasicVector3< Element >::operator-= ( const BasicVector3< OtherElement > &  other  )  [inline]

Definition at line 172 of file Vector3.h.

template<typename Element>
template<typename OtherElement >
BasicVector3<Element> BasicVector3< Element >::operator/ ( const OtherElement &  other  )  const [inline]

Definition at line 241 of file Vector3.h.

template<typename Element>
template<typename OtherElement >
BasicVector3<Element> BasicVector3< Element >::operator/ ( const BasicVector3< OtherElement > &  other  )  const [inline]

Definition at line 224 of file Vector3.h.

template<typename Element>
template<typename OtherElement >
void BasicVector3< Element >::operator/= ( const OtherElement &  other  )  [inline]

Definition at line 248 of file Vector3.h.

template<typename Element>
template<typename OtherElement >
void BasicVector3< Element >::operator/= ( const BasicVector3< OtherElement > &  other  )  [inline]

Definition at line 231 of file Vector3.h.

template<typename Element>
bool BasicVector3< Element >::operator== ( const BasicVector3< Element > &  other  )  const [inline]

Compare this BasicVector3 against another for equality.

Definition at line 123 of file Vector3.h.

template<typename Element>
void BasicVector3< Element >::set ( const Element &  x,
const Element &  y,
const Element &  z 
) [inline]

Set all 3 components to the provided values.

Definition at line 86 of file Vector3.h.

template<typename Element>
std::string BasicVector3< Element >::toString (  )  const [inline]
Returns:
String representation of the vector - values are separated by space

Definition at line 324 of file Vector3.h.

template<typename Element>
const Element& BasicVector3< Element >::x (  )  const [inline]

Definition at line 108 of file Vector3.h.

template<typename Element>
Element& BasicVector3< Element >::x (  )  [inline]
template<typename Element>
const Element& BasicVector3< Element >::y (  )  const [inline]

Definition at line 112 of file Vector3.h.

template<typename Element>
Element& BasicVector3< Element >::y (  )  [inline]
template<typename Element>
const Element& BasicVector3< Element >::z (  )  const [inline]

Definition at line 116 of file Vector3.h.

template<typename Element>
Element& BasicVector3< Element >::z (  )  [inline]

Field Documentation

template<typename Element>
Element BasicVector3< Element >::m_elements[3] [private]

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

Generated by  doxygen 1.6.2