![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
#include <Vector.hpp>
Inheritance diagram for cat::Vector< DIM, Scalar, Double >:Public Types | |
| typedef Vector< DIM, Scalar, Double > | mytype |
Public Member Functions | |
| mytype & | addRotation2D (const mytype &r) |
| mytype & | addToEachElement (Scalar u) |
| mytype & | componentDivide (const mytype &u) |
| mytype & | componentMultiply (const mytype &u) |
| mytype & | copy (const mytype &u) |
| f32 | crossProduct2D (const mytype &u) |
| mytype | crossProduct3D (const mytype &u) |
| Double | dotProduct (const mytype &u) const |
| void | generateRotation2D (f32 angle) |
| bool | isZero () |
| Double | magnitude () const |
| mytype & | negate () |
| mytype & | normalize () |
| mytype & | normalize_fast_f32 () |
| const Scalar & | operator() (int ii) const |
| Scalar & | operator() (int ii) |
| mytype | operator* (Scalar u) const |
| mytype & | operator*= (Scalar u) |
| mytype | operator+ (const mytype &u) const |
| mytype & | operator+= (const mytype &u) |
| mytype | operator- () const |
| mytype | operator- (const mytype &u) const |
| mytype & | operator-= (const mytype &u) |
| mytype | operator/ (Scalar u) const |
| mytype & | operator/= (Scalar u) |
| mytype & | operator= (const mytype &u) |
| mytype & | subtractFromEachElement (Scalar u) |
| mytype & | subtractRotation2D (const mytype &r) |
| Vector (Scalar x, Scalar y) | |
| Vector (Scalar x, Scalar y, Scalar z) | |
| Vector () | |
| Vector (Scalar x, Scalar y, Scalar z, Scalar w) | |
| Vector (const mytype &u) | |
| const Scalar & | w () const |
| Scalar & | w () |
| const Scalar & | x () const |
| Scalar & | x () |
| const Scalar & | y () const |
| Scalar & | y () |
| Scalar & | z () |
| const Scalar & | z () const |
| void | zero () |
Protected Attributes | |
| Scalar | _elements [DIM] |
Definition at line 40 of file Vector.hpp.
| typedef Vector<DIM, Scalar, Double> cat::Vector< DIM, Scalar, Double >::mytype |
Definition at line 48 of file Vector.hpp.
| cat::Vector< DIM, Scalar, Double >::Vector | ( | ) | [inline] |
Definition at line 51 of file Vector.hpp.
{}
| cat::Vector< DIM, Scalar, Double >::Vector | ( | Scalar | x, |
| Scalar | y | ||
| ) | [inline] |
| cat::Vector< DIM, Scalar, Double >::Vector | ( | Scalar | x, |
| Scalar | y, | ||
| Scalar | z | ||
| ) | [inline] |
| cat::Vector< DIM, Scalar, Double >::Vector | ( | Scalar | x, |
| Scalar | y, | ||
| Scalar | z, | ||
| Scalar | w | ||
| ) | [inline] |
| cat::Vector< DIM, Scalar, Double >::Vector | ( | const mytype & | u | ) | [inline] |
Definition at line 82 of file Vector.hpp.
{
copy(u);
}
| mytype& cat::Vector< DIM, Scalar, Double >::addRotation2D | ( | const mytype & | r | ) | [inline] |
| mytype& cat::Vector< DIM, Scalar, Double >::addToEachElement | ( | Scalar | u | ) | [inline] |
Definition at line 208 of file Vector.hpp.
{
FOR_EACH_DIMENSION(ii) _elements[ii] += u;
return *this;
}
| mytype& cat::Vector< DIM, Scalar, Double >::componentDivide | ( | const mytype & | u | ) | [inline] |
Definition at line 290 of file Vector.hpp.
{
FOR_EACH_DIMENSION(ii) _elements[ii] /= u._elements[ii];
return *this;
}
| mytype& cat::Vector< DIM, Scalar, Double >::componentMultiply | ( | const mytype & | u | ) | [inline] |
Definition at line 260 of file Vector.hpp.
{
FOR_EACH_DIMENSION(ii) _elements[ii] *= u._elements[ii];
return *this;
}
| mytype& cat::Vector< DIM, Scalar, Double >::copy | ( | const mytype & | u | ) | [inline] |
Definition at line 74 of file Vector.hpp.
Referenced by cat::Vector< 4, Scalar, Double >::operator=(), cat::Quaternion< Scalar, Double >::operator=(), and cat::Vector< 4, Scalar, Double >::Vector().
| f32 cat::Vector< DIM, Scalar, Double >::crossProduct2D | ( | const mytype & | u | ) | [inline] |
Definition at line 344 of file Vector.hpp.
| mytype cat::Vector< DIM, Scalar, Double >::crossProduct3D | ( | const mytype & | u | ) | [inline] |
| Double cat::Vector< DIM, Scalar, Double >::dotProduct | ( | const mytype & | u | ) | const [inline] |
Definition at line 298 of file Vector.hpp.
{
Double sum = 0;
FOR_EACH_DIMENSION(ii)
sum += static_cast<Double>( _elements[ii] )
* static_cast<Double>( u._elements[ii] );
return sum;
}
| void cat::Vector< DIM, Scalar, Double >::generateRotation2D | ( | f32 | angle | ) | [inline] |
Definition at line 313 of file Vector.hpp.
| bool cat::Vector< DIM, Scalar, Double >::isZero | ( | ) | [inline] |
Definition at line 148 of file Vector.hpp.
{
FOR_EACH_DIMENSION(ii)
if (_elements[ii] != static_cast<Scalar>( 0 ))
return false;
return true;
}
| Double cat::Vector< DIM, Scalar, Double >::magnitude | ( | ) | const [inline] |
Definition at line 94 of file Vector.hpp.
Referenced by cat::Vector< 4, Scalar, Double >::normalize().
{
Double element, sum = 0;
FOR_EACH_DIMENSION(ii)
{
element = _elements[ii];
sum += element * element;
}
return static_cast<Double>( sqrt(sum) );
}
| mytype& cat::Vector< DIM, Scalar, Double >::negate | ( | ) | [inline] |
Definition at line 182 of file Vector.hpp.
{
FOR_EACH_DIMENSION(ii) _elements[ii] = -_elements[ii];
return *this;
}
| mytype& cat::Vector< DIM, Scalar, Double >::normalize | ( | ) | [inline] |
Definition at line 131 of file Vector.hpp.
Referenced by cat::Quaternion< Scalar, Double >::setFromEulerAngles().
{
Double m = magnitude();
Double inv = static_cast<Double>( 1 ) / m;
FOR_EACH_DIMENSION(ii) _elements[ii] *= inv;
return *this;
}
| mytype& cat::Vector< DIM, Scalar, Double >::normalize_fast_f32 | ( | ) | [inline] |
Definition at line 108 of file Vector.hpp.
{
f32 element = _elements[0];
f32 sum = element * element;
for (int ii = 1; ii < DIM; ++ii)
{
element = _elements[ii];
sum += element * element;
}
// If sum is not close to 1, then perform normalization:
if (sum > 1.005f || sum < 0.995f)
{
f32 inv = InvSqrt(sum);
FOR_EACH_DIMENSION(ii) _elements[ii] *= inv;
}
return *this;
}
| Scalar& cat::Vector< DIM, Scalar, Double >::operator() | ( | int | ii | ) | [inline] |
Definition at line 158 of file Vector.hpp.
{ return _elements[ii]; }
| const Scalar& cat::Vector< DIM, Scalar, Double >::operator() | ( | int | ii | ) | const [inline] |
Definition at line 165 of file Vector.hpp.
{ return _elements[ii]; }
| mytype cat::Vector< DIM, Scalar, Double >::operator* | ( | Scalar | u | ) | const [inline] |
Definition at line 242 of file Vector.hpp.
{
mytype x;
FOR_EACH_DIMENSION(ii) x._elements[ii] = u * _elements[ii];
return x;
}
| mytype& cat::Vector< DIM, Scalar, Double >::operator*= | ( | Scalar | u | ) | [inline] |
Definition at line 252 of file Vector.hpp.
{
FOR_EACH_DIMENSION(ii) _elements[ii] *= u;
return *this;
}
| mytype cat::Vector< DIM, Scalar, Double >::operator+ | ( | const mytype & | u | ) | const [inline] |
Definition at line 190 of file Vector.hpp.
| mytype& cat::Vector< DIM, Scalar, Double >::operator+= | ( | const mytype & | u | ) | [inline] |
Definition at line 200 of file Vector.hpp.
{
FOR_EACH_DIMENSION(ii) _elements[ii] += u._elements[ii];
return *this;
}
| mytype cat::Vector< DIM, Scalar, Double >::operator- | ( | ) | const [inline] |
Definition at line 172 of file Vector.hpp.
{
mytype x;
FOR_EACH_DIMENSION(ii) x._elements[ii] = -_elements[ii];
return x;
}
| mytype cat::Vector< DIM, Scalar, Double >::operator- | ( | const mytype & | u | ) | const [inline] |
Definition at line 216 of file Vector.hpp.
| mytype& cat::Vector< DIM, Scalar, Double >::operator-= | ( | const mytype & | u | ) | [inline] |
Definition at line 226 of file Vector.hpp.
{
FOR_EACH_DIMENSION(ii) _elements[ii] -= u._elements[ii];
return *this;
}
| mytype cat::Vector< DIM, Scalar, Double >::operator/ | ( | Scalar | u | ) | const [inline] |
Definition at line 268 of file Vector.hpp.
{
mytype x;
Scalar inv_u = static_cast<Scalar>( 1 ) / static_cast<Scalar>( u );
FOR_EACH_DIMENSION(ii) x._elements[ii] = _elements[ii] * inv_u;
return x;
}
| mytype& cat::Vector< DIM, Scalar, Double >::operator/= | ( | Scalar | u | ) | [inline] |
Definition at line 280 of file Vector.hpp.
{
Scalar inv_u = static_cast<Scalar>( 1 ) / static_cast<Scalar>( u );
FOR_EACH_DIMENSION(ii) _elements[ii] *= inv_u;
return *this;
}
| mytype& cat::Vector< DIM, Scalar, Double >::operator= | ( | const mytype & | u | ) | [inline] |
Definition at line 88 of file Vector.hpp.
{
return copy(u);
}
| mytype& cat::Vector< DIM, Scalar, Double >::subtractFromEachElement | ( | Scalar | u | ) | [inline] |
Definition at line 234 of file Vector.hpp.
{
FOR_EACH_DIMENSION(ii) _elements[ii] -= u;
return *this;
}
| mytype& cat::Vector< DIM, Scalar, Double >::subtractRotation2D | ( | const mytype & | r | ) | [inline] |
| const Scalar& cat::Vector< DIM, Scalar, Double >::w | ( | ) | const [inline] |
Definition at line 169 of file Vector.hpp.
{ return _elements[3]; }
| Scalar& cat::Vector< DIM, Scalar, Double >::w | ( | ) | [inline] |
Definition at line 162 of file Vector.hpp.
Referenced by cat::Vector< 4, Scalar, Double >::Vector().
{ return _elements[3]; }
| Scalar& cat::Vector< DIM, Scalar, Double >::x | ( | ) | [inline] |
Definition at line 159 of file Vector.hpp.
Referenced by cat::Vector< 4, Scalar, Double >::addRotation2D(), cat::Vector< 4, Scalar, Double >::crossProduct2D(), cat::Vector< 4, Scalar, Double >::crossProduct3D(), cat::Vector< 4, Scalar, Double >::generateRotation2D(), cat::Vector< 4, Scalar, Double >::operator*(), cat::Vector< 4, Scalar, Double >::operator+(), cat::Vector< 4, Scalar, Double >::operator-(), cat::Vector< 4, Scalar, Double >::operator/(), cat::Vector< 4, Scalar, Double >::subtractRotation2D(), and cat::Vector< 4, Scalar, Double >::Vector().
{ return _elements[0]; }
| const Scalar& cat::Vector< DIM, Scalar, Double >::x | ( | ) | const [inline] |
Definition at line 166 of file Vector.hpp.
{ return _elements[0]; }
| const Scalar& cat::Vector< DIM, Scalar, Double >::y | ( | ) | const [inline] |
Definition at line 167 of file Vector.hpp.
{ return _elements[1]; }
| Scalar& cat::Vector< DIM, Scalar, Double >::y | ( | ) | [inline] |
Definition at line 160 of file Vector.hpp.
Referenced by cat::Vector< 4, Scalar, Double >::addRotation2D(), cat::Vector< 4, Scalar, Double >::crossProduct2D(), cat::Vector< 4, Scalar, Double >::crossProduct3D(), cat::Vector< 4, Scalar, Double >::generateRotation2D(), cat::Vector< 4, Scalar, Double >::subtractRotation2D(), and cat::Vector< 4, Scalar, Double >::Vector().
{ return _elements[1]; }
| const Scalar& cat::Vector< DIM, Scalar, Double >::z | ( | ) | const [inline] |
Definition at line 168 of file Vector.hpp.
{ return _elements[2]; }
| Scalar& cat::Vector< DIM, Scalar, Double >::z | ( | ) | [inline] |
Definition at line 161 of file Vector.hpp.
Referenced by cat::Vector< 4, Scalar, Double >::crossProduct3D(), and cat::Vector< 4, Scalar, Double >::Vector().
{ return _elements[2]; }
| void cat::Vector< DIM, Scalar, Double >::zero | ( | ) | [inline] |
Definition at line 142 of file Vector.hpp.
{
OBJCLR(_elements);
}
Scalar cat::Vector< DIM, Scalar, Double >::_elements[DIM] [protected] |
Definition at line 44 of file Vector.hpp.
Referenced by cat::Vector< 4, Scalar, Double >::addToEachElement(), cat::Vector< 4, Scalar, Double >::componentDivide(), cat::Vector< 4, Scalar, Double >::componentMultiply(), cat::Vector< 4, Scalar, Double >::copy(), cat::Vector< 4, Scalar, Double >::dotProduct(), cat::Vector< 4, Scalar, Double >::isZero(), cat::Vector< 4, Scalar, Double >::magnitude(), cat::Vector< 4, Scalar, Double >::negate(), cat::Vector< 4, Scalar, Double >::normalize(), cat::Vector< 4, Scalar, Double >::normalize_fast_f32(), cat::Vector< 4, Scalar, Double >::operator()(), cat::Vector< 4, Scalar, Double >::operator*(), cat::Vector< 4, Scalar, Double >::operator*=(), cat::Vector< 4, Scalar, Double >::operator+(), cat::Vector< 4, Scalar, Double >::operator+=(), cat::Vector< 4, Scalar, Double >::operator-(), cat::Vector< 4, Scalar, Double >::operator-=(), cat::Vector< 4, Scalar, Double >::operator/(), cat::Vector< 4, Scalar, Double >::operator/=(), cat::Vector< 4, Scalar, Double >::subtractFromEachElement(), cat::Vector< 4, Scalar, Double >::Vector(), cat::Vector< 4, Scalar, Double >::w(), cat::Vector< 4, Scalar, Double >::x(), cat::Vector< 4, Scalar, Double >::y(), cat::Vector< 4, Scalar, Double >::z(), and cat::Vector< 4, Scalar, Double >::zero().
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.