OgreHapticsForceOutput.h

Go to the documentation of this file.
00001 /*
00002 This source file is part of OgreHaptics
00003  (a library for wrapping haptics devices for use with the open-source
00004  graphics engine OGRE, http://www.ogre3d.org)
00005 
00006 Copyright (c) 2006 - 2008 Jorrit de Vries
00007 Also see acknowledgements in Readme.html
00008 
00009 This library is free software; you can redistribute it and/or
00010 modify it under the terms of the GNU Lesser General Public License
00011 as published by the Free Software Foundation; either version 2.1
00012 of the License, or (at your option) any later version.
00013 
00014 This library is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00017 GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public
00020 License along with this library; if not, write to the
00021 Free Software Foundation, Inc.,
00022 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
00023 */
00024 #ifndef _OgreHapticsForceOutput_H__
00025 #define _OgreHapticsForceOutput_H__
00026 
00027 #include "OgreHapticsPrerequisites.h"
00028 
00029 namespace OgreHaptics {
00030 
00038     class _OgreHapticsExport ForceOutput
00039     {
00040     public:
00042         ForceOutput()
00043             : force(Vector3::ZERO),
00044             torque(Vector3::ZERO)
00045         {
00046         }
00052         ForceOutput(const Vector3& f, const Vector3& t)
00053             : force(f),
00054             torque(t)
00055         {
00056         }
00058         virtual ~ForceOutput() {}
00059 
00061         inline ForceOutput& operator = (const ForceOutput& rhs)
00062         {
00063             force = rhs.force;
00064             torque = rhs.torque;
00065             return *this;
00066         }
00067 
00068         // Arithmetic operations
00069         inline ForceOutput operator + (const ForceOutput& rhs)
00070         {
00071             return ForceOutput(force + rhs.force, torque + rhs.torque);
00072         }
00073 
00074         inline ForceOutput operator * (const Real scalar)
00075         {
00076             return ForceOutput(force * scalar, torque * scalar);
00077         }
00078 
00079         // Arithmetic updates
00080         inline ForceOutput& operator += (const ForceOutput& rhs)
00081         {
00082             force += rhs.force;
00083             torque += rhs.torque;
00084             return *this;
00085         }
00086 
00087         inline ForceOutput& operator *= (const Real scalar)
00088         {
00089             force *= scalar;
00090             torque *= scalar;
00091             return *this;
00092         }
00093 
00094         // Overloaded operator to help ForceOutput
00095         inline friend ForceOutput operator * (
00096             const ForceOutput& lhs, const Real scalar)
00097         {
00098             return ForceOutput(scalar * lhs.force, scalar * lhs.force);
00099         }
00100 
00102         inline void clear(void)
00103         {
00104             force = Vector3::ZERO;
00105             torque = Vector3::ZERO;
00106         }
00107 
00109         Vector3 force;
00111         Vector3 torque;
00112     };
00113 
00114 }
00115 
00116 #endif

Last modified Tue Jan 6 22:31:25 2009