Blender V2.61 - r43446

MT_Point2.inl

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