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

point2.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 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 }

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