osg::VectorInterface< ValueTypeT, StorageInterfaceT > Class Template Reference

#include <OSGVector.h>

Inheritance diagram for osg::VectorInterface< ValueTypeT, StorageInterfaceT >:

osg::PointInterface< ValueTypeT, StorageInterfaceT > List of all members.

Public Types

typedef PointInterface< ValueTypeT,
StorageInterfaceT > 
Inherited
 Parent type.
typedef TypeTraits< ValueTypeT
>::RealReturnType 
RealReturnType
 Used type if the returnvalue must be a real value.
typedef ValueTypeT ValueType
 Value type.
typedef Inherited PntInterface
typedef VectorInterface< ValueTypeT,
StorageInterfaceT > 
Self
 Own type.
typedef VectorInterface< ValueTypeT,
StorageInterfaceT > 
VecInterface

Public Member Functions

Set Values
void setNull (void)
void setValue (const PointInterface &vec)
template<class EVT, class EST>
void setValue (const PointInterface< EVT, EST > &vec)
void setValue (const ValueTypeT *pVals)
 Set value from a given array, be sure to match sizes.
void setValue (ValueTypeT *pVals)
 Set value from a given array, be sure to match sizes.
void setValueFromCString (const Char8 *szString)
 Extract values from given string, where both (const and not const) must be present, otherwise the compiler strikes back :-) (GV).
void setValueFromCString (Char8 *szString)
 Extract values from given string, where both (const and not const) must be present, otherwise the compiler strikes back :-) (GV).
void setValue (const Char8 *szString)
void setValue (Char8 *szString)
Get Values
ValueTypeT * getValues (void)
 Get a pointer to the value storage.
const ValueTypeT * getValues (void) const
 Get a const pointer to the value storage.
Element Access
ValueTypeT & operator[] (const UInt32 uiVal)
const ValueTypeT & operator[] (const UInt32 uiVal) const
Comparison
bool operator< (const PointInterface &other) const
bool operator== (const PointInterface &other) const
 Equal operator, using Eps as the tolerance.
bool operator!= (const PointInterface &other) const
 Not equal operator, using Eps as the tolerance.
Constructors
 VectorInterface (void)
 VectorInterface (const ValueTypeT *pVals)
 Constructor which takes a const value array.
 VectorInterface (ValueTypeT *pVals)
 Constructor which takes a const value array.
template<class EVT, class EST>
 VectorInterface (const VectorInterface< EVT, EST > &vec)
template<class EVT, class EST>
 VectorInterface (const PointInterface< EVT, EST > &vec)
 VectorInterface (const VectorInterface &source)
 VectorInterface (const ValueTypeT rVal1, const ValueTypeT rVal2)
 VectorInterface (const ValueTypeT rVal1, const ValueTypeT rVal2, const ValueTypeT rVal3)
 VectorInterface (const ValueTypeT rVal1, const ValueTypeT rVal2, const ValueTypeT rVal3, const ValueTypeT rVal4)
Destructor
 ~VectorInterface (void)
Common Math
RealReturnType length (void) const
 Euclidean length of the vector.
RealReturnType squareLength (void) const
 square of the Euclidean length of the vector
void normalize (void)
 Changes vector to be of unit length.
VectorInterface cross (const VectorInterface &vec) const
 Returns the right handed cross-product for a given vector; This function is implemented for size 3 vectors only.
VectorInterface operator% (const VectorInterface &vec) const
void crossThis (const VectorInterface &vec)
 Calculates the right handed cross-product with a given vector; This function is implemented for size 3 vectors only.
ValueTypeT dot (const VectorInterface &vec) const
 Return the dot (inner) product for a given vector.
ValueTypeT operator * (const VectorInterface &vec) const
ValueTypeT dot (const PntInterface &pnt) const
ValueTypeT operator * (const PntInterface &pnt) const
RealReturnType enclosedAngle (const VectorInterface &vec) const
 Returns the angle between this and another vector.
RealReturnType projectTo (const VectorInterface &toVec)
Conv
PntInterfaceaddToZero (void)
 Returns the corrosponding point by adding it to zero.
const PntInterfaceaddToZero (void) const
 Returns the corrosponding point by adding it to zero.
VectorInterfacesubZero (void)
 Returns the corrosponding vector by subtracting zero.
const VectorInterfacesubZero (void) const
 Returns the corrosponding vector by subtracting zero.
