#include <OSGVector.h>
Inheritance diagram for osg::PointInterface< ValueTypeT, StorageInterfaceT >:

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. | |
| VecInterface & | subZero (void) |
| Returns the corrosponding vector by subtracting zero. | |
| const VecInterface & | subZero (void) const |
| Returns the corrosponding vector by subtracting zero. | |
| RealReturnType | dist (const PointInterface &vec) const |
| Returns the distance between the two points. | |
| RealReturnType | dist2 (const PointInterface &vec) const |
| Returns the distance between the two points, squared. | |
| RealReturnType | maxValue (void) const |
| Returns the maximum value of the vector. | |
Math | |
| void | operator *= (const ValueTypeT val) |
| Component wise scalar multiplication. | |
| void | operator/= (const ValueTypeT val) |
| Component wise scalar division. | |
| VecInterface | operator- (const PointInterface &vec) const |
| Point substraction, returns a new vector. | |
| PointInterface | operator+ (const VecInterface &vec) const |
| Component wise binary vector addition operator. | |
| PointInterface | operator- (const VecInterface &vec) const |
| Component wise binary vector addition operator. | |
| PointInterface | operator * (const ValueTypeT rVal) const |
| Component wise binary scalar multiplication. | |
| 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. | |
Public Types | |
| typedef 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 VectorInterface< ValueTypeT, StorageInterfaceT > | VecInterface |
| typedef PointInterface< ValueTypeT, StorageInterfaceT > | Self |
| Own type. | |
Public Member Functions | |
Constructors | |
| PointInterface (void) | |
| PointInterface (const ValueTypeT *pVals) | |
| Constructor which takes a const value array. | |
| PointInterface (ValueTypeT *pVals) | |
| Constructor which takes a value array. | |
| template<class EVT, class EST> | |
| PointInterface (const PointInterface< EVT, EST > &vec) | |
| PointInterface (const PointInterface &source) | |
| PointInterface (const ValueTypeT rVal1, const ValueTypeT rVal2) | |
| Constructor which takes two values, remaining entries will be zero. | |
| PointInterface (const ValueTypeT rVal1, const ValueTypeT rVal2, const ValueTypeT rVal3) | |
| Constructor which takes three values, remaining entries will be zero. | |
| PointInterface (const ValueTypeT rVal1, const ValueTypeT rVal2, const ValueTypeT rVal3, const ValueTypeT rVal4) | |
| Constructor which takes four values, remaining entries will be zero. | |
Destructor | |
| ~PointInterface (void) | |
Assignment | |
| PointInterface & | operator= (const PointInterface &source) |
| PointInterface & | operator= (const VecInterface &source) |
Static Public Attributes | |
| static const PointInterface | Null |
Definition at line 341 of file OSGVector.h.
|
|||||
|
Parent type.
Reimplemented in osg::VectorInterface< ValueTypeT, StorageInterfaceT >, osg::VectorInterface< ValueTypeT, VecStorage3< ValueTypeT > >, and osg::VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > >. Definition at line 347 of file OSGVector.h. |
|
|||||
|
Used type if the returnvalue must be a real value.
Reimplemented in osg::VectorInterface< ValueTypeT, StorageInterfaceT >, osg::VectorInterface< ValueTypeT, VecStorage3< ValueTypeT > >, and osg::VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > >. Definition at line 349 of file OSGVector.h. |
|
|||||
|
Own type.
Reimplemented in osg::VectorInterface< ValueTypeT, StorageInterfaceT >, osg::VectorInterface< ValueTypeT, VecStorage3< ValueTypeT > >, and osg::VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > >. Definition at line 358 of file OSGVector.h. |
|
|||||
|
Value type.
Reimplemented in osg::Color3< ValueTypeT >, osg::Color4< ValueTypeT >, osg::VectorInterface< ValueTypeT, StorageInterfaceT >, osg::VectorInterface< ValueTypeT, VecStorage3< ValueTypeT > >, and osg::VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > >. Definition at line 351 of file OSGVector.h. |
|
|||||
|
Definition at line 354 of file OSGVector.h. |
|
||||||||||
|
Definition at line 363 of file OSGVector.inl. 00363 : 00364 Inherited() 00365 { 00366 }
|
|
||||||||||
|
Constructor which takes a const value array.
Definition at line 376 of file OSGVector.inl. 00376 : 00377 Inherited() 00378 { 00379 if(pVals == NULL) 00380 { 00381 for(UInt32 i = 0; i < Self::_uiSize; i++) 00382 { 00383 Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement(); 00384 } 00385 } 00386 else 00387 { 00388 for(UInt32 i = 0; i < Self::_uiSize; i++) 00389 { 00390 Self::_values[i] = pVals[i]; 00391 } 00392 } 00393 }
|
|
||||||||||
|
Constructor which takes a value array. Be shure the array size at least as large as the vector size. Definition at line 403 of file OSGVector.inl. 00403 : 00404 Inherited() 00405 { 00406 if(pVals == NULL) 00407 { 00408 for(UInt32 i = 0; i < Self::_uiSize; i++) 00409 { 00410 Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement(); 00411 } 00412 } 00413 else 00414 { 00415 for(UInt32 i = 0; i < Self::_uiSize; i++) 00416 { 00417 Self::_values[i] = pVals[i]; 00418 } 00419 } 00420 }
|
|
||||||||||||||
|
Definition at line 377 of file OSGVector.h. 00378 { 00379 if(Self::_uiSize <= PointInterface<EVT,EST>::_uiSize) 00380 { 00381 for(UInt32 i = 0; i < Self::_uiSize; i++) 00382 { 00383 Self::_values[i] = vec.getValues()[i]; 00384 } 00385 } 00386 else 00387 { 00388 UInt32 i; 00389 for(i = 0; i < PointInterface<EVT,EST>::_uiSize; i++) 00390 { 00391 Self::_values[i] = vec.getValues()[i]; 00392 } 00393 for(i = PointInterface<EVT,EST>::_uiSize; i < Self::_uiSize; i++) 00394 { 00395 Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement(); 00396 } 00397 } 00398 }
|
|
||||||||||
|
Definition at line 486 of file OSGVector.inl. 00487 : 00488 00489 Inherited() 00490 { 00491 for(UInt32 i = 0; i < Self::_uiSize; i++) 00492 { 00493 Self::_values[i] = source._values[i]; 00494 } 00495 }
|
|
||||||||||||||||
|
Constructor which takes two values, remaining entries will be zero.
Definition at line 525 of file OSGVector.inl. 00526 : 00527 Inherited() 00528 { 00529 Self::_values[0] = rVal1; 00530 00531 if(Self::_uiSize == 2) 00532 { 00533 Self::_values[1] = rVal2; 00534 } 00535 else if(Self::_uiSize >= 3) 00536 { 00537 Self::_values[1] = rVal2; 00538 00539 for(UInt32 i = 2; i < Self::_uiSize; i++) 00540 { 00541 Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement(); 00542 } 00543 } 00544 }
|
|
||||||||||||||||||||
|
Constructor which takes three values, remaining entries will be zero.
Definition at line 557 of file OSGVector.inl. 00559 : 00560 Inherited() 00561 { 00562 Self::_values[0] = rVal1; 00563 00564 if(Self::_uiSize == 2) 00565 { 00566 Self::_values[1] = rVal2; 00567 } 00568 else if(Self::_uiSize == 3) 00569 { 00570 Self::_values[1] = rVal2; 00571 Self::_values[2] = rVal3; 00572 } 00573 else if(Self::_uiSize >= 4) 00574 { 00575 Self::_values[1] = rVal2; 00576 Self::_values[2] = rVal3; 00577 00578 for(UInt32 i = 3; i < Self::_uiSize; i++) 00579 { 00580 Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement(); 00581 } 00582 } 00583 }
|
|
||||||||||||||||||||||||
|
Constructor which takes four values, remaining entries will be zero.
Definition at line 596 of file OSGVector.inl. 00599 : 00600 Inherited() 00601 { 00602 Self::_values[0] = rVal1; 00603 00604 if(Self::_uiSize == 2) 00605 { 00606 Self::_values[1] = rVal2; 00607 } 00608 else if(Self::_uiSize == 3) 00609 { 00610 Self::_values[1] = rVal2; 00611 Self::_values[2] = rVal3; 00612 } 00613 else if(Self::_uiSize == 4) 00614 { 00615 Self::_values[1] = rVal2; 00616 Self::_values[2] = rVal3; 00617 Self::_values[3] = rVal4; 00618 } 00619 else if(Self::_uiSize >= 5) 00620 { 00621 Self::_values[1] = rVal2; 00622 Self::_values[2] = rVal3; 00623 Self::_values[3] = rVal4; 00624 00625 for(UInt32 i = 4; i < Self::_uiSize; i++) 00626 { 00627 Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement(); 00628 } 00629 } 00630 }
|
|
||||||||||
|
Definition at line 641 of file OSGVector.inl.
|
|
||||||||||
|
Returns the distance between the two points.
Definition at line 957 of file OSGVector.inl. References osg::PointInterface< ValueTypeT, StorageInterfaceT >::dist2(), and osg::osgSqrt().
|
|
||||||||||
|
Returns the distance between the two points, squared.
Definition at line 969 of file OSGVector.inl. Referenced by osg::PointInterface< ValueTypeT, StorageInterfaceT >::dist(). 00971 { 00972 RealReturnType returnValue = 0; 00973 RealReturnType tmp; 00974 00975 for(UInt32 i = 0; i < Self::_uiSize; i++) 00976 { 00977 tmp = Self::_values[i] - vec._values[i]; 00978 00979 returnValue += tmp * tmp; 00980 } 00981 00982 return returnValue; 00983 }
|
|
||||||||||||||||
|
Returns true iff the two points are eual within a given tolerance.
Definition at line 910 of file OSGVector.inl. Referenced by osg::VectorInterface< ValueTypeT, StorageInterfaceT >::operator==(), and osg::PointInterface< ValueTypeT, StorageInterfaceT >::operator==(). 00913 { 00914 bool returnValue = true; 00915 00916 for(UInt32 i = 0; i < Self::_uiSize; i++) 00917 { 00918 returnValue &= 00919 ( (Self::_values[i] - vec ._values[i] <= tolerance) && 00920 (vec ._values[i] - Self::_values[i] <= tolerance)); 00921 } 00922 00923 return returnValue; 00924 }
|
|
||||||||||
|
Get a const pointer to the value storage.
Definition at line 868 of file OSGVector.inl.
|
|
||||||||||
|
Get a pointer to the value storage.
Definition at line 858 of file OSGVector.inl. Referenced by osg::TransformationMatrix< ValueTypeT >::getValues(), osg::PointInterface< ValueTypeT, VecStorage4< ValueTypeT > >::PointInterface(), osg::PointInterface< ValueTypeT, VecStorage4< ValueTypeT > >::setValue(), and osg::VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > >::VectorInterface().
|
|
||||||||||
|
Returns true iff the norm of each value is less than Eps.
Definition at line 881 of file OSGVector.inl. Referenced by osg::VectorInterface< ValueTypeT, StorageInterfaceT >::enclosedAngle(), osg::Line::getClosestPoints(), and osg::BoxVolume::setBoundsByCenterAndSize(). 00882 { 00883 bool returnValue = true; 00884 00885 for(UInt32 i = 0; i < Self::_uiSize; i++) 00886 { 00887 returnValue &= ((Self::_values[i] <= Eps) && 00888 (Self::_values[i] >= -Eps)); 00889 } 00890 00891 return returnValue; 00892 }
|
|
||||||||||
|
Returns the maximum value of the vector.
Definition at line 991 of file OSGVector.inl. 00993 { 00994 RealReturnType returnValue = TypeTraits<RealReturnType>::getMin(); 00995 00996 for(UInt32 i = 0; i < Self::_uiSize; i++) 00997 { 00998 if(Self::_values[i] > returnValue) 00999 returnValue = Self::_values[i]; 01000 } 01001 01002 return returnValue; 01003 }
|
|
||||||||||
|
Negates each value of the point in place.
Definition at line 898 of file OSGVector.inl. 00899 { 00900 for(UInt32 i = 0; i < Self::_uiSize; i++) 00901 { 00902 Self::_values[i] = -Self::_values[i]; 00903 } 00904 }
|
|
||||||||||
|
Component wise binary scalar multiplication.
Reimplemented in osg::VectorInterface< ValueTypeT, StorageInterfaceT >, osg::VectorInterface< ValueTypeT, VecStorage3< ValueTypeT > >, and osg::VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > >. Definition at line 1094 of file OSGVector.inl. 01096 { 01097 PointInterface<ValueTypeT, StorageInterfaceT> returnValue; 01098 01099 for(UInt32 i = 0; i < StorageInterfaceT::_uiSize; i++) 01100 { 01101 returnValue[i] = Self::_values[i] * rVal; 01102 } 01103 01104 return returnValue; 01105 }
|
|
||||||||||
|
Component wise scalar multiplication.
Definition at line 1013 of file OSGVector.inl. 01014 { 01015 for(UInt32 i = 0; i < Self::_uiSize; i++) 01016 { 01017 Self::_values[i] *= val; 01018 } 01019 }
|
|
||||||||||
|
Not equal operator, using Eps as the tolerance.
Definition at line 1261 of file OSGVector.inl.
|
|
||||||||||
|
Component wise binary vector addition operator.
Definition at line 1058 of file OSGVector.inl. 01060 { 01061 PointInterface<ValueTypeT, StorageInterfaceT> returnValue; 01062 01063 for(UInt32 i = 0; i < StorageInterfaceT::_uiSize; i++) 01064 { 01065 returnValue[i] = Self::_values[i] + vec[i]; 01066 } 01067 01068 return returnValue; 01069 }
|
|
||||||||||
|
Component wise vector addition.
Definition at line 1128 of file OSGVector.inl. 01130 { 01131 for(UInt32 i = 0; i < Self::_uiSize; i++) 01132 { 01133 Self::_values[i] += vec._values[i]; 01134 } 01135 }
|
|
||||||||||
|
Nondestructive unary negation, returns new point.
Definition at line 1112 of file OSGVector.inl. 01113 { 01114 PointInterface<ValueTypeT, StorageInterfaceT> returnValue; 01115 01116 for(UInt32 i = 0; i < Self::_uiSize; i++) 01117 { 01118 returnValue._values[i] = - Self::_values[i]; 01119 } 01120 01121 return returnValue; 01122 }
|
|
||||||||||
|
Component wise binary vector addition operator.
Definition at line 1076 of file OSGVector.inl. 01078 { 01079 PointInterface<ValueTypeT, StorageInterfaceT> returnValue; 01080 01081 for(UInt32 i = 0; i < StorageInterfaceT::_uiSize; i++) 01082 { 01083 returnValue[i] = Self::_values[i] - vec[i]; 01084 } 01085 01086 return returnValue; 01087 }
|
|
||||||||||
|
Point substraction, returns a new vector.
Definition at line 1040 of file OSGVector.inl. 01042 { 01043 VecInterface returnValue(*this); 01044 01045 for(UInt32 i = 0; i < Self::_uiSize; i++) 01046 { 01047 returnValue[i] -= vec[i]; 01048 } 01049 01050 return returnValue; 01051 }
|
|
||||||||||
|
Component wise vector substraction.
Definition at line 1141 of file OSGVector.inl. 01143 { 01144 for(UInt32 i = 0; i < Self::_uiSize; i++) 01145 { 01146 Self::_values[i] -= vec._values[i]; 01147 } 01148 }
|
|
||||||||||
|
Component wise scalar division.
Definition at line 1026 of file OSGVector.inl. 01027 { 01028 for(UInt32 i = 0; i < Self::_uiSize; i++) 01029 { 01030 Self::_values[i] /= val; 01031 } 01032 }
|
|
||||||||||
|
Definition at line 1225 of file OSGVector.inl. 01227 { 01228 bool ret = false; 01229 01230 for(UInt32 i = 0; i < Self::_uiSize; i++) 01231 { 01232 if(Self::_values[i] > other._values[i]) 01233 { 01234 break; 01235 } 01236 01237 if(Self::_values[i] < other._values[i]) 01238 { 01239 ret = true; 01240 break; 01241 } 01242 } 01243 01244 return ret; 01245 }
|
|
||||||||||
|
Definition at line 1212 of file OSGVector.inl. 01213 { 01214 PointInterface<ValueTypeT, 01215 StorageInterfaceT>::error_cannot_assign_vector; 01216 01217 return *this; 01218 }
|
|
||||||||||
|
Definition at line 1194 of file OSGVector.inl. 01196 { 01197 if(this == &source) 01198 return *this; 01199 01200 for(UInt32 i = 0; i < Self::_uiSize; i++) 01201 { 01202 Self::_values[i] = source._values[i]; 01203 } 01204 01205 return *this; 01206 }
|
|
||||||||||
|
Equal operator, using Eps as the tolerance.
Definition at line 1251 of file OSGVector.inl. References osg::Eps, and osg::PointInterface< ValueTypeT, StorageInterfaceT >::equals(). 01253 { 01254 return Self::equals(other, ValueTypeT(Eps)); 01255 }
|
|
||||||||||
|
Definition at line 1165 of file OSGVector.inl.
|
|
||||||||||
|
Definition at line 1156 of file OSGVector.inl.
|
|
||||||||||
|
Definition at line 650 of file OSGVector.inl. Referenced by osg::VectorInterface< ValueTypeT, StorageInterfaceT >::projectTo(). 00651 { 00652 for(UInt32 i = 0; i < Self::_uiSize; i++) 00653 { 00654 Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement(); 00655 } 00656 }
|
|
||||||||||
|
Definition at line 844 of file OSGVector.inl. 00845 { 00846 setValueFromCString(szString); 00847 }
|
|
||||||||||
|
Reimplemented in osg::Color3< ValueTypeT >, and osg::Color4< ValueTypeT >. Definition at line 836 of file OSGVector.inl. 00837 { 00838 setValueFromCString(szString); 00839 }
|
|
||||||||||
|
Set value from a given array, be sure to match sizes.
Definition at line 747 of file OSGVector.inl. 00748 { 00749 setValue(static_cast<const ValueTypeT *>(pVals)); 00750 }
|
|
||||||||||
|
Set value from a given array, be sure to match sizes.
Definition at line 734 of file OSGVector.inl. 00735 { 00736 for(UInt32 i = 0; i < Self::_uiSize; i++) 00737 { 00738 Self::_values[i] = pVals[i]; 00739 } 00740 }
|
|
||||||||||||||
|
Definition at line 440 of file OSGVector.h. 00441 { 00442 for(UInt32 i = 0; 00443 i < (Self::_uiSize < PointInterface<EVT,EST>::_uiSize ? 00444 Self::_uiSize : PointInterface<EVT,EST>::_uiSize); 00445 ++i) 00446 { 00447 Self::_values[i] = vec.getValues()[i]; 00448 } 00449 }
|
|
||||||||||
|
Definition at line 673 of file OSGVector.inl. Referenced by osg::TransformationMatrix< ValueTypeT >::setTranslate(), osg::TransformationMatrix< ValueTypeT >::setValue(), and osg::TransformationMatrix< ValueTypeT >::TransformationMatrix(). 00674 { 00675 for(UInt32 i = 0; i < Self::_uiSize; i++) 00676 { 00677 Self::_values[i] = vec._values[i]; 00678 } 00679 }
|
|
||||||||||
|
Extract values from given string, where both (const and not const) must be present, otherwise the compiler strikes back :-) (GV).
Definition at line 827 of file OSGVector.inl. 00828 { 00829 setValueFromCString(static_cast<const Char8 *>(szString)); 00830 }
|
|
||||||||||
|
Extract values from given string, where both (const and not const) must be present, otherwise the compiler strikes back :-) (GV).
Definition at line 759 of file OSGVector.inl. 00761 { 00762 UInt32 i; 00763 UInt32 numOfToken = Self::_uiSize; 00764 00765 Char8 *c = const_cast<Char8 *>(szString); 00766 Char8 *tokenC = 0; 00767 00768 Char8 token[256]; 00769 00770 if(szString == NULL || (*szString) == '\0') 00771 { 00772 for(i = 0; i < Self::_uiSize; i++) 00773 Self::_values[i] = TypeTraits<ValueTypeT>::getZeroElement(); 00774 00775 return; 00776 } 00777 00778 for (i = 0; i < numOfToken; c++) 00779 { 00780 switch (*c) 00781 { 00782 case '\0': 00783 if(tokenC) 00784 { 00785 *tokenC = 0; 00786 Self::_values[i++] = 00787 TypeTraits<ValueTypeT>::getFromCString(token); 00788 } 00789 00790 while (i < numOfToken) 00791 { 00792 Self::_values[i++] = 00793 TypeTraits<ValueTypeT>::getZeroElement(); 00794 } 00795 break; 00796 00797 case ' ' : 00798 case '\t': 00799 case '\n': 00800 case ',': 00801 if(tokenC) 00802 { 00803 *tokenC = 0; 00804 Self::_values[i++] = 00805 TypeTraits<ValueTypeT>::getFromCString(token); 00806 tokenC = 0; 00807 } 00808 break; 00809 default: 00810 if(!tokenC) 00811 { 00812 tokenC = token; 00813 } 00814 *tokenC++ = *c; 00815 break; 00816 } 00817 } 00818 }
|
|
||||||||||
|
Returns the corrosponding vector by subtracting zero.
Reimplemented in osg::VectorInterface< ValueTypeT, StorageInterfaceT >, osg::VectorInterface< ValueTypeT, VecStorage3< ValueTypeT > >, and osg::VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > >. Definition at line 945 of file OSGVector.inl.
|
| ||||||||