00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 inline
00024 Point2::Point2() {}
00025
00026 inline
00027 Point2::Point2(Real r) :
00028 m_x(r),
00029 m_y(r) {}
00030
00031 inline
00032 Point2::Point2(const Point2 &p) :
00033 m_x(p.m_x),
00034 m_y(p.m_y) {}
00035
00036 inline
00037 Point2::Point2(const Vector2 &v) :
00038 m_x(v.m_x),
00039 m_y(v.m_y) {}
00040
00041 inline
00042 Point2::operator Vector2() const {
00043 return Vector2(m_x, m_y);
00044 }
00045
00046 inline
00047 Point2::Point2(Real x, Real y) :
00048 m_x(x),
00049 m_y(y) {}
00050
00051 inline
00052 Point2 &Point2::operator=(Real rhs) {
00053 m_x = m_y = rhs;
00054
00055 return *this;
00056 }
00057
00058 inline
00059 Point2 &Point2::operator=(const Point2 &rhs) {
00060 m_x = rhs.m_x;
00061 m_y = rhs.m_y;
00062
00063 return *this;
00064 }
00065
00066 inline
00067 Real &Point2::operator[](int i) {
00068 assert(i == 0 || i == 1);
00069
00070 return *(&m_x + i);
00071 }
00072
00073 inline
00074 Point2 &operator+=(Point2 &lhs, const Point2 &rhs) {
00075 lhs.m_x += rhs.m_x;
00076 lhs.m_y += rhs.m_y;
00077
00078 return lhs;
00079 }
00080
00081 inline
00082 Point2 &operator-=(Point2 &lhs, const Point2 &rhs) {
00083 lhs.m_x -= rhs.m_x;
00084 lhs.m_y -= rhs.m_y;
00085
00086 return lhs;
00087 }
00088
00089 inline
00090 Point2 &operator*=(Point2 &lhs, Real rhs) {
00091 lhs.m_x *= rhs;
00092 lhs.m_y *= rhs;
00093
00094 return lhs;
00095 }
00096
00097 inline
00098 Point2 &operator/=(Point2 &lhs, Real rhs) {
00099 lhs.m_x /= rhs;
00100 lhs.m_y /= rhs;
00101
00102 return lhs;
00103 }