00001 #ifndef Geometry_H
00002 #define Geometry_H
00003
00023 #include <iostream>
00024 #include <cmath>
00025
00026 #include <wds-debug.h>
00027 #include <Array.H>
00028 #include <LocalArray.H>
00029
00030
00041
00042
00043
00044
00045 template <class T> class NdPoint;
00046 template <class T> class NdVector;
00047 template <class T, int Size> class FixedNdPoint;
00048 template <class T, int Size> class FixedNdVector;
00049
00050 template <class T> class Fixed1dPoint;
00051 template <class T> class Fixed2dPoint;
00052 template <class T> class Fixed3dPoint;
00053 template <class T> class Fixed4dPoint;
00054
00055 template <class T> class Fixed1dVector;
00056 template <class T> class Fixed2dVector;
00057 template <class T> class Fixed3dVector;
00058 template <class T> class Fixed4dVector;
00059
00060
00061
00062
00063
00065 typedef NdPoint <double> RnPoint;
00067 typedef NdVector <double> RnVector;
00068
00070 typedef Fixed1dPoint <double> R1Point;
00072 typedef Fixed2dPoint <double> R2Point;
00074 typedef Fixed3dPoint <double> R3Point;
00076 typedef Fixed4dPoint <double> R4Point;
00077
00079 typedef Fixed1dVector <double> R1Vector;
00081 typedef Fixed2dVector <double> R2Vector;
00083 typedef Fixed3dVector <double> R3Vector;
00085 typedef Fixed4dVector <double> R4Vector;
00086
00087
00088
00089
00090
00092 typedef NdPoint <int> ZnPoint;
00094 typedef NdVector <int> ZnVector;
00095
00097 typedef Fixed1dPoint <int> Z1Point;
00099 typedef Fixed2dPoint <int> Z2Point;
00101 typedef Fixed3dPoint <int> Z3Point;
00103 typedef Fixed4dPoint <int> Z4Point;
00104
00106 typedef Fixed1dVector <int> Z1Vector;
00108 typedef Fixed2dVector <int> Z2Vector;
00110 typedef Fixed3dVector <int> Z3Vector;
00112 typedef Fixed4dVector <int> Z4Vector;
00113
00114
00115
00116
00117
00119
00122 template <class T> class NdPoint : public Array <T> {
00123 public:
00126 explicit NdPoint(const int dimension) :Array <T> (dimension) {assert(dimension > 0);}
00130 NdPoint(const int dimension, const T &value) :Array <T> (dimension, value) {assert(dimension > 0);}
00131 NdPoint(const NdPoint <T> &point) :Array <T> (point) {}
00132 virtual ~NdPoint() {}
00133
00134 using Array <T>::operator=;
00135
00138 bool operator==(const NdPoint <T> &point) const {
00139 for(int i(0); i < n(); ++i)
00140 if(point[i] != Array<T>::operator()(i)) return false;
00141 return true;}
00142
00144
00145
00146 int n() const {return Array <T>::size();}
00148
00150
00151
00152
00154 NdPoint <T> operator+(const NdVector <T> &vector) const {
00155 assert(n() == vector.n()); NdPoint <T> point(*this); point += vector; return point;}
00157
00159 NdPoint <T> operator-(const NdVector <T> &vector) const {
00160 assert(n() == vector.n()); NdPoint <T> point(*this); point -= vector; return point;}
00161
00163
00165 NdPoint <T> &operator+=(const NdVector <T> &vector) {
00166 assert(n() == vector.n()); for(int i = 0; i < n(); ++i) Array <T>::operator()(i) += vector[i]; return *this;}
00168
00170 NdPoint <T> &operator-=(const NdVector <T> &vector) {
00171 assert(n() == vector.n()); for(int i = 0; i < n(); ++i) Array <T>::operator()(i) -= vector[i]; return *this;}
00172
00174
00176 NdVector <T> operator-(const NdPoint <T> &point) const {
00177 NdVector <T> vector(n()); for(int i = 0; i < n(); ++i)
00178 vector[i] = Array<T>::operator()(i) - point[i];
00179 return vector;
00180 }
00181
00183
00185 double distance(const NdPoint <T> &point) const {
00186 assert(n() == point.n()); double retval = 0.0;
00187 for(int i = 0; i < n(); ++i)
00188 retval += (double)((point[i] - Array<T>::operator()(i)) * (point[i] - Array<T>::operator()(i)));
00189 return sqrt(retval);
00190 }
00192 };
00193
00194
00195
00196
00197
00199
00202 template <class T> class NdVector : public Array <T> {
00203 public:
00206 explicit NdVector(const int dimension) :Array <T> (dimension) {assert(dimension > 0);}
00210 NdVector(const int dimension, const T &value) :Array <T> (dimension, value) {assert(dimension > 0);}
00214 NdVector(const NdPoint <T> &p1, const NdPoint <T> &p2) :Array <T> (p1.n()) {
00215 assert(p1.n() == p2.n()); for(int i = 0; i < p1.n(); ++i) Array <T>::operator()(i) = p1[i] - p2[i];}
00216 NdVector(const NdVector <T> &vector) :Array <T> (vector) {}
00217 ~NdVector() {}
00218
00219 using Array <T>::operator=;
00220
00223 bool operator==(const NdVector <T> &vec) const {
00224 for(int i(0); i < n(); ++i)
00225 if(vec[i] != Array<T>::operator()(i)) return false;
00226 return true;}
00227
00229
00230
00231 int n() const {return Array <T>::size();}
00233
00235
00236
00237
00240 NdVector <T> operator*(const double scalar) const {
00241 NdVector <T> vector(*this); vector *= scalar; return vector;}
00243
00246 NdVector <T> operator/(const double scalar) const {
00247 assert(scalar != 0.0); NdVector <T> vector(*this); vector /= scalar; return vector;}
00248
00250
00253 NdVector <T> &operator*=(const double scalar) {
00254 for(int i = 0; i < n(); ++i) Array <T>::operator()(i) *= scalar; return *this;}
00256
00259 NdVector <T> &operator/=(const double scalar) {
00260 assert(scalar != 0.0); for(int i = 0; i < n(); ++i) Array <T>::operator()(i) /= scalar; return *this;}
00261
00263
00266 NdVector <T> operator+(const NdVector <T> &vector) const {
00267 assert(n() == vector.n()); NdVector <T> retval(*this); retval += vector; return retval;}
00269
00272 NdVector <T> operator-(const NdVector <T> &vector) const {
00273 assert(n() == vector.n()); NdVector <T> retval(*this); retval -= vector; return retval;}
00274
00276
00279 NdVector <T> &operator+=(const NdVector <T> &vector) {
00280 assert(n() == vector.n()); for(int i = 0; i < n(); ++i) Array<T>::operator()(i) += vector[i];
00281 return *this;}
00283
00286 NdVector <T> &operator-=(const NdVector <T> &vector) {
00287 assert(n() == vector.n()); for(int i = 0; i < n(); ++i) Array<T>::operator()(i) += vector[i];
00288 return *this;}
00289
00291
00293 NdVector <T> operator-() const {
00294 NdVector retval(n()); for(int i = 0; i < n(); ++i) retval[i] = -Array<T>::operator()(i);
00295 return retval;}
00296
00298
00301 double operator*(const NdVector <T> &vector) {
00302 assert(n() == vector.n()); double retval = 0.0;
00303 for(int i = 0; i < n(); ++i) retval += Array<T>::operator()(i) * vector[i];
00304 return retval;
00305 }
00306
00308 double length() const {
00309 double retval = 0.0;
00310 for(int i = 0; i < n(); ++i)
00311 retval += static_cast<double>(Array<T>::operator()(i) * Array<T>::operator()(i));
00312 return sqrt(retval);
00313 }
00314
00316
00318 void normalize(const double new_length = 1.0) {
00319 assert(new_length > 0.0); assert(length() > 0.0);
00320 const double len = length() / new_length;
00321 if (len > 0.0) operator/=(len);
00322 }
00324 };
00325
00326
00327
00328
00329
00331
00335 template <class T, int Size> class FixedNdPoint : public LocalArray <T, Size> {
00336 public:
00337 FixedNdPoint() :LocalArray <T, Size> () {assert(Size > 0);}
00340 FixedNdPoint(const T &value) :LocalArray <T, Size> (value) {assert(Size > 0);}
00341 FixedNdPoint(const NdPoint <T> &point) :LocalArray <T, Size> (point) {}
00342 ~FixedNdPoint() {}
00343
00344 using LocalArray <T, Size>::operator=;
00345
00347
00348
00349 int n() const {return Size;}
00351
00353
00354
00355
00357 FixedNdPoint <T, Size> operator+(const FixedNdVector <T, Size> &vector) const {
00358 FixedNdPoint <T, Size> point(*this); point += vector; return point;}
00360
00362 FixedNdPoint <T, Size> operator-(const FixedNdVector <T, Size> &vector) const {
00363 FixedNdPoint <T, Size> point(*this); point -= vector; return point;}
00364
00366
00368 FixedNdPoint <T, Size> &operator+=(const FixedNdVector <T, Size> &vector) {
00369 for(int i = 0; i < Size; ++i) LocalArray <T, Size>::operator()(i) += vector[i]; return *this;}
00371
00373 FixedNdPoint <T, Size> &operator-=(const FixedNdVector <T, Size> &vector) {
00374 for(int i = 0; i < Size; ++i) LocalArray <T, Size>::operator()(i) -= vector[i]; return *this;}
00375
00377
00379 FixedNdVector <T, Size> operator-(const FixedNdPoint <T, Size> &point) const {
00380 FixedNdVector <T, Size> vector; for(int i = 0; i < Size; ++i)
00381 vector[i] = LocalArray <T, Size>::operator()(i) - point[i];
00382 return vector;
00383 }
00384
00386
00388 double distance(const FixedNdPoint <T, Size> &point) const {
00389 double retval = 0.0; for(int i = 0; i < Size; ++i)
00390 retval += static_cast<double>((point[i] - LocalArray<T, Size>::operator()(i)) * (point[i] - LocalArray<T, Size>::operator()(i)));
00391 return sqrt(retval);
00392 }
00394 };
00395
00396
00397
00398
00399
00401
00405 template <class T, int Size> class FixedNdVector : public LocalArray <T, Size> {
00406 public:
00407 FixedNdVector() :LocalArray <T, Size> () {assert(Size > 0);}
00410 FixedNdVector(const T &value) :LocalArray <T, Size> (value) {assert(Size > 0);}
00414 FixedNdVector(const FixedNdPoint <T, Size> &p1, const FixedNdPoint <T, Size> &p2) :LocalArray <T, Size> () {
00415 for(int i = 0; i < p1.n(); ++i) LocalArray <T, Size>::operator()(i) = p1[i] - p2[i];}
00416 FixedNdVector(const FixedNdVector <T, Size> &vector) :LocalArray <T, Size> (vector) {}
00417 ~FixedNdVector() {}
00418
00419 using LocalArray <T, Size>::operator=;
00420
00422
00423
00424 int n() const {return Size;}
00426
00428
00429
00430
00433 FixedNdVector <T, Size> operator*(const double scalar) const {
00434 FixedNdVector <T, Size> vector(*this); vector *= scalar; return vector;}
00436
00439 FixedNdVector <T, Size> operator/(const double scalar) const {
00440 assert(scalar != 0.0); FixedNdVector <T, Size> vector(*this); vector /= scalar; return vector;}
00441
00443
00446 FixedNdVector <T, Size> &operator*=(const double scalar) {
00447 for(int i = 0; i < Size; ++i) LocalArray <T, Size>::operator()(i) *= scalar; return *this;}
00449
00452 FixedNdVector <T, Size> &operator/=(const double scalar) {
00453 assert(scalar != 0.0); for(int i = 0; i < Size; ++i) LocalArray <T, Size>::operator()(i) /= scalar; return *this;}
00454
00456
00459 FixedNdVector <T, Size> operator+(const FixedNdVector <T, Size> &vector) const {
00460 FixedNdVector <T, Size> retval(*this); retval += vector; return retval;}
00462
00465 FixedNdVector <T, Size> operator-(const FixedNdVector <T, Size> &vector) const {
00466 FixedNdVector <T, Size> retval(*this); retval -= vector; return retval;}
00467
00469
00472 FixedNdVector <T, Size> &operator+=(const FixedNdVector <T, Size> &vector) {
00473 for(int i = 0; i < Size; ++i) LocalArray<T, Size>::operator()(i) += vector[i];
00474 return *this;}
00476
00479 FixedNdVector <T, Size> &operator-=(const FixedNdVector <T, Size> &vector) {
00480 for(int i = 0; i < Size; ++i) LocalArray<T, Size>::operator()(i) += vector[i];
00481 return *this;}
00482
00484
00486 FixedNdVector <T, Size> operator-() const {
00487 FixedNdVector retval; for(int i = 0; i < Size; ++i) retval[i] = -LocalArray<T, Size>::operator()(i);
00488 return retval;}
00489
00491
00494 double operator*(const FixedNdVector <T, Size> &vector) {
00495 double retval = 0.0; for(int i = 0; i < Size; ++i) retval += LocalArray<T, Size>::operator()(i) * vector[i];
00496 return retval;
00497 }
00498
00500 double length() const {
00501 double retval = 0.0;
00502 for(int i = 0; i < Size; ++i)
00503 retval += static_cast<double>(Array<T>::operator()(i) * Array<T>::operator()(i));
00504 return sqrt(retval);
00505 }
00506
00508
00510 void normalize(const double new_length = 1.0) {
00511 assert(new_length > 0.0); assert(length() > 0.0);
00512 const double len = length() / new_length;
00513 if (len > 0.0) operator/=(len);
00514 }
00516 };
00517
00518
00519
00520
00521
00523
00526 template <class T> class Fixed1dPoint : public FixedNdPoint <T, 1> {
00527 public:
00528 Fixed1dPoint() :FixedNdPoint <T, 1> () {}
00531 Fixed1dPoint(const T &x) :FixedNdPoint <T, 1> () {FixedNdPoint<T, 1>::operator()(0) = x;}
00532 Fixed1dPoint(const Fixed1dPoint <T> &point) :FixedNdPoint <T, 1> (point) {}
00533 ~Fixed1dPoint() {}
00534
00535 using FixedNdPoint <T, 1>::operator=;
00536
00538
00539
00540 T &x() {return FixedNdPoint<T, 1>::operator()(0);}
00541
00543 const T &x() const {return FixedNdPoint<T, 1>::operator()(0);}
00545 };
00546
00547
00548
00549
00550
00552
00555 template <class T> class Fixed1dVector : public FixedNdVector <T, 1> {
00556 public:
00557 Fixed1dVector() :FixedNdVector <T, 1> () {}
00560 Fixed1dVector(const T &x) :FixedNdVector <T, 1> () {FixedNdVector<T, 1>::operator()(0) = x;}
00561 Fixed1dVector(const Fixed1dVector <T> &vector) :FixedNdVector <T, 1> (vector) {}
00562 ~Fixed1dVector() {}
00563
00564 using FixedNdVector <T, 1>::operator=;
00565
00567
00568
00569 T &x() {return FixedNdVector<T, 1>::operator()(0);}
00570
00572 const T &x() const {return FixedNdVector<T, 1>::operator()(0);}
00574 };
00575
00576
00577
00578
00579
00581
00584 template <class T> class Fixed2dPoint : public FixedNdPoint <T, 2> {
00585 public:
00586 Fixed2dPoint() :FixedNdPoint <T, 2> () {}
00589 Fixed2dPoint(const T &value) :FixedNdPoint <T, 2> (value) {}
00593 Fixed2dPoint(const T &x, const T &y) :FixedNdPoint <T, 2> () {
00594 FixedNdPoint<T, 2>::operator()(0) = x;
00595 FixedNdPoint<T, 2>::operator()(1) = y;
00596 }
00597 Fixed2dPoint(const Fixed2dPoint <T> &point) :FixedNdPoint <T, 2> (point) {}
00598 ~Fixed2dPoint() {}
00599
00600 using FixedNdPoint <T, 2>::operator=;
00601
00603
00604
00605 T &x() {return FixedNdPoint<T, 2>::operator()(0);}
00607 T &y() {return FixedNdPoint<T, 2>::operator()(1);}
00608
00610 const T &x() const {return FixedNdPoint<T, 2>::operator()(0);}
00612 const T &y() const {return FixedNdPoint<T, 2>::operator()(1);}
00614 };
00615
00616
00617
00618
00619
00621
00624 template <class T> class Fixed2dVector : public FixedNdVector <T, 2> {
00625 public:
00626 Fixed2dVector() :FixedNdVector <T, 2> () {}
00629 Fixed2dVector(const T &value) :FixedNdVector <T, 2> (value) {}
00633 Fixed2dVector(const T &x, const T &y) :FixedNdVector <T, 2> () {
00634 FixedNdVector<T, 2>::operator()(0) = x;
00635 FixedNdVector<T, 2>::operator()(1) = y;
00636 }
00637 Fixed2dVector(const Fixed2dVector <T> &vector) :FixedNdVector <T, 2> (vector) {}
00638 ~Fixed2dVector() {}
00639
00640 using FixedNdVector <T, 2>::operator=;
00641
00643
00644
00645 T &x() {return FixedNdVector<T, 2>::operator()(0);}
00647 T &y() {return FixedNdVector<T, 2>::operator()(1);}
00648
00650 const T &x() const {return FixedNdVector<T, 2>::operator()(0);}
00652 const T &y() const {return FixedNdVector<T, 2>::operator()(1);}
00654 };
00655
00656
00657
00658
00659
00661
00664 template <class T> class Fixed3dPoint : public FixedNdPoint <T, 3> {
00665 public:
00666 Fixed3dPoint() :FixedNdPoint <T, 3> () {}
00669 Fixed3dPoint(const T &value) :FixedNdPoint <T, 3> (value) {}
00674 Fixed3dPoint(const T &x, const T &y, const T &z) :FixedNdPoint <T, 3> () {
00675 FixedNdPoint<T, 3>::operator()(0) = x;
00676 FixedNdPoint<T, 3>::operator()(1) = y;
00677 FixedNdPoint<T, 3>::operator()(2) = z;
00678 }
00679 Fixed3dPoint(const Fixed3dPoint <T> &point) :FixedNdPoint <T, 3> (point) {}
00680 ~Fixed3dPoint() {}
00681
00682 using FixedNdPoint <T, 3>::operator=;
00683
00685
00686
00687 T &x() {return FixedNdPoint<T, 3>::operator()(0);}
00689 T &y() {return FixedNdPoint<T, 3>::operator()(1);}
00691 T &z() {return FixedNdPoint<T, 3>::operator()(2);}
00692
00694 const T &x() const {return FixedNdPoint<T, 3>::operator()(0);}
00696 const T &y() const {return FixedNdPoint<T, 3>::operator()(1);}
00698 const T &z() const {return FixedNdPoint<T, 3>::operator()(2);}
00700 };
00701
00702
00703
00704
00705
00707
00710 template <class T> class Fixed3dVector : public FixedNdVector <T, 3> {
00711 public:
00712 Fixed3dVector() :FixedNdVector <T, 3> () {}
00715 Fixed3dVector(const T &value) :FixedNdVector <T, 3> (value) {}
00720 Fixed3dVector(const T &x, const T &y, const T &z) :FixedNdVector <T, 3> () {
00721 FixedNdVector<T, 3>::operator()(0) = x;
00722 FixedNdVector<T, 3>::operator()(1) = y;
00723 FixedNdVector<T, 3>::operator()(2) = z;
00724 }
00725 Fixed3dVector(const Fixed3dVector <T> &vector) :FixedNdVector <T, 3> (vector) {}
00726 ~Fixed3dVector() {}
00727
00728 using FixedNdVector <T, 3>::operator=;
00729
00731
00732
00733 T &x() {return FixedNdVector<T, 3>::operator()(0);}
00735 T &y() {return FixedNdVector<T, 3>::operator()(1);}
00737 T &z() {return FixedNdVector<T, 3>::operator()(2);}
00738
00740 const T &x() const {return FixedNdVector<T, 3>::operator()(0);}
00742 const T &y() const {return FixedNdVector<T, 3>::operator()(1);}
00744 const T &z() const {return FixedNdVector<T, 3>::operator()(2);}
00746 };
00747
00748
00749
00750
00751
00753
00756 template <class T> class Fixed4dPoint : public FixedNdPoint <T, 4> {
00757 public:
00758 Fixed4dPoint() :FixedNdPoint <T, 4> () {}
00761 Fixed4dPoint(const T &value) :FixedNdPoint <T, 4> (value) {}
00767 Fixed4dPoint(const T &x, const T &y, const T &z, const T &t) :FixedNdPoint <T, 4> () {
00768 FixedNdPoint<T, 4>::operator()(0) = x;
00769 FixedNdPoint<T, 4>::operator()(1) = y;
00770 FixedNdPoint<T, 4>::operator()(2) = z;
00771 FixedNdPoint<T, 4>::operator()(3) = t;
00772 }
00773 Fixed4dPoint(const Fixed4dPoint <T> &point) :FixedNdPoint <T, 4> (point) {}
00774 ~Fixed4dPoint() {}
00775
00776 using FixedNdPoint <T, 4>::operator=;
00777
00779
00780
00781 T &x() {return FixedNdPoint<T, 4>::operator()(0);}
00783 T &y() {return FixedNdPoint<T, 4>::operator()(1);}
00785 T &z() {return FixedNdPoint<T, 4>::operator()(2);}
00787 T &t() {return FixedNdPoint<T, 4>::operator()(3);}
00788
00790 const T &x() const {return FixedNdPoint<T, 4>::operator()(0);}
00792 const T &y() const {return FixedNdPoint<T, 4>::operator()(1);}
00794 const T &z() const {return FixedNdPoint<T, 4>::operator()(2);}
00796 const T &t() const {return FixedNdPoint<T, 4>::operator()(3);}
00798 };
00799
00800
00801
00802
00803
00805
00808 template <class T> class Fixed4dVector : public FixedNdVector <T, 4> {
00809 public:
00810 Fixed4dVector() :FixedNdVector <T, 4> () {}
00813 Fixed4dVector(const T &value) :FixedNdVector <T, 4> (value) {}
00819 Fixed4dVector(const T &x, const T &y, const T &z, const T &t) :FixedNdVector <T, 4> () {
00820 FixedNdVector<T, 4>::operator()(0) = x;
00821 FixedNdVector<T, 4>::operator()(1) = y;
00822 FixedNdVector<T, 4>::operator()(2) = z;
00823 FixedNdVector<T, 4>::operator()(3) = t;
00824 }
00825 Fixed4dVector(const Fixed4dVector <T> &vector) :FixedNdVector <T, 4> (vector) {}
00826 ~Fixed4dVector() {}
00827
00828 using FixedNdVector <T, 4>::operator=;
00829
00831
00832
00833 T &x() {return FixedNdVector<T, 4>::operator()(0);}
00835 T &y() {return FixedNdVector<T, 4>::operator()(1);}
00837 T &z() {return FixedNdVector<T, 4>::operator()(2);}
00839 T &t() {return FixedNdVector<T, 4>::operator()(3);}
00840
00842 const T &x() const {return FixedNdVector<T, 4>::operator()(0);}
00844 const T &y() const {return FixedNdVector<T, 4>::operator()(1);}
00846 const T &z() const {return FixedNdVector<T, 4>::operator()(2);}
00848 const T &t() const {return FixedNdVector<T, 4>::operator()(3);}
00850 };
00851
00852
00853
00854
00855
00857
00858 template <class T> std::ostream &operator<<(std::ostream &out, const NdPoint <T> &point) {
00859 if (point.n() > 0) out << point[0];
00860 for(int i = 1; i < point.n(); ++i)
00861 out << ' ' << point[i];
00862 return out;
00863 }
00864
00865
00866 template <class T> std::istream &operator>>(std::istream &in, NdPoint <T> &point) {
00867 for(int i = 0; i < point.n(); ++i)
00868 in >> point[i];
00869 return in;
00870 }
00872
00873
00874
00875
00876
00878
00879 template <class T> std::ostream &operator<<(std::ostream &out, const NdVector <T> &vector) {
00880 if (vector.n() > 0) out << vector[0];
00881 for(int i = 1; i < vector.n(); ++i)
00882 out << ' ' << vector[i];
00883 return out;
00884 }
00885
00886
00887 template <class T> std::istream &operator>>(std::istream &in, NdVector <T> &vector) {
00888 for(int i = 0; i < vector.n(); ++i)
00889 in >> vector[i];
00890 return in;
00891 }
00893
00894
00895
00896
00897
00899
00900 template <class T, int Size> std::ostream &operator<<(std::ostream &out, const FixedNdPoint <T, Size> &point) {
00901 if (Size > 0) out << point[0];
00902 for(int i = 1; i < Size; ++i)
00903 out << ' ' << point[i];
00904 return out;
00905 }
00906
00907
00908 template <class T, int Size> std::istream &operator>>(std::istream &in, FixedNdPoint <T, Size> &point) {
00909 for(int i = 0; i < Size; ++i)
00910 in >> point[i];
00911 return in;
00912 }
00914
00915
00916
00917
00918
00920
00921 template <class T, int Size> std::ostream &operator<<(std::ostream &out, const FixedNdVector <T, Size> &vector) {
00922 if (Size > 0) out << vector[0];
00923 for(int i = 1; i < Size; ++i)
00924 out << ' ' << vector[i];
00925 return out;
00926 }
00927
00928
00929 template <class T, int Size> std::istream &operator>>(std::istream &in, FixedNdVector <T, Size> &vector) {
00930 for(int i = 0; i < Size; ++i)
00931 in >> vector[i];
00932 return in;
00933 }
00935
00936
00937 #endif