Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

point3.inl

Go to the documentation of this file.
00001 /*
00002     Sheep - A Rigid Body Dynamics Engine
00003     Copyright (C) 2001-2004 Francois Beaune
00004     Contact: http://toxicengine.sourceforge.net/
00005 
00006     This file is part of Sheep.
00007 
00008     Sheep is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     Sheep is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with Sheep; if not, write to the Free Software
00020     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 }

Generated on Tue May 11 01:31:51 2004 for toxic by doxygen 1.3.6