Vector< 3, real_t > Struct Template Reference

Specialized template implementation for Vector3, accelerated to support efficient SIMD vectorization via SSE intrinsics. More...

#include <Vector3SSE.h>

Inheritance diagram for Vector< 3, real_t >:

SSEAligned

List of all members.

Public Member Functions

Constructors
 Vector (const real_t *srcData)
 Expects N arguments of type float.
 Vector ()
 Constructs a zero Vector.
 Vector (const Vector< 3, real_t > &v)
 Copy Constructor.
 Vector (const m128f_t &v)
 SSE copy constructor.
Accessor Operators
const real_toperator[] (const unsigned index) const
real_toperator[] (const unsigned index)
const real_toperator* () const
real_toperator* ()
Implicit casting Operators
 operator m128f_t () const
Equality Operators
bool operator== (const Vector< 3, real_t > &v) const
bool operator!= (const Vector< 3, real_t > &v) const
Mutator Operators
Vector< 3, real_t > & operator= (const Vector< 3, real_t > &v)
Vector< 3, real_t > & operator+= (const Vector< 3, real_t > &rhs)
Vector< 3, real_t > & operator-= (const Vector< 3, real_t > &rhs)
Scalar Mutator Operators
Vector< 3, real_t > & operator*= (const real_t &scale)
Vector< 3, real_t > & operator/= (const real_t &scale)
Arithmetic Operators
Vector< 3, real_toperator+ (const Vector< 3, real_t > &rhs) const
Vector< 3, real_toperator- (const Vector< 3, real_t > &rhs) const
Vector< 3, real_toperator* (const Vector< 3, real_t > &rhs) const
Scalar Arithmetic Operators
Vector< 3, real_toperator* (const real_t &scale) const
Vector< 3, real_toperator/ (const real_t &scale) const
More Complex Functionality
bool isUnit () const
bool isZero () const
Vector< 3, real_tgetNormalized () const
Vector< 3, real_tgetReciprocal () const
real_t normalize ()
 Normalizes this Vector and returns the old magnitude.