Math
VectorInterface operator- (const VectorInterface &vec) const
 Component wise binary vector subtraction operator.
VectorInterface operator+ (const VectorInterface &vec) const
 Component wise binary vector addition operator.
VectorInterface operator * (const ValueTypeT rVal) const
 Component wise binary scalar multiplication.
VectorInterface operator- (void) const
 Nondestructive unary negation, returns new vector.
Assignment
VectorInterfaceoperator= (const VectorInterface &source)
Comparison
bool operator< (const VectorInterface &other) const
bool operator== (const VectorInterface &other) const
 Equal operator, using Eps as the tolerance.
bool operator!= (const VectorInterface &other) const
 Not eual operator, using Eps as the tolerance.
Set Values
void setNull (void)
void setValue (const PointInterface &vec)
template<class EVT, class EST>
void setValue (const PointInterface< EVT, EST > &vec)
void setValue (const ValueTypeT *pVals)
 Set value from a given array, be sure to match sizes.
void setValue (ValueTypeT *pVals)
 Set value from a given array, be sure to match sizes.
void setValue (const Char8 *szString)
void setValue (Char8 *szString)
void setValueFromCString (const Char8 *szString)
 Extract values from given string, where both (const and not const) must be present, otherwise the compiler strikes back :-) (GV).
void setValueFromCString (Char8 *szString)
 Extract values from given string, where both (const and not const) must be present, otherwise the compiler strikes back :-) (GV).
Get Values
ValueTypeT * getValues (void)
 Get a pointer to the value storage.
const ValueTypeT * getValues (void) const
 Get a const pointer to the value storage.
Common Math
bool isZero (void) const
 Returns true iff the norm of each value is less than Eps.
void negate (void)
 Negates each value of the point in place.
bool equals (const PointInterface &vec, const ValueTypeT tolerance) const
 Returns true iff the two points are eual within a given tolerance.
RealReturnType dist (const PointInterface &vec) const
 Returns the distance between the two points.
RealReturnType dist2 (const PointInterface &vec) const
 Returns the distance between the two points, squared.
RealReturnType maxValue (void) const
 Returns the maximum value of the vector.
Math
void operator *= (const ValueTypeT val)
 Component wise scalar multiplication.
void operator/= (const ValueTypeT val)
 Component wise scalar division.
VecInterface operator- (const PointInterface &vec) const
 Point substraction, returns a new vector.
PointInterface operator- (const VecInterface &vec) const
 Component wise binary vector addition operator.
PointInterface operator- (void)
 Nondestructive unary negation, returns new point.
PointInterface operator+ (const VecInterface &vec) const
 Component wise binary vector addition operator.
void operator+= (const VecInterface &vec)
 Component wise vector addition.
void operator-= (const VecInterface &vec)
 Component wise vector substraction.
Element Access
ValueTypeT & operator[] (const UInt32 uiVal)
const ValueTypeT & operator[] (const UInt32 uiVal) const
Comparison
bool operator< (const PointInterface &other) const
bool operator== (const PointInterface &other) const
 Equal operator, using Eps as the tolerance.
bool operator!= (const PointInterface &other) const
 Not equal operator, using Eps as the tolerance.

Static Public Attributes

static const VectorInterface Null

Detailed Description

template<class ValueTypeT, class StorageInterfaceT>
class osg::VectorInterface< ValueTypeT, StorageInterfaceT >

Vector Interface, for details about how vectors, points and matrices are actually build see ^1^(BaseMath).

Definition at line 582 of file OSGVector.h.


Member Typedef Documentation

template<class ValueTypeT, class StorageInterfaceT>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::Inherited
 

Parent type.

Reimplemented from osg::PointInterface< ValueTypeT, StorageInterfaceT >.

Definition at line 590 of file OSGVector.h.

template<class ValueTypeT, class StorageInterfaceT>
typedef Inherited osg::VectorInterface< ValueTypeT, StorageInterfaceT >::PntInterface
 

Definition at line 596 of file OSGVector.h.

template<class ValueTypeT, class StorageInterfaceT>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::RealReturnType
 

Used type if the returnvalue must be a real value.

Reimplemented from osg::PointInterface< ValueTypeT, StorageInterfaceT >.

Definition at line 592 of file OSGVector.h.

template<class ValueTypeT, class StorageInterfaceT>
typedef VectorInterface<ValueTypeT, StorageInterfaceT> osg::VectorInterface< ValueTypeT, StorageInterfaceT >::Self
 

