Blender V2.61 - r43446

MT_Point3.inl

Go to the documentation of this file.
00001 #include "MT_Optimize.h"
00002 
00003 GEN_INLINE MT_Point3& MT_Point3::operator+=(const MT_Vector3& v) {
00004     m_co[0] += v[0]; m_co[1] += v[1]; m_co[2] += v[2];
00005     return *this;
00006 }
00007 
00008 GEN_INLINE MT_Point3& MT_Point3::operator-=(const MT_Vector3& v) {
00009     m_co[0] -= v[0]; m_co[1] -= v[1]; m_co[2] -= v[2];
00010     return *this;
00011 }
00012 
00013 GEN_INLINE MT_Point3& MT_Point3::operator=(const MT_Vector3& v) {
00014     m_co[0] = v[0]; m_co[1] = v[1]; m_co[2] = v[2];
00015     return *this;
00016 }
00017 
00018 GEN_INLINE MT_Point3& MT_Point3::operator=(const MT_Point3& v) {
00019     m_co[0] = v[0]; m_co[1] = v[1]; m_co[2] = v[2];
00020     return *this;
00021 }
00022 
00023 GEN_INLINE MT_Scalar MT_Point3::distance(const MT_Point3& p) const {
00024     return (p - *this).length();
00025 }
00026 
00027 GEN_INLINE MT_Scalar MT_Point3::distance2(const MT_Point3& p) const {
00028     return (p - *this).length2();
00029 }
00030 
00031 GEN_INLINE MT_Point3 MT_Point3::lerp(const MT_Point3& p, MT_Scalar t) const {
00032     return MT_Point3(m_co[0] + (p[0] - m_co[0]) * t,
00033                      m_co[1] + (p[1] - m_co[1]) * t,
00034                      m_co[2] + (p[2] - m_co[2]) * t);
00035 }
00036 
00037 GEN_INLINE MT_Point3  operator+(const MT_Point3& p, const MT_Vector3& v) {
00038     return MT_Point3(p[0] + v[0], p[1] + v[1], p[2] + v[2]);
00039 }
00040 
00041 GEN_INLINE MT_Point3  operator-(const MT_Point3& p, const MT_Vector3& v) {
00042     return MT_Point3(p[0] - v[0], p[1] - v[1], p[2] - v[2]);
00043 }
00044 
00045 GEN_INLINE MT_Vector3 operator-(const MT_Point3& p1, const MT_Point3& p2) {
00046     return MT_Vector3(p1[0] - p2[0], p1[1] - p2[1], p1[2] - p2[2]);
00047 }
00048 
00049 GEN_INLINE MT_Scalar MT_distance(const MT_Point3& p1, const MT_Point3& p2) { 
00050     return p1.distance(p2); 
00051 }
00052 
00053 GEN_INLINE MT_Scalar MT_distance2(const MT_Point3& p1, const MT_Point3& p2) { 
00054     return p1.distance2(p2); 
00055 }
00056 
00057 GEN_INLINE MT_Point3 MT_lerp(const MT_Point3& p1, const MT_Point3& p2, MT_Scalar t) {
00058     return p1.lerp(p2, t);
00059 }