22#include "FgSerial.hpp"
40 T& operator[](
unsigned int n)
41 {FGASSERT_FAST(n < 2);
return (&x1)[n];}
42 T
const& operator[](
unsigned int n)
const
43 {FGASSERT_FAST(n < 2);
return (&x1)[n];}
45 void set(T a) {x1 = a;x2 = a;}
53 inline void operator/=(T);
54 inline void operator*=(T);
55 inline bool operator==(
const FR2Vect2TC &v)
const
56 {
return (x1==v.x1 && x2==v.x2);}
57 inline bool operator!=(
const FR2Vect2TC &v)
const
58 {
return (x1!=v.x1 || x2!=v.x2);}
61 inline T
const len()
const {
return((T)sqrt(x1*x1 + x2*x2));}
62 inline T
const mag()
const {
return(x1*x1 + x2*x2);}
80std::ostream& operator<<(std::ostream& s,
FR2Vect2IC vec);
81std::ostream& operator<<(std::ostream& s,
FR2Vect2FC vec);
82std::ostream& operator<<(std::ostream& s,
FR2Vect2DC vec);
88 {
return ((x.x2 < y.x2) ||
89 (x.x2 == y.x2 && x.x1 < y.x1)); }
104const inline FR2Vect2TC<T> FR2Vect2TC<T>::operator+(
105 const FR2Vect2TC<T> &v1)
108 return FR2Vect2TC<T>(x1 + v1.x1,
113const inline FR2Vect2TC<T> FR2Vect2TC<T>::operator-(
114 const FR2Vect2TC<T> &v1)
117 return FR2Vect2TC<T>(x1 - v1.x1,
122inline void FR2Vect2TC<T>::operator-=(
130inline void FR2Vect2TC<T>::operator+=(
138const inline FR2Vect2TC<T> FR2Vect2TC<T>::operator*(
142 return FR2Vect2TC<T>(x1*val, x2*val);
146const inline FR2Vect2TC<T> FR2Vect2TC<T>::operator/(
150 FGASSERT_FAST(val != (T)0);
152 return FR2Vect2TC<T>(x1/val, x2/val);
156inline void FR2Vect2TC<T>::operator/=(
159 FGASSERT_FAST(val != (T)0);
165inline void FR2Vect2TC<T>::operator*=(
173inline T
const FR2Vect2TC<T>::dot(
174 FR2Vect2TC<T> operand)
177 return(x1*operand.x1 + x2*operand.x2);
181inline T
const FR2Vect2TC<T>::cross(
185 return (x1*v2.x2 - x2*v2.x1);