Own type.

Reimplemented from osg::PointInterface< ValueTypeT, StorageInterfaceT >.

Definition at line 599 of file OSGVector.h.

template<class ValueTypeT, class StorageInterfaceT>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::ValueType
 

Value type.

Reimplemented from osg::PointInterface< ValueTypeT, StorageInterfaceT >.

Reimplemented in osg::Color3< ValueTypeT >, and osg::Color4< ValueTypeT >.

Definition at line 594 of file OSGVector.h.

template<class ValueTypeT, class StorageInterfaceT>
typedef VectorInterface<ValueTypeT, StorageInterfaceT> osg::PointInterface< ValueTypeT, StorageInterfaceT >::VecInterface [inherited]
 

Definition at line 354 of file OSGVector.h.


Constructor & Destructor Documentation

template<class ValueTypeT, class StorageInterfaceT>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::VectorInterface void   )  [inline]
 

Definition at line 1371 of file OSGVector.inl.

01371                                                                     : 
01372     Inherited()
01373 {
01374     for(UInt32 i = 0; i < Self::_uiSize; i++)
01375     {
01376         Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
01377     }
01378 }

template<class ValueTypeT, class StorageInterfaceT>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::VectorInterface const ValueTypeT *  pVals  )  [inline, explicit]
 

Constructor which takes a const value array.

Be shure the array size at least as large as the vector size.

Definition at line 1389 of file OSGVector.inl.

01389                                                                            :
01390     Inherited(pVals)
01391 {
01392 }

template<class ValueTypeT, class StorageInterfaceT>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::VectorInterface ValueTypeT *  pVals  )  [inline, explicit]
 

Constructor which takes a const value array.

Be shure the array size at least as large as the vector size.

Definition at line 1402 of file OSGVector.inl.

01402                                                                      : 
01403     Inherited(pVals)
01404 {
01405 }

template<class ValueTypeT, class StorageInterfaceT>
template<class EVT, class EST>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::VectorInterface const VectorInterface< EVT, EST > &  vec  )  [inline, explicit]
 

Definition at line 618 of file OSGVector.h.

00619     {
00620         if(Self::_uiSize <= VectorInterface<EVT,EST>::_uiSize)
00621         {
00622             for(UInt32 i = 0; i < Self::_uiSize; i++)
00623             {
00624                 Self::_values[i] = vec.getValues()[i];
00625             }
00626         }
00627         else
00628         {
00629             UInt32 i;
00630             for(i = 0; i < VectorInterface<EVT,EST>::_uiSize; i++)
00631             {
00632                 Self::_values[i] = vec.getValues()[i];
00633             }
00634             for(i = VectorInterface<EVT,EST>::_uiSize; i < Self::_uiSize; i++)
00635             {
00636                 Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00637             }
00638         }
00639     }

template<class ValueTypeT, class StorageInterfaceT>
template<class EVT, class EST>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::VectorInterface const PointInterface< EVT, EST > &  vec  )  [inline, explicit]
 

Definition at line 645 of file OSGVector.h.

00646     {
00647         if(Self::_uiSize <= PointInterface<EVT,EST>::_uiSize)
00648         {
00649             for(UInt32 i = 0; i < Self::_uiSize; i++)
00650             {
00651                 Self::_values[i] = vec.getValues()[i];
00652             }
00653         }
00654         else
00655         {
00656             UInt32 i;
00657             for(i = 0; i < PointInterface<EVT,EST>::_uiSize; i++)
00658             {
00659                 Self::_values[i] = vec.getValues()[i];
00660             }
00661             for(i = PointInterface<EVT,EST>::_uiSize; i < Self::_uiSize; i++)
00662             {
00663                 Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00664             }
00665         }
00666     }

template<class ValueTypeT, class StorageInterfaceT>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::VectorInterface const VectorInterface< ValueTypeT, StorageInterfaceT > &  source  )  [inline]
 

Definition at line 1468 of file OSGVector.inl.

01469                                    : 
01470 
01471     Inherited(source)
01472 {
01473 }

template<class ValueTypeT, class StorageInterfaceT>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::VectorInterface const ValueTypeT  rVal1,
const ValueTypeT  rVal2
[inline]
 

Definition at line 1495 of file OSGVector.inl.

01496                                                                             :
01497 
01498     Inherited(rVal1, rVal2)
01499 {
01500 }

