OSG::Point< ValueTypeT, SizeI > Class Template Reference
[BaseObjectslibOSGBase]

#include <OSGVector.h>

Inheritance diagram for OSG::Point< ValueTypeT, SizeI >:
SelectVecStorage OSG::Vector< ValueTypeT, SizeI > OSG::Vector< ValueTypeT, 3 > OSG::Vector< ValueTypeT, 4 > OSG::Color3< ValueTypeT > OSG::Color4< ValueTypeT >

List of all members.

Public Types

typedef SelectVecStorage
< ValueTypeT, SizeI > 
Inherited
 Parent type, one of the VecStorage{1,2,3,4} types.
typedef Point< ValueTypeT, SizeI > Self
typedef SelectVecStorage
< ValueTypeT, SizeI > 
StorageInterface
typedef ValueTypeT ValueType
 Value type.
typedef TypeTraits< ValueTypeT >
::RealReturnType 
RealReturnType
 Used type if the returnvalue must be a real value.
typedef Point< ValueTypeT, SizeI > PointType
 Own type.
typedef Vector< ValueTypeT, SizeI > VectorType
 Type of the corresponding vector of the same size and value type.

Public Member Functions

Constructors



 Point (void)
 Point (const ValueType *pVals)
 Constructor which takes a const value array.
 Point (ValueType *pVals)
 Constructor which takes a value array.
template<class ValueType2T , UInt32 Size2I>
 Point (const Point< ValueType2T, Size2I > &pnt)
template<class ValueType2T , UInt32 Size2I>
 Point (const Vector< ValueType2T, Size2I > &vec)
 Point (const Point &source)
 Point (const ValueType rVal1)
 Point (const ValueType rVal1, const ValueType rVal2)
 Constructor which takes two values, remaining entries will be zero.
 Point (const ValueType rVal1, const ValueType rVal2, const ValueType rVal3)
 Constructor which takes three values, remaining entries will be zero.
 Point (const ValueType rVal1, const ValueType rVal2, const ValueType rVal3, const ValueType rVal4)
 Constructor which takes four values, remaining entries will be zero.
Destructor



 ~Point (void)
Set Values



