Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::VectorInterface< ValueTypeT, StorageInterfaceT > Class Template Reference
[Objects]

#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

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 VectorT>
 VectorInterface (const VectorT &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
 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 operator * (const VectorInterface &vec) const
 Euclidean length of the vector.
ValueTypeT dot (const PntInterface &pnt) 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.
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
*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 VectorT>
void setValue (const VectorT &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- (void)
 Nondestructive unary negation, returns new point.
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 Math.

Definition at line 536 of file OSGVector.h.


Member Typedef Documentation

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

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

Definition at line 544 of file OSGVector.h.

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

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

Definition at line 546 of file OSGVector.h.

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

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

Definition at line 548 of file OSGVector.h.

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

Definition at line 550 of file OSGVector.h.

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

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

Definition at line 553 of file OSGVector.h.

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

Definition at line 296 of file OSGVector.h.


Constructor & Destructor Documentation

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

Definition at line 1306 of file OSGVector.inl.

01306                                                                     : 
01307     Inherited()
01308 {
01309     for(UInt32 i = 0; i < Self::_iSize; i++)
01310     {
01311         Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
01312     }
01313 }

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

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

Definition at line 1324 of file OSGVector.inl.

01324                                                                            :
01325     Inherited(pVals)
01326 {
01327 }

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

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

Definition at line 1337 of file OSGVector.inl.

01337                                                                      : 
01338     Inherited(pVals)
01339 {
01340 }

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

Definition at line 572 of file OSGVector.h.

00573     {
00574         if(Self::_iSize <= VectorT::_iSize)
00575         {
00576             for(UInt32 i = 0; i < Self::_iSize; i++)
00577             {
00578                 Self::_values[i] = vec.getValues()[i];
00579             }
00580         }
00581         else
00582         {
00583             UInt32 i;
00584             for(i = 0; i < VectorT::_iSize; i++)
00585             {
00586                 Self::_values[i] = vec.getValues()[i];
00587             }
00588             for(i = VectorT::_iSize; i < Self::_iSize; i++)
00589             {
00590                 Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00591             }
00592         }
00593     }

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

Definition at line 1403 of file OSGVector.inl.

01404                                    : 
01405 
01406     Inherited(source)
01407 {
01408 }

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

Definition at line 1430 of file OSGVector.inl.

01431                                                                             :
01432 
01433     Inherited(rVal1, rVal2)
01434 {
01435 }

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

Definition at line 1440 of file OSGVector.inl.

01442                                                                             :
01443 
01444     Inherited(rVal1, rVal2, rVal3)
01445 {
01446 }

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 1451 of file OSGVector.inl.

01454                                                                             :
01455 
01456     Inherited(rVal1, rVal2, rVal3, rVal4)
01457 {
01458 }

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

Definition at line 1467 of file OSGVector.inl.

01468 {
01469 }


Member Function Documentation

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

Definition at line 1479 of file OSGVector.inl.

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

Referenced by osg::calcFaceNormals(), osg::ExtrusionSurface::calcOptimizedContour(), osg::ExtrusionSurface::calcQuadFaceNormal(), osg::ExtrusionSurface::calcYAxes(), osg::ExtrusionSurface::calcZAxes(), osg::DVRIsoShader::createGradientImage(), osg::ExtrusionSurface::determineTopology(), osg::Slices::drawSlices(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::enclosedAngle(), osg::Surface::FindClosestPoint(), osg::CylinderVolume::getScalarVolume(), osg::DVRVolume::initializeClipObjects(), osg::Plane::intersect(), osg::Line::intersect(), osg::Transform::intersectEnter(), osg::InverseTransform::intersectEnter(), osg::Billboard::intersectEnter(), osg::Transform::intersectLeave(), osg::InverseTransform::intersectLeave(), osg::Billboard::intersectLeave(), osg::DynamicVolume::morphToType(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::normalize(), osg::Brick::render3DSlices(), osg::TrackballNavigator::rotate(), setVecLen(), osg::SimpleSceneManager::showAll(), osg::Plane::transform(), osg::GeoTypeGraphOp::travNodeEnter(), osg::ProjectionCameraDecorator::updateData(), and osg::Trackball::updateRotation().

01480 {
01481     return osgsqrt(Self::squareLength());
01482 }

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

Definition at line 1489 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().

01490 {
01491     RealReturnType rTmpVal = RealReturnType(Self::_values[0] * 
01492                                             Self::_values[0]  );
01493 
01494     for(UInt32 i = 1; i < Self::_iSize; i++)
01495     {
01496         rTmpVal += Self::_values[i] * Self::_values[i];
01497     }
01498 
01499     return rTmpVal;
01500 }

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

Definition at line 1506 of file OSGVector.inl.

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

Referenced by osg::DVRIsoShader::activate_FragmentProgramShading(), addPoint(), 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::DVRIsoShader::createGradientImage(), osg::createNormalizationCubeMap(), osg::createNormalMapFromBump(), drawViewerObjects< posTrait, colTrait, sizeTrait, geoTrait >::draw(), drawObjects< posTrait, colTrait, sizeTrait, normalTrait, geoTrait >::draw(), drawViewerQuads< posTrait, colTrait, texTrait, sizeTrait >::draw(), drawViewerObjects< posTrait, colTrait, sizeTrait, geoTrait >::drawIndexed(), drawObjects< posTrait, colTrait, sizeTrait, normalTrait, geoTrait >::drawIndexed(), drawViewerQuads< posTrait, colTrait, texTrait, sizeTrait >::drawIndexed(), 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(), and osg::TileGeometryLoad::updateView().

01507 {
01508     ValueTypeT rLength = ValueTypeT(length());
01509 
01510     if(osgabs(rLength) < Eps)
01511     {
01512         rLength = TypeTraits<ValueTypeT>::getOneElement();
01513     }
01514     else
01515     {
01516         rLength = TypeTraits<ValueTypeT>::getOneElement() / rLength;
01517     }
01518 
01519     for(UInt32 i = 0; i < Self::_iSize; i++)
01520     {
01521         Self::_values[i] *= rLength;
01522     }
01523 }

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

Definition at line 1537 of file OSGVector.inl.

Referenced by osg::DVRClipGeometry::buildTriangledGeometry(), osg::calcFaceNormals(), osg::Billboard::calcMatrix(), osg::ExtrusionSurface::calcNonUnitZAxis(), osg::ExtrusionSurface::calcTriangleFaceNormal(), osg::calcVertexTangents(), osg::ExtrusionSurface::calcXAxis(), osg::Surface::checkOrient(), osg::createNormalMapFromBump(), osg::Slices::createSlice(), drawViewerObjects< posTrait, colTrait, sizeTrait, geoTrait >::draw(), drawObjects< posTrait, colTrait, sizeTrait, normalTrait, geoTrait >::draw(), drawViewerQuads< posTrait, colTrait, texTrait, sizeTrait >::draw(), drawViewerObjects< posTrait, colTrait, sizeTrait, geoTrait >::drawIndexed(), drawObjects< posTrait, colTrait, sizeTrait, normalTrait, geoTrait >::drawIndexed(), drawViewerQuads< posTrait, colTrait, texTrait, sizeTrait >::drawIndexed(), osg::Line::getClosestPoints(), osg::DVRSlice::getNormal(), 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::Brick::render3DSlices(), osg::QuaternionBase< ValueTypeT >::setValue(), and osg::ProjectionCameraDecorator::updateData().

01538 {
01539     VectorInterface<ValueTypeT, StorageInterfaceT> returnValue;
01540 
01541     if(Self::_iSize >= 3)
01542     {
01543         returnValue[0] =
01544             Self::_values[1] * vec._values[2] - 
01545             Self::_values[2] * vec._values[1];
01546         returnValue[1] =
01547             Self::_values[2] * vec._values[0] - 
01548             Self::_values[0] * vec._values[2];
01549         returnValue[2] =
01550             Self::_values[0] * vec._values[1] - 
01551             Self::_values[1] * vec._values[0];
01552     }
01553     else
01554     {
01555         // Must be changed
01556         fprintf(stderr, "cross only implemented for size 3\n");
01557     }
01558 
01559     return returnValue;
01560 }

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

Definition at line 1565 of file OSGVector.inl.

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

01567 {
01568     return this->cross(vec);
01569 }

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

Definition at line 1578 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(), and osg::Trackball::updateRotation().

01579 {
01580     if(Self::_iSize >= 3)
01581     {
01582         ValueTypeT rTmp[2];
01583 
01584         rTmp[0] = 
01585             Self::_values[1] * vec._values[2] - 
01586             Self::_values[2] * vec._values[1];
01587         rTmp[1] = 
01588             Self::_values[2] * vec._values[0] - 
01589             Self::_values[0] * vec._values[2];
01590 
01591         Self::_values[2] =
01592             Self::_values[0] * vec._values[1] -
01593             Self::_values[1] * vec._values[0];
01594 
01595         Self::_values[0] = rTmp[0];
01596         Self::_values[1] = rTmp[1];
01597     }
01598     else
01599     {
01600         // Must be changed
01601         fprintf(stderr, "crossThis only available for size 3\n");
01602     }
01603 }

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

Definition at line 1613 of file OSGVector.inl.

Referenced by osg::DVRClipGeometry::buildTriangledGeometry(), osg::Navigator::calcDeltas(), osg::calcVertexNormals(), osg::calcVertexTangents(), osg::ExtrusionSurface::calcZAxes(), osg::Surface::checkOrient(), osg::Plane::distance(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::enclosedAngle(), osg::WalkNavigator::forward(), osg::Line::getClosestPoint(), osg::Line::getClosestPoints(), osg::Navigator::getIntersectionPoint(), osg::TextVectorGlyph::getNormals(), osg::FrustumVolume::getScalarVolume(), osg::Line::intersect(), osg::Plane::intersectInfinite(), osg::Plane::isInHalfSpace(), osg::isLeft(), osg::ExtrusionSurface::isLeft(), osg::Plane::isOnPlane(), osg::DVRClipGeometry::linkContour(), osg::MatrixLookAt(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::operator *(), osg::Plane::Plane(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::projectTo(), osg::NormalQuantifier::rayTriangle(), osg::Brick::render3DSlices(), and osg::WalkNavigator::right().

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

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

Definition at line 1628 of file OSGVector.inl.

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

01630 {
01631     return this->dot(vec);
01632 }

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

Definition at line 1636 of file OSGVector.inl.

01638 {
01639     ValueTypeT rTmpVal = Self::_values[0] * pnt[0];
01640 
01641     for(UInt32 i = 1; i < Self::_iSize; i++)
01642     {
01643         rTmpVal += Self::_values[i] * pnt[i];
01644     }
01645 
01646     return rTmpVal;
01647 }

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

Definition at line 1651 of file OSGVector.inl.

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

01653 {
01654      return this->dot(pnt);
01655 }

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

Definition at line 1662 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().

01664 {
01665     RealReturnType returnValue;
01666 
01667     if(Self::isZero() || vec.isZero())
01668     {
01669         returnValue = TypeTraits<RealReturnType>::getZeroElement();
01670     }
01671     else
01672     {
01673         returnValue  = dot(vec);
01674         returnValue /= (length() * vec.length());
01675 
01676         if((returnValue - Eps) < -1.)
01677         {
01678             returnValue = Pi;
01679         }
01680         else if((returnValue + Eps) > 1.)
01681         {
01682             returnValue = TypeTraits<RealReturnType>::getZeroElement();
01683         }
01684         else
01685         {
01686             returnValue = osgacos(returnValue);
01687         }
01688     }
01689 
01690     return returnValue;
01691 }

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

Definition at line 1696 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().

01698 {
01699     RealReturnType rDot       = dot(toVec);
01700     RealReturnType rSquareDot = toVec.dot(toVec);
01701 
01702     if(rSquareDot > Eps)
01703     {
01704         rDot /= rSquareDot;
01705 
01706         if(osgabs(rDot) > Eps)
01707         {
01708             *this  = toVec;
01709             *this *= ValueTypeT(rDot);
01710         }
01711         else
01712         {
01713             this->setNull();
01714             rDot = TypeTraits<RealReturnType>::getZeroElement();
01715         }
01716     }
01717     else
01718     {
01719         rDot = TypeTraits<RealReturnType>::getOneElement();
01720     }
01721 
01722     return rDot;
01723 }

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

Definition at line 1744 of file OSGVector.inl.

Referenced by osg::makeSphereGeo().

01745 {
01746     return *(static_cast<PntInterface *>(this));
01747 }

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

Definition at line 1732 of file OSGVector.inl.

01733 {
01734     return *(static_cast<const PntInterface *>(this));
01735 }

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

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

Definition at line 1752 of file OSGVector.inl.

01753 {
01754     return *this;
01755 }

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

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

Definition at line 1760 of file OSGVector.inl.

01761 {
01762     return (*this);
01763 }

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

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

Definition at line 1773 of file OSGVector.inl.

01775 {
01776     VectorInterface<ValueTypeT, StorageInterfaceT> returnValue;
01777 
01778     for(UInt32 i = 0; i < StorageInterfaceT::_iSize; i++)
01779     {
01780         returnValue[i] = Self::_values[i] - vec[i];
01781     }
01782 
01783     return returnValue;
01784 }

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

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

Definition at line 1791 of file OSGVector.inl.

01793 {
01794     VectorInterface<ValueTypeT, StorageInterfaceT> returnValue;
01795 
01796     for(UInt32 i = 0; i < StorageInterfaceT::_iSize; i++)
01797     {
01798         returnValue[i] = Self::_values[i] + vec[i];
01799     }
01800 
01801     return returnValue;
01802 }

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

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

Definition at line 1810 of file OSGVector.inl.

01812 {
01813     VectorInterface<ValueTypeT, StorageInterfaceT> returnValue;
01814 
01815     for(UInt32 i = 0; i < StorageInterfaceT::_iSize; i++)
01816     {
01817         returnValue[i] = Self::_values[i] * rVal;
01818     }
01819 
01820     return returnValue;
01821 }

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

Definition at line 1828 of file OSGVector.inl.

01829 {
01830     VectorInterface<ValueTypeT, StorageInterfaceT> returnValue;
01831 
01832     for(UInt32 i = 0; i < Self::_iSize; i++)
01833     {
01834         returnValue._values[i] = - Self::_values[i];
01835     }
01836 
01837     return returnValue;
01838 }

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

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

Definition at line 1846 of file OSGVector.inl.

01848 {
01849     if(this == &source)
01850         return *this;
01851 
01852     *(static_cast<Inherited *>(this)) = 
01853         static_cast<const Inherited &>(source);
01854 
01855     return *this;
01856 }

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

Definition at line 1863 of file OSGVector.inl.

01865 {
01866     bool ret = false;
01867 
01868     for(UInt32 i = 0; i < Self::_iSize; i++)
01869     {
01870         if(Self::_values[i] < other._values[i])
01871         {
01872             ret = true;
01873             break;
01874         }
01875 
01876         if(Self::_values[i] > other._values[i])
01877             break;
01878     }
01879 
01880     return ret;
01881 }

template<class ValueTypeT, class StorageInterfaceT>
bool osg::VectorInterface< ValueTypeT, StorageInterfaceT >::operator== const