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 Point3::Point3() {}
00025
00026 inline
00027 Point3::Point3(Real r) :
00028 m_x(r),
00029 m_y(r),
00030 m_z(r) {}
00031
00032 inline
00033 Point3::Point3(const Point3 &p) :
00034 m_x(p.m_x),
00035 m_y(p.m_y),
00036 m_z(p.m_z) {}
00037
00038 inline
00039 Point3::Point3(const Vector3 &v) :
00040 m_x(v.m_x),
00041 m_y(v.m_y),
00042 m_z(v.m_z) {}
00043
00044 inline
00045 Point3::operator Vector3() const {
00046 return Vector3(m_x, m_y, m_z);
00047 }
00048
00049 inline
00050 Point3::Point3(Real x, Real y, Real z) :
00051 m_x(x),
00052 m_y(y),
00053 m_z(z) {}
00054
00055 inline
00056 Point3 &Point3::operator=(Real rhs) {
00057 m_x = m_y = m_z = rhs;
00058
00059 return *this;
00060 }
00061
00062 inline
00063 Point3 &Point3::operator=(const Point3 &rhs) {
00064 m_x = rhs.m_x;
00065 m_y = rhs.m_y;
00066 m_z = rhs.m_z;
00067
00068 return *this;
00069 }
00070
00071 inline
00072 Real &Point3::operator[](int i) {
00073 assert(i >= 0 && i < 3);
00074
00075 return *(&m_x + i);
00076 }
00077
00078 inline
00079 Point3 &operator+=(Point3 &lhs, const Point3 &rhs) {
00080 lhs.m_x += rhs.m_x;
00081 lhs.m_y += rhs.m_y;
00082 lhs.m_z += rhs.m_z;
00083
00084 return lhs;
00085 }
00086
00087 inline
00088 Point3 &operator-=(Point3 &lhs, const Point3 &rhs) {
00089 lhs.m_x -= rhs.m_x;
00090 lhs.m_y -= rhs.m_y;
00091 lhs.m_z -= rhs.m_z;
00092
00093 return lhs;
00094 }
00095
00096 inline
00097 Point3 &operator*=(Point3 &lhs, Real rhs) {
00098 lhs.m_x *= rhs;
00099 lhs.m_y *= rhs;
00100 lhs.m_z *= rhs;
00101
00102 return lhs;
00103 }
00104
00105 inline
00106 Point3 &operator/=(Point3 &lhs, Real rhs) {
00107 Real inv_rhs = 1.0 / rhs;
00108
00109 lhs.m_x *= inv_rhs;
00110 lhs.m_y *= inv_rhs;
00111 lhs.m_z *= inv_rhs;
00112
00113 return lhs;
00114 }