real_t getMagnitude () const
real_t getMagnitude2 () const
real_t getDistance (const Vector< 3, real_t > &v) const
real_t getDistance2 (const Vector< 3, real_t > &v) const
real_t getSum () const
real_t getAverage () const
real_t dot (const Vector< 3, real_t > &rhs) const
unsigned getMaxDimension () const
unsigned getMinDimension () const
void cleanup ()
 Cleans up vector (0's out entries that are less than epsilon).
Specialized Vector Functionality
 Vector (const real_t &v0, const real_t &v1=0, const real_t &v2=0)
 Convenience Constructor.
Vector< 3, real_tcross (const Vector< 3, real_t > &rhs) const
Vector< 3, real_treflectVector (const Vector< 3, real_t > &normal) const
Vector< 3, real_trefractVector (const Vector< 3, real_t > &normal, real_t in, real_t out=1.0f) const
void getOrthonormalBasis (Vector< 3, real_t > &U, Vector< 3, real_t > &V)

Static Public Member Functions

Static convenience constructors to generate common matrices
See also:
also SIMD.h


static Vector< 3, real_tzero ()
 Generates a vector full of zeroes.
static Vector< 3, real_tones ()
 Generates a vector full of ones.
static Vector< 3, real_tfill (const real_t &val)
 Generates a vector filled with the specified value.
static Vector< 3, real_tmin (const Vector< 3, real_t > &v1, const Vector< 3, real_t > &v2)
static Vector< 3, real_tmax (const Vector< 3, real_t > &v1, const Vector< 3, real_t > &v2)
static Vector< 3, real_tinfinity ()
 Generates a vector filled with the maximum real_t (infinity).
static Vector< 3, real_tnegativeInfinity ()
 Generates a vector filled with the minimum real_t (negative infinity).
static Vector< 3, real_tfromSpherical (real_t theta, real_t phi)
 theta is latitude angle; phi is longitude angle

Public Attributes

SSE_ALIGN16_PRE union Vector
< 3, real_t >:: { ... }  
SSE_ALIGN16_POST
float data [4]
 Underlying data stored as an N-length array of type T.
m128f_t vec
 Also accessible via a native SSE 128-bit register.
real_t x
real_t y
real_t z
real_t w


Detailed Description

template<>
struct Vector< 3, real_t >

Specialized template implementation for Vector3, accelerated to support efficient SIMD vectorization via SSE intrinsics.

Note:
implementation uses single-precision floating point arithmetic
See also:
for more information on SSE and SIMD: ftp://download.intel.com/support/performancetools/c/linux/v9/intref_cls.pdf

Definition at line 32 of file Vector3SSE.h.


Constructor & Destructor Documentation

Vector< 3, real_t >::Vector ( const real_t srcData  )  [inline]

Expects N arguments of type float.

Definition at line 23 of file Vector3SSE.inl.

Vector< 3, real_t >::Vector (  )  [inline]

Constructs a zero Vector.

Definition at line 28 of file Vector3SSE.inl.

Vector< 3, real_t >::Vector ( const Vector< 3, real_t > &  v  )  [inline]

Copy Constructor.

Definition at line 33 of file Vector3SSE.inl.

Vector< 3, real_t >::Vector ( const m128f_t &  v  )  [inline]

SSE copy constructor.

Definition at line 38 of file Vector3SSE.inl.

Vector< 3, real_t >::Vector ( const real_t v0,
const real_t v1 = 0,
const real_t v2 = 0 
) [inline, explicit]

Convenience Constructor.

Definition at line 309 of file Vector3SSE.inl.


Member Function Documentation

static Vector<3, real_t> Vector< 3, real_t >::zero (  )  [inline, static]

Generates a vector full of zeroes.

Definition at line 74 of file Vector3SSE.h.

static Vector<3, real_t> Vector< 3, real_t >::ones (  )  [inline, static]

Generates a vector full of ones.

Definition at line 79 of file Vector3SSE.h.

static Vector<3, real_t> Vector< 3, real_t >::fill ( const real_t val  )  [inline, static]

Generates a vector filled with the specified value.

Definition at line 84 of file Vector3SSE.h.

static Vector<3, real_t> Vector< 3, real_t >::min ( const Vector< 3, real_t > &  v1,
const Vector< 3, real_t > &  v2 
) [inline, static]

Returns:
the element-wise minimum vector from the two given vectors

Definition at line 89 of file Vector3SSE.h.

static Vector<3, real_t> Vector< 3, real_t >::max ( const Vector< 3, real_t > &  v1,
const Vector< 3, real_t > &  v2 
) [inline, static]

Returns:
the element-wise maximum vector from the two given vectors

Definition at line 96 of file Vector3SSE.h.

static Vector<3, real_t> Vector< 3, real_t >::infinity (  )  [inline, static]

Generates a vector filled with the maximum real_t (infinity).

Definition at line 103 of file Vector3SSE.h.

static Vector<3, real_t> Vector< 3, real_t >::negativeInfinity (  )  [inline, static]

Generates a vector filled with the minimum real_t (negative infinity).

Definition at line 108 of file Vector3SSE.h.

static Vector<3, real_t> Vector< 3, real_t >::fromSpherical ( real_t  theta,
real_t  phi 
) [inline, static]

theta is latitude angle; phi is longitude angle

Definition at line 116 of file Vector3SSE.h.

const real_t & Vector< 3, real_t >::operator[] ( const unsigned  index  )  const [inline]

Returns:
a const reference to the element at the given index

Definition at line 47 of file Vector3SSE.inl.

real_t & Vector< 3, real_t >::operator[] ( const unsigned  index  )  [inline]

Returns:
a reference to the element at the given index
Note:
changes to the returned element will affect this vector

Definition at line 55 of file Vector3SSE.inl.

const real_t * Vector< 3, real_t >::operator* (  )  const [inline]

Returns:
a pointer to the underlying data (N-length array of type real_t)

Definition at line 62 of file Vector3SSE.inl.

real_t * Vector< 3, real_t >::operator* (  )  [inline]

Returns:
a pointer to the underlying data (N-length array of type real_t)

Definition at line 67 of file Vector3SSE.inl.

Vector< 3, real_t >::operator m128f_t (  )  const [inline]

Definition at line 143 of file Vector3SSE.h.

bool Vector< 3, real_t >::operator== ( const Vector< 3, real_t > &  v  )  const [inline]

Definition at line 75 of file Vector3SSE.inl.

bool Vector< 3, real_t >::operator!= ( const Vector< 3, real_t > &  v  )  const [inline]

Definition at line 82 of file Vector3SSE.inl.

Vector< 3, real_t > & Vector< 3, real_t >::operator= ( const Vector< 3, real_t > &  v  )  [inline]

Definition at line 91 of file Vector3SSE.inl.

Vector< 3, real_t > & Vector< 3, real_t >::operator+= ( const Vector< 3, real_t > &  rhs  )  [inline]

Definition at line 99 of file Vector3SSE.inl.

Vector< 3, real_t > & Vector< 3, real_t >::operator-= ( const Vector< 3, real_t > &  rhs  )  [inline]

Definition at line 107 of file Vector3SSE.inl.

Vector< 3, real_t > & Vector< 3, real_t >::operator*= ( const real_t scale  )  [inline]

Definition at line 119 of file Vector3SSE.inl.

Vector< 3, real_t > & Vector< 3, real_t >::operator/= ( const real_t scale  )  [inline]

Definition at line 127 of file Vector3SSE.inl.

Vector< 3, real_t > Vector< 3, real_t >::operator+ ( const Vector< 3, real_t > &  rhs  )  const [inline]

Definition at line 144 of file Vector3SSE.inl.

Vector< 3, real_t > Vector< 3, real_t >::operator- ( const Vector< 3, real_t > &  rhs  )  const [inline]

Definition at line 150 of file Vector3SSE.inl.

Vector< 3, real_t > Vector< 3, real_t >::operator* ( const Vector< 3, real_t > &  rhs  )  const [inline]

Returns:
element-wise multiplication of two vectors

Definition at line 156 of file Vector3SSE.inl.

Vector< 3, real_t > Vector< 3, real_t >::operator* ( const real_t scale  )  const [inline]

Definition at line 163 of file Vector3SSE.inl.

Vector< 3, real_t > Vector< 3, real_t >::operator/ ( const real_t scale  )  const [inline]

Definition at line 169 of file Vector3SSE.inl.

bool Vector< 3, real_t >::isUnit (  )  const [inline]

Returns:
whether or not this Vector is unitized

Definition at line 187 of file Vector3SSE.inl.

bool Vector< 3, real_t >::isZero (  )  const [inline]

Returns:
whether or not this Vector is the zero vector

Definition at line 192 of file Vector3SSE.inl.

Vector< 3, real_t > Vector< 3, real_t >::getNormalized (  )  const [inline]

Returns:
a normalized version of this vector

Definition at line 197 of file Vector3SSE.inl.

Vector< 3, real_t > Vector< 3, real_t >::getReciprocal (  )  const [inline]

Returns:
the reciprocal version of this vector (1.0f / this)

Definition at line 215 of file Vector3SSE.inl.

real_t Vector< 3, real_t >::normalize (  )  [inline]

Normalizes this Vector and returns the old magnitude.

Definition at line 220 of file Vector3SSE.inl.

real_t Vector< 3, real_t >::getMagnitude (  )  const [inline]

Returns:
the magnitude of this vector

Definition at line 256 of file Vector3SSE.inl.

real_t Vector< 3, real_t >::getMagnitude2 (  )  const [inline]

Returns:
the squared magnitude of this vector

Definition at line 268 of file Vector3SSE.inl.

real_t Vector< 3, real_t >::getDistance ( const Vector< 3, real_t > &  v  )  const [inline]

Returns:
the magnitude of the vector connecting this vector to the one passed in

Definition at line 275 of file Vector3SSE.inl.

real_t Vector< 3, real_t >::getDistance2 ( const Vector< 3, real_t > &  v  )  const [inline]

Returns:
the squared magnitude of the vector connecting this vector to the one passed in

Definition at line 282 of file Vector3SSE.inl.

real_t Vector< 3, real_t >::getSum (  )  const [inline]

Returns:
the sum of the components in this Vector

Definition at line 290 of file Vector3SSE.inl.

real_t Vector< 3, real_t >::getAverage (  )  const [inline]

Returns:
the average of the components in this Vector

Definition at line 295 of file Vector3SSE.inl.

real_t Vector< 3, real_t >::dot ( const Vector< 3, real_t > &  rhs  )  const [inline]

Returns:
the dot (inner) product of two vectors

Definition at line 300 of file Vector3SSE.inl.

unsigned Vector< 3, real_t >::getMaxDimension (  )  const [inline]

Returns:
dimension (0,1,...,N) of maximum length

Definition at line 378 of file Vector3SSE.inl.

unsigned Vector< 3, real_t >::getMinDimension (  )  const [inline]

Returns:
dimension (0,1,...,N) of minimum length

Definition at line 395 of file Vector3SSE.inl.

void Vector< 3, real_t >::cleanup (  ) 

Cleans up vector (0's out entries that are less than epsilon).

Vector< 3, real_t > Vector< 3, real_t >::cross ( const Vector< 3, real_t > &  rhs  )  const [inline]

Returns:
the cross product of two vectors

Definition at line 315 of file Vector3SSE.inl.

Vector<3, real_t> Vector< 3, real_t >::reflectVector ( const Vector< 3, real_t > &  normal  )  const

Assumes normal is normalized, incident vector is incoming and resultant vector is exiting

Note:
only defined for Vector3

Vector<3, real_t> Vector< 3, real_t >::refractVector ( const Vector< 3, real_t > &  normal,
real_t  in,
real_t  out = 1.0f 
) const

void Vector< 3, real_t >::getOrthonormalBasis ( Vector< 3, real_t > &  U,
Vector< 3, real_t > &  V 
)

Returns:
an orthonormal basis constructed from this vector in out parameters U and V
Note:
only defined for Vector3


Member Data Documentation

float Vector< 3, real_t >::data[4]

Underlying data stored as an N-length array of type T.

Definition at line 36 of file Vector3SSE.h.

m128f_t Vector< 3, real_t >::vec

Also accessible via a native SSE 128-bit register.

Definition at line 39 of file Vector3SSE.h.

Definition at line 41 of file Vector3SSE.h.

Definition at line 41 of file Vector3SSE.h.

Definition at line 41 of file Vector3SSE.h.

Definition at line 41 of file Vector3SSE.h.

SSE_ALIGN16_PRE { ... } Vector< 3, real_t >::SSE_ALIGN16_POST


The documentation for this struct was generated from the following files:

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6