5 #ifndef BALL_MATHS_VECTOR2_H
6 #define BALL_MATHS_VECTOR2_H
8 #ifndef BALL_CONCEPT_PERSISTENCEMANAGER_H
12 #ifndef BALL_COMMON_EXCEPTION_H
16 #ifndef BALL_MATHS_COMMON_H
54 std::ostream& operator << (std::ostream& s, const TVector2<T>& vector);
83 explicit TVector2(const T& value);
90 TVector2(const T& vx, const T& vy);
96 TVector2(const TVector2& vector);
104 TVector2(const T* ptr);
116 virtual
void clear();
129 const
char* name = 0) const;
148 void set(const T& value);
154 void set(const T& vx, const T& vy);
159 void set(const TVector2& vector);
165 TVector2& operator = (const TVector2& v);
171 TVector2& operator = (const T& value);
178 TVector2& operator = (const T* ptr);
210 static const TVector2&
getZero();
215 static const TVector2&
getUnit();
225 const T& operator [] (
Position position) const;
234 const TVector2& operator + () const;
238 TVector2 operator - () const;
242 TVector2 operator + (const TVector2& b) const;
246 TVector2 operator - (const TVector2& b) const;
253 TVector2& operator += (const TVector2& vector);
259 TVector2& operator -= (const TVector2& vector);
267 TVector2 operator * (const T& scalar) const;
274 TVector2& operator *= (const T& scalar);
282 TVector2 operator / (const T& lambda) const;
289 TVector2& operator /= (const T& lambda);
294 T operator * (const TVector2& vector) const;
321 bool operator == (const TVector2& vector) const;
328 bool operator != (const TVector2& vector) const;
353 void dump(std::ostream& s = std::cout,
Size depth = 0) const;
385 template <typename T>
386 TVector2<T>::TVector2()
393 template <
typename T>
401 template <
typename T>
409 template <
typename T>
417 template <
typename T>
422 template <
typename T>
435 template <
typename T>
441 template <
typename T>
450 template <
typename T>
457 template <
typename T>
465 template <
typename T>
473 template <
typename T>
481 template <
typename T>
491 template <
typename T>
505 template <
typename T>
515 template <
typename T>
519 return (T)sqrt(x * x + y * y);
522 template <
typename T>
526 return (T)(x * x + y * y);
529 template <
typename T>
532 T len = (T)sqrt(x * x + y * y);
545 template <
typename T>
553 template <
typename T>
561 template <
typename T>
569 template <
typename T>
586 template <
typename T>
603 template <
typename T>
610 template <
typename T>
617 template <
typename T>
624 template <
typename T>
631 template <
typename T>
641 template <
typename T>
651 template <
typename T>
658 template <
typename T>
668 template <
typename T>
678 template <
typename T>
691 template <
typename T>
695 return (x * vector.
x + y * vector.
y);
698 template <
typename T>
705 return (T)sqrt(dx * dx + dy * dy);
708 template <
typename T>
715 return (dx * dx + dy * dy);
718 template <
typename T>
725 template <
typename T>
732 template <
typename T>
739 template <
typename T>
746 template <
typename T>
753 template <
typename T>
761 s <<
" (x = " << x <<
", y = " << y <<
")" << std::endl;
773 template <
typename T>
780 template <
typename T>
784 s >> c >> v.
x >> v.
y >>
c;
789 template <
typename T>
790 std::ostream& operator << (std::ostream& s, const TVector2<T>& v)
792 s <<
"(" << v.x <<
' ' << v.y <<
')';
799 #endif // BALL_MATHS_VECTOR2_H
void writeObjectHeader(const T *object, const char *name=0)
#define BALL_CREATE(name)
bool isEqual(const T1 &a, const T2 &b)
TVector2 operator-() const
void writeObjectTrailer(const char *name=0)
TVector2 & operator+=(const TVector2 &vector)
T & operator[](Position position)
TVector2 & operator*=(const T &scalar)
std::istream & operator>>(std::istream &is, TRegularData1D< ValueType > &grid)
Input operator.
static const TVector2 & getUnit()
static const TVector2 & getZero()
T getSquareLength() const
bool readPrimitive(T &t, const char *name)
void writePrimitive(const T &t, const char *name)
BALL_EXTERN_VARIABLE const double c
TVector2 operator/(const T &lambda) const
T getSquareDistance(const TVector2 &vector) const
const TVector2 & operator+() const
TVector2 operator*(const T &scalar) const
virtual void persistentWrite(PersistenceManager &pm, const char *name=0) const
bool operator==(const TVector2 &vector) const
TVector2 & operator-=(const TVector2 &vector)
#define BALL_DUMP_HEADER(os, cl, ob)
TVector2< float > Vector2
void dump(std::ostream &s=std::cout, Size depth=0) const
TVector2 & operator=(const TVector2 &v)
bool isNotEqual(const T1 &a, const T2 &b)
T getDistance(const TVector2 &vector) const
virtual void persistentRead(PersistenceManager &pm)
bool operator!=(const TVector2 &vector) const
BALL_INLINE TAngle< T > operator*(const T &val, const TAngle< T > &angle)
#define BALL_DUMP_STREAM_PREFIX(os)
TVector2 & operator/=(const T &lambda)
bool isOrthogonalTo(TVector2 &vector) const
#define BALL_DUMP_STREAM_SUFFIX(os)
#define BALL_DUMP_DEPTH(os, depth)