#include <vector_2s.h>
Nevrax France
Definition at line 46 of file vector_2s.h.
Public Member Functions | |
void | pack (const NLMISC::CVector2f &v) |
void | pack (const NLMISC::CVector &v) |
NLMISC::CVector2f | unpack () const |
NLMISC::CVector | unpack3f (float hintz=0.0f) const |
Object. | |
CVector2s (const NLMISC::CVector &v) | |
CVector2s (const CVector2s &v) | |
Copy Constructor. | |
CVector2s (sint16 _x, sint16 _y) | |
Constructor . | |
CVector2s () | |
Constructor which do nothing. | |
Misc. | |
bool | isNull () const |
void | maxof (const CVector2s &a, const CVector2s &b) |
Set all vector x/y/z as maximum of a/b x/y/z (respectively). | |
void | minof (const CVector2s &a, const CVector2s &b) |
Set all vector x/y/z as minimum of a/b x/y/z (respectively). | |
bool | operator!= (const CVector2s &v) const |
bool | operator== (const CVector2s &v) const |
void | serial (NLMISC::IStream &f) |
serial. | |
void | set (sint16 _x, sint16 _y) |
Advanced Maths. | |
float | norm () const |
Return the norm of the vector. | |
void | normalize () |
Normalize the vector. | |
CVector2s | normed () const |
Return the vector normalized. | |
float | operator * (const CVector2s &v) const |
Dot product. | |
float | sqrnorm () const |
Return the square of the norm of the vector. | |
Base Maths. | |
CVector2s | operator * (float f) const |
CVector2s & | operator *= (float f) |
CVector2s | operator+ (const CVector2s &v) const |
CVector2s & | operator+= (const CVector2s &v) |
CVector2s | operator- () const |
CVector2s | operator- (const CVector2s &v) const |
CVector2s & | operator-= (const CVector2s &v) |
CVector2s | operator/ (float f) const |
CVector2s & | operator/= (float f) |
Data Fields | |
sint16 | x |
sint16 | y |
Static Private Member Functions | |
bool | checkCastSint16 (float f) |
bool | checkCastSint16 (sint64 s) |
sint16 | pack (float f) |
sint16 | safeCastSint16 (float f) |
sint16 | safeCastSint16 (sint64 s) |
float | unpack (sint16 s) |
|
Constructor which do nothing.
Definition at line 105 of file vector_2s.h. Referenced by operator *(), operator+(), operator-(), and operator/().
00105 {} |
|
Constructor .
Definition at line 107 of file vector_2s.h.
|
|
Copy Constructor.
Definition at line 109 of file vector_2s.h.
|
|
Definition at line 110 of file vector_2s.h.
00110 { pack(v); } |
|
Definition at line 79 of file vector_2s.h.
00080 { 00081 sint64 s = (sint64)f; 00082 return (s<=32767 && s>=-32768); 00083 } |
|
Definition at line 73 of file vector_2s.h.
00074 { 00075 return (s<=32767 && s>=-32768); 00076 } |
|
Definition at line 157 of file vector_2s.h.
|
|
Set all vector x/y/z as maximum of a/b x/y/z (respectively).
Definition at line 165 of file vector_2s.h. Referenced by NLPACS::COrderedChain::pack(), and NLPACS::COrderedChain::serial().
|
|
Set all vector x/y/z as minimum of a/b x/y/z (respectively).
Definition at line 159 of file vector_2s.h. References min, x, x, y, and y. Referenced by NLPACS::COrderedChain::computeMinMax(), and NLPACS::COrderedChain::pack().
|
|
Return the norm of the vector.
Definition at line 133 of file vector_2s.h. References sqrnorm(). Referenced by normalize().
00133 {return (float)sqrt(sqrnorm());} |
|
Normalize the vector.
Definition at line 137 of file vector_2s.h. References norm().
00138 { 00139 float f= norm(); 00140 if(f>0) 00141 *this/=f; 00142 } |
|
Return the vector normalized.
Definition at line 144 of file vector_2s.h. References v.
|
|
Dot product.
Definition at line 131 of file vector_2s.h. References v, NLPACS::Vector2sAccuracy, x, and y.
00131 {return ((float)x*(float)v.x + (float)y*(float)v.y)/(Vector2sAccuracy*Vector2sAccuracy);} |
|
Definition at line 124 of file vector_2s.h. References CVector2s(), safeCastSint16(), x, and y.
00124 {return CVector2s(safeCastSint16(x*f), safeCastSint16(y*f));} |
|
Definition at line 122 of file vector_2s.h. References safeCastSint16(), x, and y.
00122 { x = safeCastSint16(f*x); y = safeCastSint16(f*y); return *this; } |
|
Definition at line 156 of file vector_2s.h. References v.
00156 {return !(*this==v);} |
|
Definition at line 118 of file vector_2s.h. References CVector2s(), safeCastSint16(), sint64, v, x, and y.
00118 {return CVector2s(safeCastSint16((sint64)v.x+(sint64)x), safeCastSint16((sint64)v.y+(sint64)y));} |
|
Definition at line 116 of file vector_2s.h. References safeCastSint16(), sint64, v, x, and y.
|
|
Definition at line 120 of file vector_2s.h. References CVector2s(), safeCastSint16(), sint64, x, and y.
00120 {return CVector2s(safeCastSint16(-(sint64)x), safeCastSint16(-(sint64)y));} |
|
Definition at line 119 of file vector_2s.h. References CVector2s(), safeCastSint16(), sint64, v, x, and y.
00119 {return CVector2s(safeCastSint16((sint64)v.x-(sint64)x), safeCastSint16((sint64)v.y-(sint64)y));} |
|
Definition at line 117 of file vector_2s.h. References safeCastSint16(), sint64, v, x, and y.
|
|
Definition at line 125 of file vector_2s.h. References CVector2s(), safeCastSint16(), x, and y.
00125 {return CVector2s(safeCastSint16(x/f), safeCastSint16(y/f));} |
|
Definition at line 123 of file vector_2s.h. References safeCastSint16(), x, and y.
00123 { x = safeCastSint16(f/x); y = safeCastSint16(f/y); return *this; } |
|
Definition at line 155 of file vector_2s.h.
|
|
Definition at line 175 of file vector_2s.h. References pack(), v, x, and y.
|
|
Definition at line 174 of file vector_2s.h. References pack(), v, x, and y.
|
|
Definition at line 87 of file vector_2s.h. References safeCastSint16(), sint16, and NLPACS::Vector2sAccuracy. Referenced by CVector2s(), pack(), and NLPACS::COrderedChain::translate().
00088 { 00089 return safeCastSint16(f*Vector2sAccuracy); 00090 } |
|
Definition at line 60 of file vector_2s.h. References nlerror, s, sint16, and sint64.
|
|
Definition at line 50 of file vector_2s.h. References NL_I64, nlerror, s, sint16, and sint64. Referenced by operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), and pack().
|
|
serial.
Definition at line 171 of file vector_2s.h. References NLMISC::IStream::serial(), x, and y.
|
|
Definition at line 154 of file vector_2s.h.
|
|
Return the square of the norm of the vector.
Definition at line 135 of file vector_2s.h. References NLPACS::Vector2sAccuracy, x, and y. Referenced by norm().
00135 {return ((float)x*(float)x + (float)y*(float)y)/(Vector2sAccuracy*Vector2sAccuracy);} |
|
Definition at line 176 of file vector_2s.h. Referenced by unpack3f().
00176 { return NLMISC::CVector2f(unpack(x), unpack(y)); } |
|
Definition at line 93 of file vector_2s.h. References s, sint16, and NLPACS::Vector2sAccuracy.
00094 { 00095 return (float)s/Vector2sAccuracy; 00096 } |
|
Definition at line 177 of file vector_2s.h. References unpack(), x, and y. Referenced by NLPACS::CLocalRetriever::retrieveAccuratePosition().
00177 { return NLMISC::CVector(unpack(x), unpack(y), hintz); } |
|
Definition at line 99 of file vector_2s.h. Referenced by maxof(), minof(), NLPACS::CLocalRetriever::retrieveAccuratePosition(), and NLPACS::CLocalRetriever::retrievePosition(). |
|
Definition at line 99 of file vector_2s.h. Referenced by maxof(), minof(), NLPACS::CLocalRetriever::retrieveAccuratePosition(), and NLPACS::CLocalRetriever::retrievePosition(). |