template<class ValueTypeT, class StorageInterfaceT>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::VectorInterface const ValueTypeT  rVal1,
const ValueTypeT  rVal2,
const ValueTypeT  rVal3
[inline]
 

Definition at line 1505 of file OSGVector.inl.

01507                                                                             :
01508 
01509     Inherited(rVal1, rVal2, rVal3)
01510 {
01511 }

template<class ValueTypeT, class StorageInterfaceT>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::VectorInterface const ValueTypeT  rVal1,
const ValueTypeT  rVal2,
const ValueTypeT  rVal3,
const ValueTypeT  rVal4
[inline]
 

Definition at line 1516 of file OSGVector.inl.

01519                                                                             :
01520 
01521     Inherited(rVal1, rVal2, rVal3, rVal4)
01522 {
01523 }

template<class ValueTypeT, class StorageInterfaceT>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::~VectorInterface void   )  [inline]
 

Definition at line 1532 of file OSGVector.inl.

01533 {
01534 }


Member Function Documentation

template<class ValueTypeT, class StorageInterfaceT>
const VectorInterface< ValueTypeT, StorageInterfaceT >::PntInterface & osg::VectorInterface< ValueTypeT, StorageInterfaceT >::addToZero void   )  const [inline]
 

Returns the corrosponding point by adding it to zero.

Definition at line 1798 of file OSGVector.inl.

01799 {
01800     return *(static_cast<const PntInterface *>(this));
01801 }

template<class ValueTypeT, class StorageInterfaceT>
VectorInterface< ValueTypeT, StorageInterfaceT >::PntInterface & osg::VectorInterface< ValueTypeT, StorageInterfaceT >::addToZero void   )  [inline]
 

Returns the corrosponding point by adding it to zero.

Definition at line 1810 of file OSGVector.inl.

01811 {
01812     return *(static_cast<PntInterface *>(this));
01813 }

template<class ValueTypeT, class StorageInterfaceT>
VectorInterface< ValueTypeT, StorageInterfaceT > osg::VectorInterface< ValueTypeT, StorageInterfaceT >::cross const VectorInterface< ValueTypeT, StorageInterfaceT > &  vec  )  const [inline]
 

Returns the right handed cross-product for a given vector; This function is implemented for size 3 vectors only.

Definition at line 1603 of file OSGVector.inl.

Referenced by osg::Line::getClosestPoints(), osg::Plane::intersect(), osg::Line::intersect(), osg::MatrixLookAt(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::operator%(), osg::NormalQuantifier::rayTriangle(), and osg::QuaternionBase< ValueTypeT >::setValue().

01604 {
01605     VectorInterface<ValueTypeT, StorageInterfaceT> returnValue;
01606 
01607     if(Self::_uiSize >= 3)
01608     {
01609         returnValue[0] =
01610             Self::_values[1] * vec._values[2] - 
01611             Self::_values[2] * vec._values[1];
01612         returnValue[1] =
01613             Self::_values[2] * vec._values[0] - 
01614             Self::_values[0] * vec._values[2];
01615         returnValue[2] =
01616             Self::_values[0] * vec._values[1] - 
01617             Self::_values[1] * vec._values[0];
01618     }
01619     else
01620     {
01621         // Must be changed
01622         fprintf(stderr, "cross only implemented for size 3\n");
01623     }
01624 
01625     return returnValue;
01626 }

template<class ValueTypeT, class StorageInterfaceT>
void osg::VectorInterface< ValueTypeT, StorageInterfaceT >::crossThis const VectorInterface< ValueTypeT, StorageInterfaceT > &  vec  )  [inline]
 

Calculates the right handed cross-product with a given vector; This function is implemented for size 3 vectors only.

Definition at line 1644 of file OSGVector.inl.

Referenced by osg::Plane::Plane(), and osg::CylinderVolume::transform().

01645 {
01646     if(Self::_uiSize >= 3)
01647     {
01648         ValueTypeT rTmp[2];
01649 
01650         rTmp[0] = 
01651             Self::_values[1] * vec._values[2] - 
01652             Self::_values[2] * vec._values[1];
01653         rTmp[1] = 
01654             Self::_values[2] * vec._values[0] - 
01655             Self::_values[0] * vec._values[2];
01656 
01657         Self::_values[2] =
01658             Self::_values[0] * vec._values[1] -
01659             Self::_values[1] * vec._values[0];
01660 
01661         Self::_values[0] = rTmp[0];
01662         Self::_values[1] = rTmp[1];
01663     }
01664     else
01665     {
01666         // Must be changed
01667         fprintf(stderr, "crossThis only available for size 3\n");
01668     }
01669 }

