osg::Vec2s Class Reference

Inheritance diagram for osg::Vec2s:

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

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
 Euclidean length of the vector.
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 dot (const PntInterface &pnt) const
 Euclidean length of the vector.
ValueTypeT operator* (const VectorInterface &vec) const
 Euclidean length of the vector.
ValueTypeT operator* (const PntInterface &pnt) const
 Euclidean length of the vector.
RealReturnType enclosedAngle (const VectorInterface &vec) const
 Returns the angle between this and another vector.
RealReturnType projectTo (const VectorInterface &toVec)
 Euclidean length of the vector.
Math


VectorInterface operator* (const ValueTypeT rVal) const
 Component wise binary scalar multiplication.
VectorInterface operator- (const VectorInterface &vec) const
 Component wise binary vector subtraction operator.
VectorInterface operator- (void) const
 Nondestructive unary negation, returns new vector.
VectorInterface operator+ (const VectorInterface &vec) const
 Component wise binary vector addition operator.
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 point by adding it to zero.
const VectorInterfacesubZero (void) const
 Returns the corrosponding point by adding it to zero.
Math


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 ValueTypeT val)
 Component wise scalar multiplication.
void operator/= (const ValueTypeT val)
 Component wise scalar division.
void operator+= (const VecInterface &vec)
 Component wise vector addition.
void operator-= (const VecInterface &vec)
 Component wise vector substraction.
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.
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.
Set Values