void setNull (void)
template<class ValueType2T , UInt32 Size2I>
void setValue (const Point< ValueType2T, Size2I > &pnt)
void setValue (const Point &pnt)
void setValue (const ValueType *pVals)
void setValue (ValueType *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



ValueTypegetValues (void)
 Get a pointer to the value storage.
const ValueTypegetValues (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 Point &pnt, const ValueType tolerance) const
 Returns true iff the two points are eual within a given tolerance.
VectorTypesubZero (void)
 Returns the corrosponding vector by subtracting zero.
const VectorTypesubZero (void) const
 Returns the corrosponding vector by subtracting zero.
RealReturnType dist (const Point &pnt) const
 Returns the distance between the two points.
RealReturnType dist2 (const Point &pnt) const
 Returns the distance between the two points, squared.
RealReturnType maxValue (void) const
 Returns the maximum value of the vector.
Math



void operator*= (const ValueType val)
 Component wise scalar multiplication.
void operator/= (const ValueType val)
 Component wise scalar division.
VectorType operator- (const Point &pnt) const
 Point substraction, returns a new vector.
Point operator+ (const VectorType &vec) const
 Component wise binary vector addition operator.
Point operator- (const VectorType &vec) const
 Component wise binary vector addition operator.
Point operator* (const ValueType val) const
 Component wise binary scalar multiplication.
Point operator- (void)
 Nondestructive unary negation, returns new point.
void operator+= (const VectorType &vec)
 Component wise vector addition.
void operator-= (const VectorType &vec)
 Component wise vector substraction.
Element Access



ValueTypeoperator[] (const UInt32 uiVal)
const ValueTypeoperator[] (const UInt32 uiVal) const
Assignment



Pointoperator= (const Point &source)
Pointoperator= (const VectorType &source)
Comparison



bool operator< (const Point &other) const
bool operator== (const Point &other) const
 Equal operator, using Eps as the tolerance.
bool operator!= (const Point &other) const
 Not equal operator, using Eps as the tolerance.

Static Public Attributes

static const Point Null

Related Functions

(Note that these are not member functions.)



Point Types



typedef OSG::Point< OSG::UInt8, 1 > Pnt1ub
typedef OSG::Pnt1ubPnt1ubP
typedef OSG::Point< OSG::Int8, 1 > Pnt1b
typedef OSG::Pnt1bPnt1bP
typedef OSG::Point
< OSG::UInt16, 1 > 
Pnt1us
typedef OSG::Pnt1usPnt1usP
typedef OSG::Point< OSG::Int16, 1 > Pnt1s
typedef OSG::Pnt1sPnt1sP
typedef OSG::Point
< OSG::Real32, 1 > 
Pnt1f
typedef OSG::Pnt1fPnt1fP
typedef OSG::Point< Fixed32, 1 > Pnt1fx
typedef OSG::Pnt1fxPnt1fxP
typedef OSG::Point
< OSG::Real64, 1 > 
Pnt1d
typedef OSG::Pnt1dPnt1dP
typedef OSG::Point
< OSG::Real128, 1 > 
Pnt1ld
typedef OSG::Pnt1ldPnt1ldP
typedef OSG::Point< OSG::UInt8, 2 > Pnt2ub
typedef OSG::Pnt2ubPnt2ubP
typedef OSG::Point< OSG::Int8, 2 > Pnt2b
typedef OSG::Pnt2bPnt2bP
typedef OSG::Point
< OSG::UInt16, 2 > 
Pnt2us
typedef OSG::Pnt2usPnt2usP
typedef OSG::Point< OSG::Int16, 2 > Pnt2s
typedef OSG::Pnt2sPnt2sP
typedef OSG::Point< OSG::Int32, 2 > Pnt2i
typedef OSG::Pnt2iPnt2iP
typedef OSG::Point
< OSG::Real32, 2 > 
Pnt2f
typedef OSG::Pnt2fPnt2fP
typedef OSG::Point< Fixed32, 2 > Pnt2fx
typedef OSG::Pnt2fxPnt2fxP
typedef OSG::Point
< OSG::Real64, 2 > 
Pnt2d
typedef OSG::Pnt2dPnt2dP
typedef OSG::Point
< OSG::Real128, 2 > 
Pnt2ld
typedef OSG::Pnt2ldPnt2ldP
typedef OSG::Point< OSG::UInt8, 3 > Pnt3ub
typedef OSG::Pnt3ubPnt3ubP
typedef OSG::Point< OSG::Int8, 3 > Pnt3b
typedef OSG::Pnt3bPnt3bP
typedef OSG::Point
< OSG::UInt16, 3 > 
Pnt3us
typedef OSG::Pnt3usPnt3usP
typedef OSG::Point< OSG::Int16, 3 > Pnt3s
typedef OSG::Pnt3sPnt3sP
typedef OSG::Point
< OSG::Real32, 3 > 
Pnt3f
typedef OSG::Pnt3fPnt3fP
typedef OSG::Point< Fixed32, 3 > Pnt3fx
typedef OSG::Pnt3fxPnt3fxP
typedef OSG::Point
< OSG::Real64, 3 > 
Pnt3d
typedef OSG::Pnt3dPnt3dP
typedef OSG::Point
< OSG::Real128, 3 > 
Pnt3ld
typedef OSG::Pnt3ldPnt3ldP
typedef OSG::Point< OSG::UInt8, 4 > Pnt4ub
typedef OSG::Pnt4ubPnt4ubP
typedef OSG::Point< OSG::Int8, 4 > Pnt4b
typedef OSG::Pnt4bPnt4bP
typedef OSG::Point
< OSG::UInt16, 4 > 
Pnt4us
typedef OSG::Pnt4usPnt4usP
typedef OSG::Point< OSG::Int16, 4 > Pnt4s
typedef OSG::Pnt4sPnt4sP
typedef OSG::Point
< OSG::Real32, 4 > 
Pnt4f
typedef OSG::Pnt4fPnt4fP
typedef OSG::Point< Fixed32, 4 > Pnt4fx
typedef OSG::Pnt4fxPnt4fxP
typedef OSG::Point
< OSG::Real64, 4 > 
Pnt4d
typedef OSG::Pnt4dPnt4dP
typedef OSG::Point
< OSG::Real128, 4 > 
Pnt4ld
typedef OSG::Pnt4ldPnt4ldP
Vector/Point Profile Types



typedef OSG::Pnt2f Pnt2r
typedef OSG::Pnt3f Pnt3r
typedef OSG::Pnt4f Pnt4r

Detailed Description

template<class ValueTypeT, UInt32 SizeI>
class OSG::Point< ValueTypeT, SizeI >

Point Interface, for details about how vectors, points and matrices are actually build see .

Definition at line 376 of file OSGVector.h.


Member Typedef Documentation

template<class ValueTypeT, UInt32 SizeI>
typedef SelectVecStorage<ValueTypeT, SizeI > OSG::Point< ValueTypeT, SizeI >::StorageInterface

Definition at line 387 of file OSGVector.h.


Constructor & Destructor Documentation

template<class ValueTypeT , UInt32 SizeI>
OSG::Point< ValueTypeT, SizeI >::Point ( void   )  [inline]

Definition at line 367 of file OSGVector.inl.

00367                                     :
00368     Inherited()
00369 {
00370 }

template<class ValueTypeT , UInt32 SizeI>
OSG::Point< ValueTypeT, SizeI >::Point ( const ValueType pVals  )  [inline, explicit]
Warning:
Make sure the array size is at least as large as the vector size.

Definition at line 379 of file OSGVector.inl.

00379                                                        :
00380     Inherited()
00381 {
00382     if(pVals == NULL)
00383     {
00384         for(UInt32 i = 0; i < Self::_uiSize; i++)
00385         {
00386             Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00387         }
00388     }
00389     else
00390     {
00391         for(UInt32 i = 0; i < Self::_uiSize; i++)
00392         {
00393             Self::_values[i] = pVals[i];
00394         }
00395     }
00396 }

template<class ValueTypeT , UInt32 SizeI>
OSG::Point< ValueTypeT, SizeI >::Point ( ValueType pVals  )  [inline, explicit]

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

Definition at line 405 of file OSGVector.inl.

00405                                                  :
00406     Inherited()
00407 {
00408     if(pVals == NULL)
00409     {
00410         for(UInt32 i = 0; i < Self::_uiSize; i++)
00411         {
00412             Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00413         }
00414     }
00415     else
00416     {
00417         for(UInt32 i = 0; i < Self::_uiSize; i++)
00418         {
00419             Self::_values[i] = pVals[i];
00420         }
00421     }
00422 }

template<class ValueTypeT , UInt32 SizeI>
template<class ValueType2T , UInt32 Size2I>
OSG::Point< ValueTypeT, SizeI >::Point ( const Point< ValueType2T, Size2I > &  pnt  )  [inline, explicit]

Definition at line 428 of file OSGVector.inl.

References OSG::Point< ValueTypeT, SizeI >::getValues().

00429 {
00430     typedef Point<ValueType2T, Size2I> Point2T;
00431
00432     if(Self::_uiSize <= Point2T::_uiSize)
00433     {
00434         for(UInt32 i = 0; i < Self::_uiSize; i++)
00435         {
00436             Self::_values[i] = pnt.getValues()[i];
00437         }
00438     }
00439     else
00440     {
00441         UInt32 i;
00442         for(i = 0; i < Point2T::_uiSize; i++)
00443         {
00444             Self::_values[i] = pnt.getValues()[i];
00445         }
00446         for(i = Point2T::_uiSize; i < Self::_uiSize; i++)
00447         {
00448             Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00449         }
00450     }
00451 }

template<class ValueTypeT , UInt32 SizeI>
template<class ValueType2T , UInt32 Size2I>
OSG::Point< ValueTypeT, SizeI >::Point ( const Vector< ValueType2T, Size2I > &  vec  )  [inline, explicit]

Definition at line 457 of file OSGVector.inl.

References OSG::Point< ValueTypeT, SizeI >::getValues().

00458 {
00459     typedef Vector<ValueType2T, Size2I> Vector2T;
00460
00461     if(Self::_uiSize <= Vector2T::_uiSize)
00462     {
00463         for(UInt32 i = 0; i < Self::_uiSize; i++)
00464         {
00465             Self::_values[i] = vec.getValues()[i];
00466         }
00467     }
00468     else
00469     {
00470         UInt32 i;
00471         for(i = 0; i < Vector2T::_uiSize; i++)
00472         {
00473             Self::_values[i] = vec.getValues()[i];
00474         }
00475         for(i = Vector2T::_uiSize; i < Self::_uiSize; i++)
00476         {
00477             Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00478         }
00479     }
00480 }

template<class ValueTypeT, UInt32 SizeI>
OSG::Point< ValueTypeT, SizeI >::Point ( const Point< ValueTypeT, SizeI > &  source  ) 
template<class ValueTypeT , UInt32 SizeI>
OSG::Point< ValueTypeT, SizeI >::Point ( const ValueType  rVal1  )  [inline]

Definition at line 499 of file OSGVector.inl.

00500 {
00501     UInt32 i;
00502
00503     Self::_values[0] = rVal1;
00504
00505     for(i = 1; i < Self::_uiSize; i++)
00506     {
00507         Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00508     }
00509 }

template<class ValueTypeT , UInt32 SizeI>
OSG::Point< ValueTypeT, SizeI >::Point ( const ValueType  rVal1,
const ValueType  rVal2 
) [inline]

Definition at line 521 of file OSGVector.inl.

00522                                                        :
00523     Inherited()
00524 {
00525     Self::_values[0] = rVal1;
00526
00527     if(Self::_uiSize == 2)
00528     {
00529         Self::_values[1] = rVal2;
00530     }
00531     else if(Self::_uiSize >= 3)
00532     {
00533         Self::_values[1] = rVal2;
00534
00535         for(UInt32 i = 2; i < Self::_uiSize; i++)
00536         {
00537             Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00538         }
00539     }
00540 }

template<class ValueTypeT , UInt32 SizeI>
OSG::Point< ValueTypeT, SizeI >::Point ( const ValueType  rVal1,
const ValueType  rVal2,
const ValueType  rVal3 
) [inline]

Definition at line 552 of file OSGVector.inl.

00554                                                         :
00555     Inherited()
00556 {
00557     Self::_values[0] = rVal1;
00558
00559     if(Self::_uiSize == 2)
00560     {
00561         Self::_values[1] = rVal2;
00562     }
00563     else if(Self::_uiSize == 3)
00564     {
00565         Self::_values[1] = rVal2;
00566         Self::_values[2] = rVal3;
00567     }
00568     else if(Self::_uiSize >= 4)
00569     {
00570         Self::_values[1] = rVal2;
00571         Self::_values[2] = rVal3;
00572
00573         for(UInt32 i = 3; i < Self::_uiSize; i++)
00574         {
00575             Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00576         }
00577     }
00578 }

template<class ValueTypeT , UInt32 SizeI>
OSG::Point< ValueTypeT, SizeI >::Point ( const ValueType  rVal1,
const ValueType  rVal2,
const ValueType  rVal3,
const ValueType  rVal4 
) [inline]

Definition at line 590 of file OSGVector.inl.

00593                                                          :
00594     Inherited()
00595 {
00596     Self::_values[0] = rVal1;
00597
00598     if(Self::_uiSize == 2)
00599     {
00600         Self::_values[1] = rVal2;
00601     }
00602     else if(Self::_uiSize == 3)
00603     {
00604         Self::_values[1] = rVal2;
00605         Self::_values[2] = rVal3;
00606     }
00607     else if(Self::_uiSize == 4)
00608     {
00609         Self::_values[1] = rVal2;
00610         Self::_values[2] = rVal3;
00611         Self::_values[3] = rVal4;
00612     }
00613     else if(Self::_uiSize >= 5)
00614     {
00615         Self::_values[1] = rVal2;
00616         Self::_values[2] = rVal3;
00617         Self::_values[3] = rVal4;
00618
00619         for(UInt32 i = 4; i < Self::_uiSize; i++)
00620         {
00621             Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00622         }
00623     }
00624 }

template<class ValueTypeT , UInt32 SizeI>
OSG::Point< ValueTypeT, SizeI >::~Point ( void   )  [inline]

Definition at line 635 of file OSGVector.inl.

00636 {
00637 }


Member Function Documentation

template<class ValueTypeT , UInt32 SizeI>
void OSG::Point< ValueTypeT, SizeI >::setNull ( void   )  [inline]

Definition at line 644 of file OSGVector.inl.

Referenced by OSG::Vector< ValueTypeT, SizeI >::projectTo(), and OSG::TransformationMatrix< ValueTypeT >::setIdentity().

00645 {
00646     for(UInt32 i = 0; i < Self::_uiSize; i++)
00647     {
00648         Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00649     }
00650 }

template<class ValueTypeT , UInt32 SizeI>
template<class ValueType2T , UInt32 Size2I>
void OSG::Point< ValueTypeT, SizeI >::setValue ( const Point< ValueType2T, Size2I > &  pnt  )  [inline]
template<class ValueTypeT, UInt32 SizeI>
void OSG::Point< ValueTypeT, SizeI >::setValue ( const Point< ValueTypeT, SizeI > &  pnt  ) 
template<class ValueTypeT , UInt32 SizeI>
void OSG::Point< ValueTypeT, SizeI >::setValue ( const ValueType pVals  )  [inline]

Definition at line 681 of file OSGVector.inl.

00682 {
00683     for(UInt32 i = 0; i < Self::_uiSize; i++)
00684     {
00685         Self::_values[i] = pVals[i];
00686     }
00687 }

template<class ValueTypeT , UInt32 SizeI>
void OSG::Point< ValueTypeT, SizeI >::setValue ( ValueType pVals  )  [inline]

Definition at line 693 of file OSGVector.inl.

References OSG::Point< ValueTypeT, SizeI >::setValue().

00694 {
00695     setValue(static_cast<const ValueType *>(pVals));
00696 }

template<class ValueTypeT , UInt32 SizeI>
void OSG::Point< ValueTypeT, SizeI >::setValueFromCString ( const Char8 *  szString  )  [inline]

Definition at line 704 of file OSGVector.inl.

Referenced by OSG::Color3< ValueTypeT >::setValue(), OSG::Point< ValueTypeT, SizeI >::setValue(), OSG::Color4< ValueTypeT >::setValue(), and OSG::Point< ValueTypeT, SizeI >::setValueFromCString().

00705 {
00706     UInt32 i;
00707     UInt32 numOfToken = Self::_uiSize;
00708
00709     Char8 *c      = const_cast<Char8 *>(szString);
00710     Char8 *tokenC = 0;
00711
00712     Char8  token[256];
00713
00714     if(szString == NULL || (*szString) == '\0')
00715     {
00716         for(i = 0; i < Self::_uiSize; i++)
00717             Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement();
00718
00719         return;
00720     }
00721
00722     for (i = 0; i < numOfToken; c++)
00723     {
00724         switch (*c)
00725         {
00726             case '\0':
00727                 if(tokenC)
00728                 {
00729                     *tokenC = 0;
00730                     Self::_values[i++] =
00731                         TypeTraits<ValueTypeT>::getFromCString(token);
00732                 }
00733
00734                 while (i < numOfToken)
00735                 {
00736                     Self::_values[i++] =
00737                         TypeTraits<ValueTypeT>::getZeroElement();
00738                 }
00739                 break;
00740
00741             case ' ' :
00742             case '\t':
00743             case '\n':
00744             case ',':
00745                 if(tokenC)
00746                 {
00747                     *tokenC = 0;
00748                     Self::_values[i++] =
00749                         TypeTraits<ValueTypeT>::getFromCString(token);
00750                     tokenC = 0;
00751                 }
00752                 break;
00753             default:
00754                 if(!tokenC)
00755                 {
00756                     tokenC = token;
00757                 }
00758                 *tokenC++ = *c;
00759                 break;
00760         }
00761     }
00762 }

template<class ValueTypeT , UInt32 SizeI>
void OSG::Point< ValueTypeT, SizeI >::setValueFromCString ( Char8 *  szString  )  [inline]

Definition at line 770 of file OSGVector.inl.

References OSG::Point< ValueTypeT, SizeI >::setValueFromCString().

00771 {
00772     setValueFromCString(static_cast<const Char8 *>(szString));
00773 }

template<class ValueTypeT , UInt32 SizeI>
void OSG::Point< ValueTypeT, SizeI >::setValue ( const Char8 *  szString  )  [inline]
template<class ValueTypeT , UInt32 SizeI>
void OSG::Point< ValueTypeT, SizeI >::setValue ( Char8 *  szString  )  [inline]

Definition at line 785 of file OSGVector.inl.

References OSG::Point< ValueTypeT, SizeI >::setValueFromCString().

00786 {
00787     setValueFromCString(szString);
00788 }

template<class ValueTypeT , UInt32 SizeI>
const ValueTypeT * OSG::Point< ValueTypeT, SizeI >::getValues ( void   )  const [inline]

Definition at line 807 of file OSGVector.inl.

00808 {
00809     return Self::_values;
00810 }

template<class ValueTypeT , UInt32 SizeI>
bool OSG::Point< ValueTypeT, SizeI >::isZero ( void   )  const [inline]

Definition at line 819 of file OSGVector.inl.

References OSG::Eps.

Referenced by OSG::Vector< ValueTypeT, SizeI >::enclosedAngle(), OSG::Line::getClosestPoints(), OSG::BoxVolume::setBoundsByCenterAndSize(), and OSG::ProjectionCameraDecorator::updateData().

00820 {
00821     bool returnValue = true;
00822
00823     for(UInt32 i = 0; i < Self::_uiSize; i++)
00824     {
00825         returnValue &= ((Self::_values[i] <=  Eps) &&
00826                         (Self::_values[i] >= -Eps));
00827     }
00828
00829     return returnValue;
00830 }

template<class ValueTypeT , UInt32 SizeI>
void OSG::Point< ValueTypeT, SizeI >::negate ( void   )  [inline]

Definition at line 836 of file OSGVector.inl.

Referenced by OSG::ShadowStage::updateLights().

00837 {
00838     for(UInt32 i = 0; i < Self::_uiSize; i++)
00839     {
00840         Self::_values[i] = -Self::_values[i];
00841     }
00842 }

template<class ValueTypeT , UInt32 SizeI>
bool OSG::Point< ValueTypeT, SizeI >::equals ( const Point< ValueTypeT, SizeI > &  pnt,
const ValueType  tolerance 
) const [inline]

Definition at line 848 of file OSGVector.inl.

Referenced by OSG::TransformationMatrix< ValueTypeT >::equals(), OSG::LightChunk::operator==(), OSG::Vector< ValueTypeT, SizeI >::operator==(), OSG::Point< ValueTypeT, SizeI >::operator==(), OSG::MaterialChunk::operator==(), and OSG::DSLightChunk::operator==().

00851 {
00852     bool returnValue = true;
00853
00854     for(UInt32 i = 0; i < Self::_uiSize; i++)
00855     {
00856         returnValue &=
00857             ( (Self::_values[i] - pnt  ._values[i] <= tolerance) &&
00858               (pnt  ._values[i] - Self::_values[i] <= tolerance));
00859     }
00860
00861     return returnValue;
00862 }

template<class ValueTypeT , UInt32 SizeI>
const Point< ValueTypeT, SizeI >::VectorType & OSG::Point< ValueTypeT, SizeI >::subZero ( void   )  const [inline]
template<class ValueTypeT , UInt32 SizeI>
Point< ValueTypeT, SizeI >::RealReturnType OSG::Point< ValueTypeT, SizeI >::dist ( const Point< ValueTypeT, SizeI > &  pnt  )  const [inline]
template<class ValueTypeT , UInt32 SizeI>
Point< ValueTypeT, SizeI >::RealReturnType OSG::Point< ValueTypeT, SizeI >::dist2 ( const Point< ValueTypeT, SizeI > &  pnt  )  const [inline]

Definition at line 900 of file OSGVector.inl.

Referenced by OSG::Particles::calcIndex(), OSG::Point< ValueTypeT, SizeI >::dist(), OSG::BezierCurve2D::homogeniousDistanceSquared(), and OSG::Geometry::intersect().

00902 {
00903     RealReturnType returnValue = 0;
00904     RealReturnType tmp;
00905
00906     for(UInt32 i = 0; i < Self::_uiSize; i++)
00907     {
00908         tmp = Self::_values[i] - pnt._values[i];
00909
00910         returnValue += tmp * tmp;
00911     }
00912
00913     return returnValue;
00914 }

template<class ValueTypeT , UInt32 SizeI>
Point< ValueTypeT, SizeI >::RealReturnType OSG::Point< ValueTypeT, SizeI >::maxValue ( void   )  const [inline]

Definition at line 921 of file OSGVector.inl.

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

00922 {
00923     RealReturnType returnValue = TypeTraits<RealReturnType>::getMin();
00924
00925     for(UInt32 i = 0; i < Self::_uiSize; i++)
00926     {
00927         if(Self::_values[i] > returnValue)
00928             returnValue = Self::_values[i];
00929     }
00930
00931     return returnValue;
00932 }

template<class ValueTypeT , UInt32 SizeI>
void OSG::Point< ValueTypeT, SizeI >::operator*= ( const ValueType  val  )  [inline]

Definition at line 941 of file OSGVector.inl.

00942 {
00943     for(UInt32 i = 0; i < Self::_uiSize; i++)
00944     {
00945         Self::_values[i] *= val;
00946     }
00947 }

template<class ValueTypeT , UInt32 SizeI>
void OSG::Point< ValueTypeT, SizeI >::operator/= ( const ValueType  val  )  [inline]

Definition at line 953 of file OSGVector.inl.

00954 {
00955     for(UInt32 i = 0; i < Self::_uiSize; i++)
00956     {
00957         Self::_values[i] /= val;
00958     }
00959 }

template<class ValueTypeT , UInt32 SizeI>
Point< ValueTypeT, SizeI >::VectorType OSG::Point< ValueTypeT, SizeI >::operator- ( const Point< ValueTypeT, SizeI > &  pnt  )  const [inline]

Reimplemented in OSG::Vector< ValueTypeT, SizeI >.

Definition at line 967 of file OSGVector.inl.

00968 {
00969     VectorType returnValue(*this);
00970
00971     for(UInt32 i = 0; i < Self::_uiSize; i++)
00972     {
00973         returnValue[i] -= pnt[i];
00974     }
00975
00976     return returnValue;
00977 }

template<class ValueTypeT , UInt32 SizeI>
Point< ValueTypeT, SizeI > OSG::Point< ValueTypeT, SizeI >::operator+ ( const VectorType vec  )  const [inline]

Definition at line 984 of file OSGVector.inl.

00985 {
00986     Point<ValueTypeT, SizeI> returnValue;
00987
00988     for(UInt32 i = 0; i < Self::_uiSize; i++)
00989     {
00990         returnValue[i] = Self::_values[i] + vec[i];
00991     }
00992
00993     return returnValue;
00994 }

template<class ValueTypeT , UInt32 SizeI>
Point< ValueTypeT, SizeI > OSG::Point< ValueTypeT, SizeI >::operator- ( const VectorType vec  )  const [inline]

Definition at line 1001 of file OSGVector.inl.

01002 {
01003     Point<ValueTypeT, SizeI> returnValue;
01004
01005     for(UInt32 i = 0; i < Self::_uiSize; i++)
01006     {
01007         returnValue[i] = Self::_values[i] - vec[i];
01008     }
01009
01010     return returnValue;
01011 }

template<class ValueTypeT , UInt32 SizeI>
Point< ValueTypeT, SizeI > OSG::Point< ValueTypeT, SizeI >::operator* ( const ValueType  val  )  const [inline]

Reimplemented in OSG::Vector< ValueTypeT, SizeI >, OSG::Vector< OSG::Real64, 2 >, OSG::Vector< ValueTypeT, 3 >, OSG::Vector< OSG::Real64, 3 >, OSG::Vector< ValueTypeT, 4 >, OSG::Vector< OSG::Real32, 2 >, OSG::Vector< OSG::Int32, 2 >, OSG::Vector< OSG::Real32, 3 >, OSG::Vector< OSG::Real32, 4 >, and OSG::Vector< OSG::UInt32, 2 >.

Definition at line 1018 of file OSGVector.inl.

01019 {
01020     Point<ValueTypeT, SizeI> returnValue;
01021
01022     for(UInt32 i = 0; i < Self::_uiSize; i++)
01023     {
01024         returnValue[i] = Self::_values[i] * rVal;
01025     }
01026
01027     return returnValue;
01028 }

template<class ValueTypeT , UInt32 SizeI>
Point< ValueTypeT, SizeI > OSG::Point< ValueTypeT, SizeI >::operator- ( void   )  [inline]

Definition at line 1035 of file OSGVector.inl.

01036 {
01037     Point<ValueTypeT, SizeI> returnValue;
01038
01039     for(UInt32 i = 0; i < Self::_uiSize; i++)
01040     {
01041         returnValue._values[i] = - Self::_values[i];
01042     }
01043
01044     return returnValue;
01045 }

template<class ValueTypeT , UInt32 SizeI>
void OSG::Point< ValueTypeT, SizeI >::operator+= ( const VectorType vec  )  [inline]

Definition at line 1051 of file OSGVector.inl.

01052 {
01053     for(UInt32 i = 0; i < Self::_uiSize; i++)
01054     {
01055         Self::_values[i] += vec._values[i];
01056     }
01057 }

template<class ValueTypeT , UInt32 SizeI>
void OSG::Point< ValueTypeT, SizeI >::operator-= ( const VectorType vec  )  [inline]

Definition at line 1063 of file OSGVector.inl.

01064 {
01065     for(UInt32 i = 0; i < Self::_uiSize; i++)
01066     {
01067         Self::_values[i] -= vec._values[i];
01068     }
01069 }

template<class ValueTypeT , UInt32 SizeI>
ValueTypeT & OSG::Point< ValueTypeT, SizeI >::operator[] ( const UInt32  uiVal  )  [inline]

Definition at line 1076 of file OSGVector.inl.

01077 {
01078     return Self::_values[uiVal];
01079 }

template<class ValueTypeT , UInt32 SizeI>
const ValueTypeT & OSG::Point< ValueTypeT, SizeI >::operator[] ( const UInt32  uiVal  )  const [inline]

Definition at line 1084 of file OSGVector.inl.

01085 {
01086     return Self::_values[uiVal];
01087 }

template<class ValueTypeT , UInt32 SizeI>
Point< ValueTypeT, SizeI > & OSG::Point< ValueTypeT, SizeI >::operator= ( const Point< ValueTypeT, SizeI > &  source  )  [inline]

Reimplemented in OSG::Vector< ValueTypeT, SizeI >.

Definition at line 1095 of file OSGVector.inl.

01096 {
01097     if(this == &source)
01098         return *this;
01099
01100     for(UInt32 i = 0; i < Self::_uiSize; i++)
01101     {
01102         Self::_values[i] = source._values[i];
01103     }
01104
01105     return *this;
01106 }

template<class ValueTypeT , UInt32 SizeI>
Point< ValueTypeT, SizeI > & OSG::Point< ValueTypeT, SizeI >::operator= ( const VectorType source  )  [inline]

Definition at line 1111 of file OSGVector.inl.

01112 {
01113     Point<ValueTypeT, SizeI>::error_cannot_assign_vector;
01114
01115     return *this;
01116 }

template<class ValueTypeT , UInt32 SizeI>
bool OSG::Point< ValueTypeT, SizeI >::operator< ( const Point< ValueTypeT, SizeI > &  other  )  const [inline]

Reimplemented in OSG::Vector< ValueTypeT, SizeI >.

Definition at line 1123 of file OSGVector.inl.

01124 {
01125     bool ret = false;
01126
01127     for(UInt32 i = 0; i < Self::_uiSize; i++)
01128     {
01129         if(Self::_values[i] > other._values[i])
01130         {
01131             break;
01132         }
01133
01134         if(Self::_values[i] < other._values[i])
01135         {
01136             ret = true;
01137             break;
01138         }
01139     }
01140
01141     return ret;
01142 }

template<class ValueTypeT , UInt32 SizeI>
bool OSG::Point< ValueTypeT, SizeI >::operator== ( const Point< ValueTypeT, SizeI > &  other  )  const [inline]

Reimplemented in OSG::Vector< ValueTypeT, SizeI >.

Definition at line 1148 of file OSGVector.inl.

References OSG::Eps, and OSG::Point< ValueTypeT, SizeI >::equals().

01149 {
01150     return Self::equals(other, ValueTypeT(Eps));
01151 }

template<class ValueTypeT , UInt32 SizeI>
bool OSG::Point< ValueTypeT, SizeI >::operator!= ( const Point< ValueTypeT, SizeI > &  other  )  const [inline]

Reimplemented in OSG::Vector< ValueTypeT, SizeI >.

Definition at line 1157 of file OSGVector.inl.

01158 {
01159     return ! (*this == other);
01160 }


Member Data Documentation


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