template<class ValueTypeT, class StorageInterfaceT>
PointInterface< ValueTypeT, StorageInterfaceT >::RealReturnType osg::PointInterface< ValueTypeT, StorageInterfaceT >::dist const PointInterface< ValueTypeT, StorageInterfaceT > &  vec  )  const [inline, inherited]
 

Returns the distance between the two points.

Definition at line 957 of file OSGVector.inl.

References osg::PointInterface< ValueTypeT, StorageInterfaceT >::dist2(), and osg::osgSqrt().

00959 {
00960     return osgSqrt(dist2(vec));
00961 }

template<class ValueTypeT, class StorageInterfaceT>
PointInterface< ValueTypeT, StorageInterfaceT >::RealReturnType osg::PointInterface< ValueTypeT, StorageInterfaceT >::dist2 const PointInterface< ValueTypeT, StorageInterfaceT > &  vec  )  const [inline, inherited]
 

Returns the distance between the two points, squared.

Definition at line 969 of file OSGVector.inl.

Referenced by osg::PointInterface< ValueTypeT, StorageInterfaceT >::dist().

00971 {
00972     RealReturnType returnValue = 0;
00973     RealReturnType tmp;
00974 
00975     for(UInt32 i = 0; i < Self::_uiSize; i++)
00976     {
00977         tmp = Self::_values[i] - vec._values[i];
00978         
00979         returnValue += tmp * tmp;
00980     }
00981 
00982     return returnValue;
00983 }

template<class ValueTypeT, class StorageInterfaceT>
ValueTypeT osg::VectorInterface< ValueTypeT, StorageInterfaceT >::dot const PntInterface pnt  )  const [inline]
 

Definition at line 1702 of file OSGVector.inl.

01704 {
01705     ValueTypeT rTmpVal = Self::_values[0] * pnt[0];
01706 
01707     for(UInt32 i = 1; i < Self::_uiSize; i++)
01708     {
01709         rTmpVal += Self::_values[i] * pnt[i];
01710     }
01711 
01712     return rTmpVal;
01713 }

template<class ValueTypeT, class StorageInterfaceT>
ValueTypeT osg::VectorInterface< ValueTypeT, StorageInterfaceT >::dot const VectorInterface< ValueTypeT, StorageInterfaceT > &  vec  )  const [inline]
 

Return the dot (inner) product for a given vector.

Definition at line 1679 of file OSGVector.inl.

Referenced by osg::dist3D_Segment_to_Segment(), osg::Plane::distance(), osg::Line::getClosestPoint(), osg::Line::getClosestPoints(), osg::Line::intersect(), osg::Plane::intersectInfinite(), osg::Plane::isInHalfSpace(), osg::Plane::isOnPlane(), osg::MatrixLookAt(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::operator *(), osg::Plane::Plane(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::projectTo(), osg::NormalQuantifier::rayTriangle(), and osg::QuaternionBase< ValueTypeT >::setValue().

01681 {
01682     ValueTypeT rTmpVal = Self::_values[0] * vec._values[0];
01683 
01684     for(UInt32 i = 1; i < Self::_uiSize; i++)
01685     {
01686         rTmpVal += Self::_values[i] * vec._values[i];
01687     }
01688 
01689     return rTmpVal;
01690 }

template<class ValueTypeT, class StorageInterfaceT>
VectorInterface< ValueTypeT, StorageInterfaceT >::RealReturnType osg::VectorInterface< ValueTypeT, StorageInterfaceT >::enclosedAngle const VectorInterface< ValueTypeT, StorageInterfaceT > &  vec  )  const [inline]
 

Returns the angle between this and another vector.

Definition at line 1728 of file OSGVector.inl.

References osg::PointInterface< ValueTypeT, StorageInterfaceT >::isZero().

01730 {
01731     RealReturnType returnValue;
01732 
01733     if(Self::isZero() || vec.isZero())
01734     {
01735         returnValue = TypeTraits<RealReturnType>::getZeroElement();
01736     }
01737     else
01738     {
01739         returnValue  = dot(vec);
01740         returnValue /= (length() * vec.length());
01741 
01742         if((returnValue - Eps) < -1.)
01743         {
01744             returnValue = Pi;
01745         }
01746         else if((returnValue + Eps) > 1.)
01747         {
01748             returnValue = TypeTraits<RealReturnType>::getZeroElement();
01749         }
01750         else
01751         {
01752             returnValue = osgACos(returnValue);
01753         }
01754     }
01755 
01756     return returnValue;
01757 }

template<class ValueTypeT, class StorageInterfaceT>
bool osg::PointInterface< ValueTypeT, StorageInterfaceT >::equals const PointInterface< ValueTypeT, StorageInterfaceT > &  vec,
const ValueTypeT  tolerance
const [inline, inherited]
 

Returns true iff the two points are eual within a given tolerance.

Definition at line 910 of file OSGVector.inl.

Referenced by osg::VectorInterface< ValueTypeT, StorageInterfaceT >::operator==(), and osg::PointInterface< ValueTypeT, StorageInterfaceT >::operator==().

00913 {
00914     bool returnValue = true;
00915 
00916     for(UInt32 i = 0; i < Self::_uiSize; i++)
00917     {
00918         returnValue &= 
00919             ( (Self::_values[i] - vec  ._values[i] <= tolerance) &&
00920               (vec  ._values[i] - Self::_values[i] <= tolerance));
00921     }
00922 
00923     return returnValue;
00924 }

template<class ValueTypeT, class StorageInterfaceT>
const ValueTypeT * osg::PointInterface< ValueTypeT, StorageInterfaceT >::getValues void   )  const [inline, inherited]
 

