202 return (x == a && y == a);
210 return (x == a.
x && y == a.
y);
218 return (x == a.
x && y == a.
y);
226 return (x == a.
x && y == a.
y);
235 return !(*
this == a);
243 return !(*
this == a);
251 return !(*
this == a);
259 return !(*
this == a);
284 inline bool operator<(const Pt2<U>& a)
const 302 inline bool operator<(const Pt3<U>& a)
const 320 inline bool operator<(const Pt4<U>& a)
const 341 return (*
this < a || *
this == a);
347 inline bool operator<=(const Pt2<U>& a)
const 349 return (*
this < a || *
this == a);
355 inline bool operator<=(const Pt3<U>& a)
const 357 return (*
this < a || *
this == a);
363 inline bool operator<=(const Pt4<U>& a)
const 365 return (*
this < a || *
this == a);
374 return !(*
this <= a);
382 return !(*
this <= a);
390 return !(*
this <= a);
398 return !(*
this <= a);
407 return (*
this > a || *
this == a);
415 return (*
this > a || *
this == a);
423 return (*
this > a || *
this == a);
431 return (*
this > a || *
this == a);
442 return Pt2((T)(x + a), (T)(y + a));
450 return Pt2((T)(x + a.x), (T)(y + a.y));
458 return Pt2((T)(x + a.x), (T)(y + a.y));
466 return Pt2((T)(x + a.x), (T)(y + a.y));
475 return Pt2((T)(x - a), (T)(y - a));
483 return Pt2((T)(x - a.x), (T)(y - a.y));
491 return Pt2((T)(x - a.x), (T)(y - a.y));
499 return Pt2((T)(x - a.x), (T)(y - a.y));
506 return Pt2((T)(-x), (T)(-y));
515 return Pt2((T)(x * a), (T)(y * a));
523 return Pt2((T)(x * a.x), (T)(y * a.y));
531 return Pt2((T)(x * a.x), (T)(y * a.y));
539 return Pt2((T)(x * a.x), (T)(y * a.y));
548 return Pt2((T)(x / a), (T)(y / a));
556 return Pt2((T)(x / a.x), (T)(y / a.y));
564 return Pt2((T)(x / a.x), (T)(y / a.y));
572 return Pt2((T)(x / a.x), (T)(y / a.y));
753 const T&
at(
unsigned int a)
const 762 throw std::out_of_range(
"Pt2<T>::at(): error out of range");
768 T&
at(
unsigned int a)
771 return const_cast<T&
>(
static_cast<const Pt2<T>&
>(*this).
at(a));
777 template <
typename Archive>
778 void serialize(Archive& archive,
const unsigned int version)
809 Pt3(T a_x, T a_y, T a_z)
930 return (x == a && y == a && z == a);
938 return (x == a.
x && y == a.
y);
946 return (x == a.
x && y == a.
y && z == a.
z);
954 return (x == a.
x && y == a.
y && z == a.
z);
963 return !(*
this == a);
971 return !(*
this == a);
979 return !(*
this == a);
987 return !(*
this == a);
1019 inline bool operator<(const Pt2<U>& a)
const 1037 inline bool operator<(const Pt3<U>& a)
const 1062 inline bool operator<(const Pt4<U>& a)
const 1090 return (*
this < a || *
this == a);
1096 inline bool operator<=(const Pt2<U>& a)
const 1098 return (*
this < a || *
this == a);
1104 inline bool operator<=(const Pt3<U>& a)
const 1106 return (*
this < a || *
this == a);
1112 inline bool operator<=(const Pt4<U>& a)
const 1114 return (*
this < a || *
this == a);
1123 return !(*
this <= a);
1131 return !(*
this <= a);
1139 return !(*
this <= a);
1147 return !(*
this <= a);
1156 return (*
this > a || *
this == a);
1164 return (*
this > a || *
this == a);
1172 return (*
this > a || *
this == a);
1180 return (*
this > a || *
this == a);
1191 return Pt3((T)(x + a), (T)(y + a), (T)(z + a));
1199 return Pt3((T)(x + a.x), (T)(y + a.y), z);
1207 return Pt3((T)(x + a.x), (T)(y + a.y), (T)(z + a.z));
1215 return Pt3((T)(x + a.x), (T)(y + a.y), (T)(z + a.z));
1224 return Pt3((T)(x - a), (T)(y - a), (T)(z - a));
1232 return Pt3((T)(x - a.x), (T)(y - a.y), z);
1240 return Pt3((T)(x - a.x), (T)(y - a.y), (T)(z - a.z));
1248 return Pt3((T)(x - a.x), (T)(y - a.y), (T)(z - a.z));
1255 return Pt3((T)(-x), (T)(-y), (T)(-z));
1264 return Pt3((T)(x * a), (T)(y * a), (T)(z * a));
1272 return Pt3((T)(x * a.x), (T)(y * a.y), z);
1280 return Pt3((T)(x * a.x), (T)(y * a.y), (T)(z * a.z));
1288 return Pt3((T)(x * a.x), (T)(y * a.y), (T)(z * a.z));
1297 return Pt3((T)(x / a), (T)(y / a), (T)(z / a));
1305 return Pt3((T)(x / a.x), (T)(y / a.y), z);
1313 return Pt3((T)(x / a.x), (T)(y / a.y), (T)(z / a.z));
1321 return Pt3((T)(x / a.x), (T)(y / a.y), (T)(z / a.z));
1501 const T&
at(
unsigned int a)
const 1512 throw std::out_of_range(
"Pt3<T>::at(): error out of range");
1521 return const_cast<T&
>(
static_cast<const Pt3<T>&
>(*this).
at(a));
1531 template <
typename Archive>
1532 void serialize(Archive& archive,
const unsigned int version)
1596 Pt4(T a_x, T a_y, T a_z, T a_w)
1717 return (x == a && y == a && z == a && w == a);
1725 return (x == a.
x && y == a.
y);
1733 return (x == a.
x && y == a.
y && z == a.
z);
1741 return (x == a.
x && y == a.
y && z == a.
z && w == a.
w);
1750 return !(*
this == a);
1758 return !(*
this == a);
1766 return !(*
this == a);
1774 return !(*
this == a);
1813 inline bool operator<(const Pt2<U>& a)
const 1831 inline bool operator<(const Pt3<U>& a)
const 1856 inline bool operator<(const Pt4<U>& a)
const 1891 return (*
this < a || *
this == a);
1897 inline bool operator<=(const Pt2<U>& a)
const 1899 return (*
this < a || *
this == a);
1905 inline bool operator<=(const Pt3<U>& a)
const 1907 return (*
this < a || *
this == a);
1913 inline bool operator<=(const Pt4<U>& a)
const 1915 return (*
this < a || *
this == a);
1924 return !(*
this <= a);
1932 return !(*
this <= a);
1940 return !(*
this <= a);
1948 return !(*
this <= a);
1957 return (*
this > a || *
this == a);
1965 return (*
this > a || *
this == a);
1973 return (*
this > a || *
this == a);
1981 return (*
this > a || *
this == a);
1992 return Pt4((T)(x + a), (T)(y + a), (T)(z + a), (T)(w + a));
2000 return Pt4((T)(x + a.x), (T)(y + a.y), z, w);
2008 return Pt4((T)(x + a.x), (T)(y + a.y), (T)(z + a.z), w);
2016 return Pt4((T)(x + a.x), (T)(y + a.y), (T)(z + a.z), (T)(w + a.w));
2025 return Pt4((T)(x - a), (T)(y - a), (T)(z - a), (T)(w - a));
2033 return Pt4((T)(x - a.x), (T)(y - a.y), z, w);
2041 return Pt4((T)(x - a.x), (T)(y - a.y), (T)(z - a.z), w);
2049 return Pt4((T)(x - a.x), (T)(y - a.y), (T)(z - a.z), (T)(w - a.w));
2056 return Pt4((T)(-x), (T)(-y), (T)(-z), (T)(-w));
2065 return Pt4((T)(x * a), (T)(y * a), (T)(z * a), (T)(w * a));
2073 return Pt4((T)(x * a.x), (T)(y * a.y), z, w);
2081 return Pt4((T)(x * a.x), (T)(y * a.y), (T)(z * a.z), w);
2089 return Pt4((T)(x * a.x), (T)(y * a.y), (T)(z * a.z), (T)(w * a.w));
2098 return Pt4((T)(x / a), (T)(y / a), (T)(z / a), (T)(w / a));
2106 return Pt4((T)(x / a.x), (T)(y / a.y), z, w);
2114 return Pt4((T)(x / a.x), (T)(y / a.y), (T)(z / a.z), w);
2122 return Pt4((T)(x / a.x), (T)(y / a.y), (T)(z / a.z), (T)(w / a.w));
2284 void Set(T a_x, T a_y, T a_z, T a_w)
2313 const T&
at(
unsigned int a)
const 2326 throw std::out_of_range(
"Pt4<T>::at(): error out of range");
2335 return const_cast<T&
>(
static_cast<const Pt4<T>&
>(*this).
at(a));
2341 template <
typename Archive>
2342 void serialize(Archive& archive,
const unsigned int version)
2359 template <
class _From,
class _To>
2362 a_to.x =
static_cast<const typename _To::value_type
>(a_from.x);
2363 a_to.y =
static_cast<const typename _To::value_type
>(a_from.y);
2364 a_to.z =
static_cast<const typename _To::value_type
>(a_from.z);
2386 template <
typename T,
typename charT,
typename traits>
2387 inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& strm,
2393 std::basic_ostringstream<charT, traits> s;
2398 s << a_pt.
x <<
"," << a_pt.y;
2411 template <
typename T,
typename charT,
typename traits>
2412 inline std::basic_istream<charT, traits>&
operator>>(std::basic_istream<charT, traits>& strm,
2422 if (strm.peek() ==
',')
2429 y =
static_cast<T
>(0);
2449 template <
typename T,
typename charT,
typename traits>
2450 inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& strm,
2456 std::basic_ostringstream<charT, traits> s;
2461 s << a_pt.
x <<
"," << a_pt.y <<
"," << a_pt.z;
2474 template <
typename T,
typename charT,
typename traits>
2475 inline std::basic_istream<charT, traits>&
operator>>(std::basic_istream<charT, traits>& strm,
2485 if (strm.peek() ==
',')
2489 if (strm.peek() ==
',')
2496 z =
static_cast<T
>(0);
2501 y =
static_cast<T
>(0);
2502 z =
static_cast<T
>(0);
2522 template <
typename T,
typename charT,
typename traits>
2523 inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& strm,
2529 std::basic_ostringstream<charT, traits> s;
2534 s << a_pt.
x <<
"," << a_pt.y <<
"," << a_pt.z <<
"," << a_pt.w;
2547 template <
typename T,
typename charT,
typename traits>
2548 inline std::basic_istream<charT, traits>&
operator>>(std::basic_istream<charT, traits>& strm,
2558 if (strm.peek() ==
',')
2562 if (strm.peek() ==
',')
2566 if (strm.peek() ==
',')
2573 w =
static_cast<T
>(0);
2578 z =
static_cast<T
>(0);
2579 w =
static_cast<T
>(0);
2584 y =
static_cast<T
>(0);
2585 z =
static_cast<T
>(0);
2586 w =
static_cast<T
>(0);
bool operator==(const U &a) const
void operator*=(const Pt2< U > &a)
void serialize(Archive &archive, const unsigned int version)
For serialization.
Pt2 operator+(const Pt3< U > &a) const
bool operator>=(const U &a) const
const T & at(unsigned int a) const
bool operator==(const Pt3< U > &a) const
Pt2(const Pt2 &a)
copy construcor
void operator+=(const Pt3< U > &a)
bool operator>(const U &a) const
void operator-=(const Pt3< U > &a)
bool operator>=(const Pt2< U > &a) const
void operator*=(const Pt2< U > &a)
Include this small header instead of pt.h.
const Pt2 & operator=(const Pt4< U > &a)
Pt4 operator+(const U &a) const
void operator-=(const U &a)
void operator/=(const Pt2< U > &a)
bool operator>(const Pt4< U > &a) const
void serialize(Archive &archive, const unsigned int version)
For serialization.
Pt2 operator*(const Pt2< U > &a) const
Pt2 operator+(const Pt2< U > &a) const
bool operator!=(const U &a) const
bool operator>(const U &a) const
Pt3 operator+(const Pt3< U > &a) const
Pt4 operator+(const Pt2< U > &a) const
Pt4 operator*(const Pt3< U > &a) const
void operator/=(const U &a)
bool operator==(const U &a) const
Pt4 operator/(const U &a) const
Pt4 operator*(const Pt4< U > &a) const
Pt4(const Pt2< U > &a)
constructor. (Pt4<T>) Pt2<U>
T & operator[](unsigned int a)
const T & at(unsigned int a) const
bool operator!=(const U &a) const
bool operator==(const Pt4< U > &a) const
void Set(T a_x, T a_y, T a_z, T a_w)
Pt2 operator-(const U &a) const
Pt2 operator+(const Pt4< U > &a) const
bool operator<(const U &a) const
Pt4 operator/(const Pt2< U > &a) const
const T & at(unsigned int a) const
bool operator!=(const Pt2< U > &a) const
Pt4(const Pt4< U > &a)
constructor. (Pt4<T>) Pt4<U>
Pt4 operator-(const U &a) const
Pt4 operator-(const Pt3< U > &a) const
void operator-=(const Pt3< U > &a)
void operator+=(const Pt3< U > &a)
bool operator<(const U &a) const
void operator-=(const Pt2< U > &a)
void serialize(Archive &archive, const unsigned int version)
For serialization.
bool operator>(const Pt4< U > &a) const
Pt4 operator*(const U &a) const
void operator/=(const Pt4< U > &a)
const Pt4 & operator=(const Pt2< U > &a)
Pt3 operator*(const Pt4< U > &a) const
Pt4 operator+(const Pt4< U > &a) const
T operator[](unsigned int a) const
Pt2 operator*(const Pt3< U > &a) const
bool operator!=(const Pt2< U > &a) const
bool operator>(const Pt4< U > &a) const
const Pt2 & operator=(const U &a)
bool operator==(const Pt4< U > &a) const
bool operator>(const U &a) const
Pt2 operator-(const Pt2< U > &a) const
void operator+=(const Pt3< U > &a)
void operator*=(const U &a)
Pt2 operator/(const Pt4< U > &a) const
void operator/=(const Pt4< U > &a)
Pt4(const Pt3< U > &a)
constructor. (Pt4<T>) Pt3<U>
void operator/=(const Pt2< U > &a)
void operator*=(const Pt4< U > &a)
void operator+=(const Pt2< U > &a)
void operator-=(const Pt2< U > &a)
void operator/=(const U &a)
void operator*=(const Pt3< U > &a)
void operator+=(const Pt2< U > &a)
void operator+=(const Pt4< U > &a)
Pt2(const Pt2< U > &a)
constructor.
void operator*=(const Pt4< U > &a)
Pt2 operator*(const Pt4< U > &a) const
bool operator==(const Pt2< U > &a) const
void operator*=(const Pt3< U > &a)
void operator/=(const U &a)
Pt4 operator-(const Pt4< U > &a) const
bool operator<=(const U &a) const
Pt2 operator/(const U &a) const
Pt3 operator/(const Pt3< U > &a) const
bool operator>=(const Pt4< U > &a) const
Pt4 operator-(const Pt2< U > &a) const
~Pt2()
destructor. can't be virtual
Pt3 operator*(const Pt2< U > &a) const
bool operator>(const Pt3< U > &a) const
const Pt3 & operator=(const Pt4< U > &a)
bool operator!=(const Pt3< U > &a) const
bool operator!=(const Pt3< U > &a) const
void operator-=(const U &a)
void operator+=(const Pt4< U > &a)
void operator-=(const U &a)
Pt4 operator/(const Pt4< U > &a) const
Pt3(const Pt4< U > &a)
constructor.
bool operator==(const U &a) const
void operator-=(const Pt2< U > &a)
bool operator<(const U &a) const
~Pt4()
Destructor. can't be virtual.
void operator/=(const Pt3< U > &a)
void operator-=(const Pt3< U > &a)
bool operator>=(const Pt3< U > &a) const
bool operator>=(const Pt2< U > &a) const
bool operator==(const Pt3< U > &a) const
void operator*=(const Pt4< U > &a)
Pt2 operator/(const Pt3< U > &a) const
const Pt3 & operator=(const U &a)
Pt4 operator/(const Pt3< U > &a) const
void operator*=(const Pt2< U > &a)
bool operator!=(const Pt4< U > &a) const
bool operator>(const Pt3< U > &a) const
bool operator>=(const Pt3< U > &a) const
void operator/=(const Pt2< U > &a)
void operator+=(const U &a)
Pt3 operator/(const Pt2< U > &a) const
bool operator!=(const Pt3< U > &a) const
bool operator<=(const U &a) const
Pt4 operator+(const Pt3< U > &a) const
const Pt2 & operator=(const Pt3< U > &a)
void operator+=(const U &a)
bool operator>=(const Pt3< U > &a) const
bool operator>(const Pt2< U > &a) const
~Pt3()
destructor. can't be virtual
void Set(T a_x, T a_y, T a_z)
bool operator>=(const U &a) const
bool operator>(const Pt3< U > &a) const
void operator*=(const U &a)
Pt3 operator-(const Pt4< U > &a) const
T operator[](unsigned int a) const
bool operator<=(const U &a) const
bool operator>=(const Pt4< U > &a) const
bool operator>(const Pt2< U > &a) const
Pt3 operator-(const U &a) const
void operator*=(const U &a)
Pt2(const Pt3< U > &a)
constructor.
void operator-=(const Pt4< U > &a)
void operator+=(const U &a)
void operator-=(const Pt4< U > &a)
void operator/=(const Pt3< U > &a)
const Pt4 & operator=(const U &a)
bool operator>=(const Pt4< U > &a) const
Pt2 operator+(const U &a) const
const Pt4 & operator=(const Pt3< U > &a)
Pt2 operator-(const Pt4< U > &a) const
bool operator==(const Pt2< U > &a) const
Pt3 operator*(const U &a) const
bool operator!=(const U &a) const
Pt3(const Pt3< U > &a)
constructor.
_To & Pt3Convert(const _From &a_from, _To &a_to)
Convert from one Pt3 to another.
void operator/=(const Pt3< U > &a)
Pt3(const Pt2< U > &a)
constructor. Z is set to 0
T operator[](unsigned int a) const
Pt3 operator-(const Pt2< U > &a) const
bool operator==(const Pt2< U > &a) const
T & operator[](unsigned int a)
Pt2 operator*(const U &a) const
T & operator[](unsigned int a)
bool operator!=(const Pt4< U > &a) const
void operator+=(const Pt2< U > &a)
Pt3 operator*(const Pt3< U > &a) const
bool operator==(const Pt3< U > &a) const
const Pt2 & operator=(const Pt2< U > &a)
Pt2(const Pt4< U > &a)
constructor.
bool operator>(const Pt2< U > &a) const
const Pt4 & operator=(const Pt4< U > &a)
void operator/=(const Pt4< U > &a)
bool operator==(const Pt4< U > &a) const
bool operator>=(const U &a) const
Pt3(T a_x, T a_y)
constructor. Z is set to 0.0.
void operator*=(const Pt3< U > &a)
Pt2(const T &a)
constructor
const Pt3 & operator=(const Pt3< U > &a)
Pt2 operator-(const Pt3< U > &a) const
Pt2 operator/(const Pt2< U > &a) const
Pt3 operator+(const Pt4< U > &a) const
Pt3 operator/(const Pt4< U > &a) const
Pt3 operator+(const Pt2< U > &a) const
Pt3 operator-(const Pt3< U > &a) const
const Pt3 & operator=(const Pt2< U > &a)
Pt3 operator/(const U &a) const
void operator+=(const Pt4< U > &a)
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &strm, Pt2< T > &a_pt)
operator>>
bool operator!=(const Pt4< U > &a) const
Pt4 operator*(const Pt2< U > &a) const
bool operator!=(const Pt2< U > &a) const
Pt3 operator+(const U &a) const
bool operator>=(const Pt2< U > &a) const
void operator-=(const Pt4< U > &a)