void setNull (void)
void setValue (const PointInterface &vec)
template<class ValueType2T, class StorageInterface2T>
void setValue (const PointInterface< ValueType2T, StorageInterface2T > &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.
Element Access


ValueTypeT & operator[] (const UInt32 uiVal)
const ValueTypeT & operator[] (const UInt32 uiVal) const

Static Public Attributes

static const VectorInterface Null


Detailed Description

This is a documentation wrapper. Its only purpose is to fool doxygen into thinking of a typedef as a class and to allow you to find all the needed info from this page.

Warning:
The real inheritance is not what you see here.

This is just to give you an idea of the conceptual relations and to help you understand the available methods of this class.

Definition at line 8318 of file dummyClasses.dox.


Member Typedef Documentation

template<class ValueTypeT, class StorageInterfaceT>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::Inherited [inherited]

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

Definition at line 506 of file OSGVector.h.

template<class ValueTypeT, class StorageInterfaceT>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::RealReturnType [inherited]

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

Definition at line 508 of file OSGVector.h.

template<class ValueTypeT, class StorageInterfaceT>
osg::VectorInterface< ValueTypeT, StorageInterfaceT >::ValueType [inherited]

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

Definition at line 510 of file OSGVector.h.

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

Definition at line 512 of file OSGVector.h.

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

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

Definition at line 515 of file OSGVector.h.

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

Definition at line 299 of file OSGVector.h.


Member Function Documentation

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

Definition at line 1454 of file OSGVector.inl.

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

Referenced by osg::calcFaceNormals(), osg::ExtrusionSurface::calcQuadFaceNormal(), osg::ExtrusionSurface::calcYAxes(), osg::ExtrusionSurface::calcZAxes(), osg::createNormalVolume(), osg::ExtrusionSurface::determineTopology(), osg::dist3D_Segment_to_Segment(), osg::Slices::drawSlices(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::enclosedAngle(), osg::extend(), osg::Surface::FindClosestPoint(), osg::CylinderVolume::getScalarVolume(), osg::QuaternionBase< ValueTypeT >::getValueAsAxisDeg(), osg::DVRVolume::initializeClipObjects(), osg::intersect(), osg::Plane::intersect(), osg::Line::intersect(), osg::Transform::intersectActorEnter(), osg::Transform::intersectActorLeave(), osg::Transform::intersectEnter(), osg::ScreenGroup::intersectEnter(), osg::InverseTransform::intersectEnter(), osg::Billboard::intersectEnter(), osg::Transform::intersectLeave(), osg::ScreenGroup::intersectLeave(), osg::InverseTransform::intersectLeave(), osg::Billboard::intersectLeave(), osg::DynamicVolume::morphToType(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::normalize(), osg::Brick::render3DSlices(), osg::TrackballNavigator::rotate(), osg::TrackballNavigator::set(), osg::QuaternionBase< ValueTypeT >::setValue(), osg::SimpleSceneManager::showAll(), osg::Plane::transform(), osg::CylinderVolume::transform(), osg::GeoTypeGraphOp::travNodeEnter(), osg::ProjectionCameraDecorator::updateData(), and osg::Trackball::updateRotation().

01455 {
01456     return osgsqrt(Self::squareLength());
01457 }

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

Definition at line 1464 of file OSGVector.inl.

Referenced by osg::calcVertexNormals(), osg::Surface::FindClosestPoint(), osg::Surface::FindClosestPointExact(), osg::Line::getClosestPoints(), osg::Surface::getDesiredError(), and osg::VectorInterface< ValueTypeT, StorageInterfaceT >::length().

01465 {
01466     RealReturnType rTmpVal = RealReturnType(Self::_values[0] * 
01467                                             Self::_values[0]  );
01468 
01469     for(UInt32 i = 1; i < Self::_iSize; i++)
01470     {
01471         rTmpVal += Self::_values[i] * Self::_values[i];
01472     }
01473 
01474     return rTmpVal;
01475 }

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

Definition at line 1481 of file OSGVector.inl.

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

Referenced by osg::DVRIsoShader::activate_FragmentProgramShading(), osg::Surface::buildSurface(), osg::DVRClipGeometry::buildTriangledGeometry(), osg::calcFaceNormals(), osg::Billboard::calcMatrix(), osg::ExtrusionSurface::calcQuadFaceNormal(), osg::ExtrusionSurface::calcVertexNormal(), osg::calcVertexNormals(), osg::calcVertexTangents(), osg::ExtrusionSurface::calcXAxis(), osg::ExtrusionSurface::calcYAxes(), osg::ExtrusionSurface::calcZAxes(), osg::TextVectorGlyph::computeContourOrientations(), osg::computeEdgeNormal(), osg::createNormalizationCubeMap(), osg::createNormalMapFromBump(), osg::createNormalVolume(), osg::Slices::drawPrimitives(), osg::Slices::drawSlices(), osg::Surface::FindClosestPoint(), osg::WalkNavigator::forward(), osg::FlyNavigator::forward(), osg::DVRSlice::getNormal(), osg::TextVectorGlyph::getNormals(), osg::NormalQuantifier::getSubIndex(), osg::Line::intersect(), osg::ExtrusionSurface::isLeft(), osg::makeSphereGeo(), osg::MatrixLookAt(), osg::Plane::Plane(), osg::MergeGraphOp::processTransformations(), osg::RAWSceneFileType::read(), osg::WalkNavigator::right(), osg::FlyNavigator::right(), osg::FlyNavigator::rotate(), osg::DVRIsoShader::setupCombinerParametersDiffuse(), osg::DVRIsoShader::setupCombinerParametersSpecular(), osg::QuaternionBase< ValueTypeT >::setValue(), osg::Line::setValue(), osg::NormalQuantifier::subdivide(), osg::Plane::transform(), osg::CylinderVolume::transform(), and osg::TileGeometryLoad::updateView().

01482 {
01483     ValueTypeT rLength = ValueTypeT(length());
01484 
01485     if(osgabs(rLength) < Eps)
01486     {
01487         rLength = TypeTraits<ValueTypeT>::getOneElement();
01488     }
01489     else
01490     {
01491         rLength = TypeTraits<ValueTypeT>::getOneElement() / rLength;
01492     }
01493 
01494     for(UInt32 i = 0; i < Self::_iSize; i++)
01495     {
01496         Self::_values[i] *= rLength;
01497     }
01498 }

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

Definition at line 1512 of file OSGVector.inl.

Referenced by osg::Billboard::calcMatrix(), osg::ExtrusionSurface::calcNonUnitZAxis(), osg::ExtrusionSurface::calcTriangleFaceNormal(), osg::calcVertexTangents(), osg::ExtrusionSurface::calcXAxis(), osg::Surface::checkOrient(), osg::createNormalMapFromBump(), osg::Slices::createSlice(), osg::Line::getClosestPoints(), osg::ProjectionCameraDecorator::getProjectionTranslation(), osg::FrustumVolume::getScalarVolume(), osg::Plane::intersect(), osg::Line::intersect(), osg::DVRClipGeometry::linkContour(), osg::MatrixLookAt(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::operator%(), osg::NormalQuantifier::rayTriangle(), osg::QuaternionBase< ValueTypeT >::setValue(), and osg::ProjectionCameraDecorator::updateData().

01513 {
01514     VectorInterface<ValueTypeT, StorageInterfaceT> returnValue;
01515 
01516     if(Self::_iSize >= 3)
01517     {
01518         returnValue[0] =
01519             Self::_values[1] * vec._values[2] - 
01520             Self::_values[2] * vec._values[1];
01521         returnValue[1] =
01522             Self::_values[2] * vec._values[0] - 
01523             Self::_values[0] * vec._values[2];
01524         returnValue[2] =
01525             Self::_values[0] * vec._values[1] - 
01526             Self::_values[1] * vec._values[0];
01527     }
01528     else
01529     {
01530         // Must be changed
01531         fprintf(stderr, "cross only implemented for size 3\n");
01532     }
01533 
01534     return returnValue;
01535 }

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

Definition at line 1540 of file OSGVector.inl.

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

01542 {
01543     return this->cross(vec);
01544 }

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

Definition at line 1553 of file OSGVector.inl.

Referenced by osg::calcVertexNormals(), osg::WalkNavigator::forward(), osg::Plane::Plane(), osg::RAWSceneFileType::read(), osg::WalkNavigator::right(), osg::FlyNavigator::right(), osg::TrackballNavigator::rotate(), osg::FlyNavigator::rotate(), osg::CylinderVolume::transform(), and osg::Trackball::updateRotation().

01554 {
01555     if(Self::_iSize >= 3)
01556     {
01557         ValueTypeT rTmp[2];
01558 
01559         rTmp[0] = 
01560             Self::_values[1] * vec._values[2] - 
01561             Self::_values[2] * vec._values[1];
01562         rTmp[1] = 
01563             Self::_values[2] * vec._values[0] - 
01564             Self::_values[0] * vec._values[2];
01565 
01566         Self::_values[2] =
01567             Self::_values[0] * vec._values[1] -
01568             Self::_values[1] * vec._values[0];
01569 
01570         Self::_values[0] = rTmp[0];
01571         Self::_values[1] = rTmp[1];
01572     }
01573     else
01574     {
01575         // Must be changed
01576         fprintf(stderr, "crossThis only available for size 3\n");
01577     }
01578 }

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

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

Definition at line 1611 of file OSGVector.inl.

01613 {
01614     ValueTypeT rTmpVal = Self::_values[0] * pnt[0];
01615 
01616     for(UInt32 i = 1; i < Self::_iSize; i++)
01617     {
01618         rTmpVal += Self::_values[i] * pnt[i];
01619     }
01620 
01621     return rTmpVal;
01622 }

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

Definition at line 1603 of file OSGVector.inl.

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

01605 {
01606     return this->dot(vec);
01607 }

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

Definition at line 1626 of file OSGVector.inl.

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

01628 {
01629      return this->dot(pnt);
01630 }

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

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

Definition at line 1785 of file OSGVector.inl.

01787 {
01788     VectorInterface<ValueTypeT, StorageInterfaceT> returnValue;
01789 
01790     for(UInt32 i = 0; i < StorageInterfaceT::_iSize; i++)
01791     {
01792         returnValue[i] = Self::_values[i] * rVal;
01793     }
01794 
01795     return returnValue;
01796 }

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

Definition at line 1637 of file OSGVector.inl.

References osg::VectorInterface< ValueTypeT, StorageInterfaceT >::dot(), osg::Eps, osg::PointInterface< ValueTypeT, StorageInterfaceT >::isZero(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::length(), osg::osgacos(), and osg::Pi.

Referenced by osg::ExtrusionSurface::calcVertexNormal(), and osg::ExtrusionSurface::storeSweepSurfaceWithNormals().

01639 {
01640     RealReturnType returnValue;
01641 
01642     if(Self::isZero() || vec.isZero())
01643     {
01644         returnValue = TypeTraits<RealReturnType>::getZeroElement();
01645     }
01646     else
01647     {
01648         returnValue  = dot(vec);
01649         returnValue /= (length() * vec.length());
01650 
01651         if((returnValue - Eps) < -1.)
01652         {
01653             returnValue = Pi;
01654         }
01655         else if((returnValue + Eps) > 1.)
01656         {
01657             returnValue = TypeTraits<RealReturnType>::getZeroElement();
01658         }
01659         else
01660         {
01661             returnValue = osgacos(returnValue);
01662         }
01663     }
01664 
01665     return returnValue;
01666 }

template<class ValueTypeT, class StorageInterfaceT>
VectorInterface< ValueTypeT, StorageInterfaceT >::RealReturnType osg::VectorInterface< ValueTypeT, StorageInterfaceT >::projectTo ( const VectorInterface< ValueTypeT, StorageInterfaceT > &  toVec  )  [inline, inherited]

Definition at line 1671 of file OSGVector.inl.

References osg::VectorInterface< ValueTypeT, StorageInterfaceT >::dot(), osg::Eps, osg::osgabs(), and osg::PointInterface< ValueTypeT, StorageInterfaceT >::setNull().

Referenced by osg::Plane::transform().

01673 {
01674     RealReturnType rDot       = dot(toVec);
01675     RealReturnType rSquareDot = toVec.dot(toVec);
01676 
01677     if(rSquareDot > Eps)
01678     {
01679         rDot /= rSquareDot;
01680 
01681         if(osgabs(rDot) > Eps)
01682         {
01683             *this  = toVec;
01684             *this *= ValueTypeT(rDot);
01685         }
01686         else
01687         {
01688             this->setNull();
01689             rDot = TypeTraits<RealReturnType>::getZeroElement();
01690         }
01691     }
01692     else
01693     {
01694         rDot = TypeTraits<RealReturnType>::getOneElement();
01695     }
01696 
01697     return rDot;
01698 }

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

Definition at line 1719 of file OSGVector.inl.

Referenced by osg::makeSphereGeo().

01720 {
01721     return *(static_cast<PntInterface *>(this));
01722 }

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

Definition at line 1707 of file OSGVector.inl.

01708 {
01709     return *(static_cast<const PntInterface *>(this));
01710 }

template<class ValueTypeT, class StorageInterfaceT>
VectorInterface< ValueTypeT, StorageInterfaceT > & osg::VectorInterface< ValueTypeT, StorageInterfaceT >::subZero ( void   )  [inline, inherited]

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

Definition at line 1727 of file OSGVector.inl.

01728 {
01729     return *this;
01730 }

template<class ValueTypeT, class StorageInterfaceT>
const VectorInterface< ValueTypeT, StorageInterfaceT > & osg::VectorInterface< ValueTypeT, StorageInterfaceT >::subZero ( void   )  const [inline, inherited]

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

Definition at line 1735 of file OSGVector.inl.

01736 {
01737     return (*this);
01738 }

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

Definition at line 1748 of file OSGVector.inl.

01750 {
01751     VectorInterface<ValueTypeT, StorageInterfaceT> returnValue;
01752 
01753     for(UInt32 i = 0; i < StorageInterfaceT::_iSize; i++)
01754     {
01755         returnValue[i] = Self::_values[i] - vec[i];
01756     }
01757 
01758     return returnValue;
01759 }

template<class ValueTypeT, class StorageInterfaceT>
VectorInterface< ValueTypeT, StorageInterfaceT > osg::VectorInterface< ValueTypeT, StorageInterfaceT >::operator- ( void   )  const [inline, inherited]

Definition at line 1803 of file OSGVector.inl.

01804 {
01805     VectorInterface<ValueTypeT, StorageInterfaceT> returnValue;
01806 
01807     for(UInt32 i = 0; i < Self::_iSize; i++)
01808     {
01809         returnValue._values[i] = - Self::_values[i];
01810     }
01811 
01812     return returnValue;
01813 }

template<class ValueTypeT, class StorageInterfaceT>
PointInterface< ValueTypeT, StorageInterfaceT >::VecInterface osg::PointInterface< ValueTypeT, StorageInterfaceT >::operator- ( const PointInterface< ValueTypeT, StorageInterfaceT > &  vec  )  const [inline, inherited]

Definition at line 1000 of file OSGVector.inl.

01002 {
01003     VecInterface returnValue(*this);
01004 
01005     for(UInt32 i = 0; i < Self::_iSize; i++)
01006     {
01007         returnValue[i] -= vec[i];
01008     }
01009 
01010     return returnValue;
01011 }

template<class ValueTypeT, class StorageInterfaceT>
PointInterface< ValueTypeT, StorageInterfaceT > osg::PointInterface< ValueTypeT, StorageInterfaceT >::operator- ( const VecInterface vec  )  const [inline, inherited]

Definition at line 1036 of file OSGVector.inl.

01038 {
01039     PointInterface<ValueTypeT, StorageInterfaceT> returnValue;
01040 
01041     for(UInt32 i = 0; i < StorageInterfaceT::_iSize; i++)
01042     {
01043         returnValue[i] = Self::_values[i] - vec[i];
01044     }
01045 
01046     return returnValue;
01047 }

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

Definition at line 1094 of file OSGVector.inl.

01095 {
01096     PointInterface<ValueTypeT, StorageInterfaceT> returnValue;
01097 
01098     for(UInt32 i = 0; i < Self::_iSize; i++)
01099     {
01100         returnValue._values[i] = - Self::_values[i];
01101     }
01102 
01103     return returnValue;
01104 }

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

Definition at line 1766 of file OSGVector.inl.

01768 {
01769     VectorInterface<ValueTypeT, StorageInterfaceT> returnValue;
01770 
01771     for(UInt32 i = 0; i < StorageInterfaceT::_iSize; i++)
01772     {
01773         returnValue[i] = Self::_values[i] + vec[i];
01774     }
01775 
01776     return returnValue;
01777 }

template<class ValueTypeT, class StorageInterfaceT>
PointInterface< ValueTypeT, StorageInterfaceT > osg::PointInterface< ValueTypeT, StorageInterfaceT >::operator+ ( const VecInterface vec  )  const [inline, inherited]

Definition at line 1018 of file OSGVector.inl.

01020 {
01021     PointInterface<ValueTypeT, StorageInterfaceT> returnValue;
01022 
01023     for(UInt32 i = 0; i < StorageInterfaceT::_iSize; i++)
01024     {
01025         returnValue[i] = Self::_values[i] + vec[i];
01026     }
01027 
01028     return returnValue;
01029 }

template<class ValueTypeT, class StorageInterfaceT>
bool osg::VectorInterface< ValueTypeT, StorageInterfaceT >::operator< ( const VectorInterface< ValueTypeT, StorageInterfaceT > &  other  )  const [inline, inherited]

Definition at line 1838 of file OSGVector.inl.

01840 {
01841     bool ret = false;
01842 
01843     for(UInt32 i = 0; i < Self::_iSize; i++)
01844     {
01845         if(Self::_values[i] > other._values[i])
01846         {
01847             break;
01848         }
01849         if(Self::_values[i] < other._values[i])
01850         {
01851             ret = true;
01852             break;
01853         }
01854     }
01855 
01856     return ret;
01857 }

template<class ValueTypeT, class StorageInterfaceT>
bool osg::PointInterface< ValueTypeT, StorageInterfaceT >::operator< ( const PointInterface< ValueTypeT, StorageInterfaceT > &  other  )  const [inline, inherited]

Definition at line 1207 of file OSGVector.inl.

01209 {
01210     bool ret = false;
01211 
01212     for(UInt32 i = 0; i < Self::_iSize; i++)
01213     {
01214         if(Self::_values[i] > other._values[i])
01215         {
01216             break;
01217         }
01218         if(Self::_values[i] < other._values[i])
01219         {
01220             ret = true;
01221             break;
01222         }
01223     }
01224 
01225     return ret;
01226 }

template<class ValueTypeT, class StorageInterfaceT>
bool osg::VectorInterface< ValueTypeT, StorageInterfaceT >::operator== ( const VectorInterface< ValueTypeT, StorageInterfaceT > &  other  )  const [inline, inherited]

Definition at line 1863 of file OSGVector.inl.

References osg::Eps, and osg::PointInterface< ValueTypeT, StorageInterfaceT >::equals().

01865 {
01866     //CHECK
01867     return Self::equals(other, ValueTypeT(Eps));
01868 }

template<class ValueTypeT, class StorageInterfaceT>
bool osg::PointInterface< ValueTypeT, StorageInterfaceT >::operator== ( const PointInterface< ValueTypeT, StorageInterfaceT > &  other  )  const [inline, inherited]

Definition at line 1232 of file OSGVector.inl.

References osg::Eps, and osg::PointInterface< ValueTypeT, StorageInterfaceT >::equals().

01234 {
01235     // CHECK
01236     return Self::equals(other, ValueTypeT(Eps));
01237 }

template<class ValueTypeT, class StorageInterfaceT>
bool osg::VectorInterface< ValueTypeT, StorageInterfaceT >::operator!= ( const VectorInterface< ValueTypeT, StorageInterfaceT > &  other  )  const [inline, inherited]

Definition at line 1874 of file OSGVector.inl.

01876 {
01877     return ! (*this == other);
01878 }

template<class ValueTypeT, class StorageInterfaceT>
bool osg::PointInterface< ValueTypeT, StorageInterfaceT >::operator!= ( const PointInterface< ValueTypeT, StorageInterfaceT > &  other  )  const [inline, inherited]

Definition at line 1243 of file OSGVector.inl.

01245 {
01246     return ! (*this == other);
01247 }

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

Definition at line 591 of file OSGVector.inl.

Referenced by osg::VectorInterface< ValueTypeT, StorageInterfaceT >::projectTo(), and osg::TransformationMatrix< ValueTypeT >::setIdentity().

00592 {
00593     for(UInt32 i = 0; i < Self::_iSize; i++)
00594     {
00595         Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00596     }
00597 }

template<class ValueTypeT, class StorageInterfaceT>
void osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValue ( const PointInterface< ValueTypeT, StorageInterfaceT > &  vec  )  [inline, inherited]

template<class ValueTypeT, class StorageInterfaceT>
template<class ValueType2T, class StorageInterface2T>
void osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValue ( const PointInterface< ValueType2T, StorageInterface2T > &  vec  )  [inline, inherited]

Definition at line 627 of file OSGVector.inl.

00628 {
00629     typedef PointInterface<ValueType2T, StorageInterface2T> VectorT;
00630 
00631     static const UInt32 nElementsToCopy = Self::_iSize < VectorT::_iSize ? Self::_iSize : VectorT::_iSize;
00632 
00633     for(UInt32 i = 0; i < nElementsToCopy; ++i)
00634     {
00635         Self::_values[i] = vec.getValues()[i];
00636     }
00637 }

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

Definition at line 693 of file OSGVector.inl.

00694 {
00695     for(UInt32 i = 0; i < Self::_iSize; i++)
00696     {
00697         Self::_values[i] = pVals[i];
00698     }
00699 }

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

Definition at line 706 of file OSGVector.inl.

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

00707 {
00708     setValue(static_cast<const ValueTypeT *>(pVals));
00709 }

template<class ValueTypeT, class StorageInterfaceT>
void osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValue ( const Char8 szString  )  [inline, inherited]

Definition at line 796 of file OSGVector.inl.

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

00797 {
00798     setValueFromCString(szString);
00799 }

template<class ValueTypeT, class StorageInterfaceT>
void osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValue ( Char8 szString  )  [inline, inherited]

Definition at line 804 of file OSGVector.inl.

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

00805 {
00806     setValueFromCString(szString);
00807 }

template<class ValueTypeT, class StorageInterfaceT>
void osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValueFromCString ( const Char8 szString  )  [inline, inherited]

Definition at line 718 of file OSGVector.inl.

Referenced by osg::ClusterWindow::loadCalibration(), osg::ClusterWindow::loadFilter(), osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValue(), osg::Color4< ValueTypeT >::setValue(), osg::Color3< ValueTypeT >::setValue(), and osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValueFromCString().

00720 {
00721     UInt32 i;
00722     UInt32 numOfToken = Self::_iSize;
00723 
00724     Char8 *c      = const_cast<Char8 *>(szString);
00725     Char8 *tokenC = 0;
00726 
00727     Char8  token[256];
00728 
00729     if(szString == NULL || (*szString) == '\0')
00730     {
00731         for(i = 0; i < Self::_iSize; i++)
00732             Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00733 
00734         return;
00735     }
00736 
00737     for (i = 0; i < numOfToken; c++)
00738     {
00739         switch (*c)
00740         {
00741             case '\0':
00742                 if(tokenC)
00743                 {
00744                     *tokenC = 0;
00745                     Self::_values[i++] =
00746                         TypeTraits<ValueTypeT>::getFromString(token);
00747                 }
00748 
00749                 while (i < numOfToken)
00750                 {
00751                     Self::_values[i++] =
00752                         TypeTraits<ValueTypeT>::getZeroElement();
00753                 }
00754                 break;
00755 
00756             case ' ' :
00757             case '\t':
00758             case '\n':
00759         case ',':
00760                 if(tokenC)
00761                 {
00762                     *tokenC = 0;
00763                     Self::_values[i++] =
00764                         TypeTraits<ValueTypeT>::getFromString(token);
00765                     tokenC = 0;
00766                 }
00767                 break;
00768             default:
00769                 if(!tokenC)
00770                 {
00771                     tokenC = token;
00772                 }
00773                 *tokenC++ = *c;
00774                 break;
00775         }
00776     }
00777 }

template<class ValueTypeT, class StorageInterfaceT>
void osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValueFromCString ( Char8 szString  )  [inline, inherited]

Definition at line 786 of file OSGVector.inl.

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

00787 {
00788     setValueFromCString(static_cast<const Char8 *>(szString));
00789 }

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

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

Definition at line 828 of file OSGVector.inl.

00829 {
00830     return Self::_values;
00831 }

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

Definition at line 841 of file OSGVector.inl.

References osg::Eps.

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

00842 {
00843     bool returnValue = true;
00844 
00845     for(UInt32 i = 0; i < Self::_iSize; i++)
00846     {
00847         returnValue &= ((Self::_values[i] <=  Eps) &&
00848                         (Self::_values[i] >= -Eps));
00849     }
00850 
00851     return returnValue;
00852 }

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

Definition at line 858 of file OSGVector.inl.

Referenced by osg::DVRClipGeometry::buildTriangledGeometry(), and osg::ExtrusionSurface::calcZAxes().

00859 {
00860     for(UInt32 i = 0; i < Self::_iSize; i++)
00861     {
00862         Self::_values[i] = -Self::_values[i];
00863     }
00864 }

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

Definition at line 870 of file OSGVector.inl.

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

00873 {
00874     bool returnValue = true;
00875 
00876     for(UInt32 i = 0; i < Self::_iSize; i++)
00877     {
00878         returnValue &= 
00879             ( (Self::_values[i] - vec  ._values[i] <= tolerance) &&
00880               (vec  ._values[i] - Self::_values[i] <= tolerance));
00881     }
00882 
00883     return returnValue;
00884 }

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

Definition at line 917 of file OSGVector.inl.

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

Referenced by osg::Surface::getDesiredError().

00919 {
00920     return osgsqrt(dist2(vec));
00921 }

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

Definition at line 929 of file OSGVector.inl.

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

00931 {
00932     RealReturnType returnValue = 0;
00933     RealReturnType tmp;
00934 
00935     for(UInt32 i = 0; i < Self::_iSize; i++)
00936     {
00937         tmp = Self::_values[i] - vec._values[i];
00938         
00939         returnValue += tmp * tmp;
00940     }
00941 
00942     return returnValue;
00943 }

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

Definition at line 951 of file OSGVector.inl.

Referenced by osg::Billboard::adjustVolume().

00953 {
00954     RealReturnType returnValue = TypeTraits<RealReturnType>::getMin();
00955 
00956     for(UInt32 i = 0; i < Self::_iSize; i++)
00957     {
00958         if(Self::_values[i] > returnValue)
00959             returnValue = Self::_values[i];
00960     }
00961 
00962     return returnValue;
00963 }

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

Definition at line 973 of file OSGVector.inl.

00974 {
00975     for(UInt32 i = 0; i < Self::_iSize; i++)
00976     {
00977         Self::_values[i] *= val;
00978     }
00979 }

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

Definition at line 986 of file OSGVector.inl.

00987 {
00988     for(UInt32 i = 0; i < Self::_iSize; i++)
00989     {
00990         Self::_values[i] /= val;
00991     }
00992 }

template<class ValueTypeT, class StorageInterfaceT>
void osg::PointInterface< ValueTypeT, StorageInterfaceT >::operator+= ( const VecInterface vec  )  [inline, inherited]

Definition at line 1110 of file OSGVector.inl.

01112 {
01113     for(UInt32 i = 0; i < Self::_iSize; i++)
01114     {
01115         Self::_values[i] += vec._values[i];
01116     }
01117 }

template<class ValueTypeT, class StorageInterfaceT>
void osg::PointInterface< ValueTypeT, StorageInterfaceT >::operator-= ( const VecInterface vec  )  [inline, inherited]

Definition at line 1123 of file OSGVector.inl.

01125 {
01126     for(UInt32 i = 0; i < Self::_iSize; i++)
01127     {
01128         Self::_values[i] -= vec._values[i];
01129     }
01130 }

template<class ValueTypeT, class StorageInterfaceT>
ValueTypeT & osg::PointInterface< ValueTypeT, StorageInterfaceT >::operator[] ( const UInt32  uiVal  )  [inline, inherited]

Definition at line 1138 of file OSGVector.inl.

01139 {
01140     return Self::_values[uiVal];
01141 }

template<class ValueTypeT, class StorageInterfaceT>
const ValueTypeT & osg::PointInterface< ValueTypeT, StorageInterfaceT >::operator[] ( const UInt32  uiVal  )  const [inline, inherited]

Definition at line 1147 of file OSGVector.inl.

01148 {
01149     return Self::_values[uiVal];
01150 }


Member Data Documentation

template<class ValueTypeT, class StorageInterfaceT>
const VectorInterface< ValueTypeT, StorageInterfaceT > osg::VectorInterface< ValueTypeT, StorageInterfaceT >::Null [inline, static, inherited]

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

Definition at line 517 of file OSGVector.h.

Referenced by osg::Billboard::calcMatrix(), osg::IntersectAction::getHitNormal(), osg::TriangleIterator::getNormal(), osg::PrimitiveIterator::getNormal(), osg::LineIterator::getNormal(), osg::FaceIterator::getNormal(), osg::TriangleIterator::getTexCoords(), osg::PrimitiveIterator::getTexCoords(), osg::LineIterator::getTexCoords(), osg::FaceIterator::getTexCoords(), osg::TriangleIterator::getTexCoords1(), osg::PrimitiveIterator::getTexCoords1(), osg::LineIterator::getTexCoords1(), osg::FaceIterator::getTexCoords1(), osg::TriangleIterator::getTexCoords2(), osg::PrimitiveIterator::getTexCoords2(), osg::LineIterator::getTexCoords2(), osg::FaceIterator::getTexCoords2(), osg::TriangleIterator::getTexCoords3(), osg::PrimitiveIterator::getTexCoords3(), osg::LineIterator::getTexCoords3(), osg::FaceIterator::getTexCoords3(), osg::TriangleIterator::getTexCoords4(), osg::PrimitiveIterator::getTexCoords4(), osg::LineIterator::getTexCoords4(), osg::FaceIterator::getTexCoords4(), osg::TriangleIterator::getTexCoords5(), osg::PrimitiveIterator::getTexCoords5(), osg::LineIterator::getTexCoords5(), osg::FaceIterator::getTexCoords5(), osg::TriangleIterator::getTexCoords6(), osg::PrimitiveIterator::getTexCoords6(), osg::LineIterator::getTexCoords6(), osg::FaceIterator::getTexCoords6(), osg::TriangleIterator::getTexCoords7(), osg::PrimitiveIterator::getTexCoords7(), osg::LineIterator::getTexCoords7(), and osg::FaceIterator::getTexCoords7().


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

Generated on Mon Mar 17 11:58:05 2008 for OpenSG by  doxygen 1.5.5