Get a const pointer to the value storage.

Definition at line 868 of file OSGVector.inl.

00869 {
00870     return Self::_values;
00871 }

template<class ValueTypeT, class StorageInterfaceT>
ValueTypeT * osg::PointInterface< ValueTypeT, StorageInterfaceT >::getValues void   )  [inline, inherited]
 

Get a pointer to the value storage.

Definition at line 858 of file OSGVector.inl.

Referenced by osg::TransformationMatrix< ValueTypeT >::getValues(), osg::PointInterface< ValueTypeT, VecStorage4< ValueTypeT > >::PointInterface(), osg::PointInterface< ValueTypeT, VecStorage4< ValueTypeT > >::setValue(), and osg::VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > >::VectorInterface().

00859 {
00860     return Self::_values;
00861 }

template<class ValueTypeT, class StorageInterfaceT>
bool osg::PointInterface< ValueTypeT, StorageInterfaceT >::isZero void   )  const [inline, inherited]
 

Returns true iff the norm of each value is less than Eps.

Definition at line 881 of file OSGVector.inl.

Referenced by osg::VectorInterface< ValueTypeT, StorageInterfaceT >::enclosedAngle(), osg::Line::getClosestPoints(), and osg::BoxVolume::setBoundsByCenterAndSize().

00882 {
00883     bool returnValue = true;
00884 
00885     for(UInt32 i = 0; i < Self::_uiSize; i++)
00886     {
00887         returnValue &= ((Self::_values[i] <=  Eps) &&
00888                         (Self::_values[i] >= -Eps));
00889     }
00890 
00891     return returnValue;
00892 }

template<class ValueTypeT, class StorageInterfaceT>
VectorInterface< ValueTypeT, StorageInterfaceT >::RealReturnType osg::VectorInterface< ValueTypeT, StorageInterfaceT >::length void   )  const [inline]
 

Euclidean length of the vector.

Definition at line 1562 of file OSGVector.inl.

References osg::osgSqrt(), and osg::VectorInterface< ValueTypeT, StorageInterfaceT >::squareLength().

Referenced by osg::dist3D_Segment_to_Segment(), osg::extend(), osg::CylinderVolume::getScalarVolume(), osg::QuaternionBase< ValueTypeT >::getValueAsAxisDeg(), osg::Plane::intersect(), osg::Line::intersect(), osg::DynamicVolume::morphToType(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::normalize(), osg::QuaternionBase< ValueTypeT >::setValue(), osg::Plane::transform(), and osg::CylinderVolume::transform().

01563 {
01564     return osgSqrt(Self::squareLength());
01565 }

template<class ValueTypeT, class StorageInterfaceT>
PointInterface< ValueTypeT, StorageInterfaceT >::RealReturnType osg::PointInterface< ValueTypeT, StorageInterfaceT >::maxValue void   )  const [inline, inherited]
 

Returns the maximum value of the vector.

Definition at line 991 of file OSGVector.inl.

00993 {
00994     RealReturnType returnValue = TypeTraits<RealReturnType>::getMin();
00995 
00996     for(UInt32 i = 0; i < Self::_uiSize; i++)
00997     {
00998         if(Self::_values[i] > returnValue)
00999             returnValue = Self::_values[i];
01000     }
01001 
01002     return returnValue;
01003 }

template<class ValueTypeT, class StorageInterfaceT>
void osg::PointInterface< ValueTypeT, StorageInterfaceT >::negate void   )  [inline, inherited]
 

Negates each value of the point in place.

Definition at line 898 of file OSGVector.inl.

00899 {
00900     for(UInt32 i = 0; i < Self::_uiSize; i++)
00901     {
00902         Self::_values[i] = -Self::_values[i];
00903     }
00904 }

template<class ValueTypeT, class StorageInterfaceT>
void osg::VectorInterface< ValueTypeT, StorageInterfaceT >::normalize void   )  [inline]
 

Changes vector to be of unit length.

Definition at line 1572 of file OSGVector.inl.

References osg::Eps, osg::VectorInterface< ValueTypeT, StorageInterfaceT >::length(), and osg::osgAbs().

Referenced by osg::NormalQuantifier::getSubIndex(), osg::Line::intersect(), osg::Line::Line(), osg::MatrixLookAt(), osg::Plane::Plane(), osg::QuaternionBase< ValueTypeT >::setValue(), osg::Line::setValue(), osg::NormalQuantifier::subdivide(), osg::Plane::transform(), and osg::CylinderVolume::transform().

01573 {
01574     ValueTypeT rLength = ValueTypeT(length());
01575 
01576     if(osgAbs(rLength) < Eps)
01577     {
01578         rLength = TypeTraits<ValueTypeT>::getOneElement();
01579     }
01580     else
01581     {
01582         rLength = TypeTraits<ValueTypeT>::getOneElement() / rLength;
01583     }
01584 
01585     for(UInt32 i = 0; i < Self::_uiSize; i++)
01586     {
01587         Self::_values[i] *= rLength;
01588     }
01589 }

template<class ValueTypeT, class StorageInterfaceT>
VectorInterface< ValueTypeT, StorageInterfaceT > osg::VectorInterface< ValueTypeT, StorageInterfaceT >::operator * const ValueTypeT  rVal  )  const [inline]
 

Component wise binary scalar multiplication.

Reimplemented from osg::PointInterface< ValueTypeT, StorageInterfaceT >.

Definition at line 1876 of file OSGVector.inl.

01878 {
01879     VectorInterface<ValueTypeT, StorageInterfaceT> returnValue;
01880 
01881     for(UInt32 i = 0; i < StorageInterfaceT::_uiSize; i++)
01882     {
01883         returnValue[i] = Self::_values[i] * rVal;
01884     }
01885 
01886     return returnValue;
01887 }

template<class ValueTypeT, class StorageInterfaceT>
ValueTypeT osg::VectorInterface< ValueTypeT, StorageInterfaceT >::operator * const PntInterface pnt  )  const [inline]
 

Definition at line 1717 of file OSGVector.inl.

References osg::VectorInterface< ValueTypeT, StorageInterfaceT >::dot().

01719 {
01720      return this->dot(pnt);
01721 }

template<class ValueTypeT, class StorageInterfaceT>
ValueTypeT osg::VectorInterface< ValueTypeT, StorageInterfaceT >::operator * const VectorInterface< ValueTypeT, StorageInterfaceT > &  vec  )  const [inline]
 

Definition at line 1694 of file OSGVector.inl.

References osg::VectorInterface< ValueTypeT, StorageInterfaceT >::dot().

01696 {
01697     return this->dot(vec);
01698 }

template<class ValueTypeT, class StorageInterfaceT>
void osg::PointInterface< ValueTypeT, StorageInterfaceT >::operator *= const ValueTypeT  val  )  [inline, inherited]
 

Component wise scalar multiplication.

Definition at line 1013 of file OSGVector.inl.

01014 {
01015     for(UInt32 i = 0; i < Self::_uiSize; i++)
01016     {
01017         Self::_values[i] *= val;
01018     }
01019 }

template<class ValueTypeT, class StorageInterfaceT&g