PixelLightAPI  .
JointUniversal.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: JointUniversal.h                               *
00003  *
00004  *  Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight 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 Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLPHYSICS_JOINTUNIVERSAL_H__
00024 #define __PLPHYSICS_JOINTUNIVERSAL_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLMath/Vector3.h>
00032 #include "PLPhysics/Joint.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Namespace                                             ]
00037 //[-------------------------------------------------------]
00038 namespace PLPhysics {
00039 
00040 
00041 //[-------------------------------------------------------]
00042 //[ Classes                                               ]
00043 //[-------------------------------------------------------]
00044 /**
00045 *  @brief
00046 *    Abstract PL physics universal joint
00047 *
00048 *  @remarks
00049 *    A universal joint is a constraint that restricts two rigid bodies to be connected to a point
00050 *    fixed on both bodies, while and allowing one body to spin around a fix axis in is own frame,
00051 *    and the other body to spin around another axis fixes on it own frame. Both axis must be
00052 *    mutually perpendicular.
00053 *
00054 *    DOFs removed: 2 DOFs remaining: 4
00055 */
00056 class JointUniversal : public Joint {
00057 
00058 
00059     //[-------------------------------------------------------]
00060     //[ Public functions                                      ]
00061     //[-------------------------------------------------------]
00062     public:
00063         /**
00064         *  @brief
00065         *    Destructor
00066         */
00067         PLPHYSICS_API virtual ~JointUniversal();
00068 
00069         /**
00070         *  @brief
00071         *    Returns the origin of the universal in world space
00072         *
00073         *  @return
00074         *    The origin of the universal in world space
00075         */
00076         PLPHYSICS_API const PLMath::Vector3 &GetPivotPoint() const;
00077 
00078         /**
00079         *  @brief
00080         *    Returns the first axis of rotation fixed on THIS body and perpendicular to 'PinDir2' in world space
00081         *
00082         *  @return
00083         *    The first axis of rotation fixed on THIS body and perpendicular to 'PinDir2' in world space
00084         */
00085         PLPHYSICS_API const PLMath::Vector3 &GetPinDir1() const;
00086 
00087         /**
00088         *  @brief
00089         *    Returns the second axis of rotation fixed on 'Parent' body and perpendicular to 'PinDir1' in world space
00090         *
00091         *  @return
00092         *    The second axis of rotation fixed on 'Parent' body and perpendicular to 'PinDir1' in world space
00093         */
00094         PLPHYSICS_API const PLMath::Vector3 &GetPinDir2() const;
00095 
00096         /**
00097         *  @brief
00098         *    Returns the low range of the first axis
00099         *
00100         *  @return
00101         *    The low range of the first axis in degree
00102         */
00103         PLPHYSICS_API float GetLowRange1() const;
00104 
00105         /**
00106         *  @brief
00107         *    Sets the low range of the first axis
00108         *
00109         *  @param[in] fLowRange
00110         *    New low range of the first axis in degree
00111         */
00112         PLPHYSICS_API void SetLowRange1(float fLowRange = -180.0f);
00113 
00114         /**
00115         *  @brief
00116         *    Returns the high range of the first axis
00117         *
00118         *  @return
00119         *    The high range of the first axis in degree
00120         */
00121         PLPHYSICS_API float GetHighRange1() const;
00122 
00123         /**
00124         *  @brief
00125         *    Sets the high range of the first axis
00126         *
00127         *  @param[in] fHighRange
00128         *    New high range of the first axis in degree
00129         */
00130         PLPHYSICS_API void SetHighRange1(float fHighRange = 180.0f);
00131 
00132         /**
00133         *  @brief
00134         *    Returns the low range of the second axis
00135         *
00136         *  @return
00137         *    The low range of the second axis in degree
00138         */
00139         PLPHYSICS_API float GetLowRange2() const;
00140 
00141         /**
00142         *  @brief
00143         *    Sets the low range of the second axis
00144         *
00145         *  @param[in] fLowRange
00146         *    New low range of the second axis in degree
00147         */
00148         PLPHYSICS_API void SetLowRange2(float fLowRange = -180.0f);
00149 
00150         /**
00151         *  @brief
00152         *    Returns the high range of the second axis
00153         *
00154         *  @return
00155         *    The high range of the second axis in degree
00156         */
00157         PLPHYSICS_API float GetHighRange2() const;
00158 
00159         /**
00160         *  @brief
00161         *    Sets the high range of the second axis
00162         *
00163         *  @param[in] fHighRange
00164         *    New high range of the second axis in degree
00165         */
00166         PLPHYSICS_API void SetHighRange2(float fHighRange = 180.0f);
00167 
00168 
00169     //[-------------------------------------------------------]
00170     //[ Public virtual JointUniversal functions               ]
00171     //[-------------------------------------------------------]
00172     public:
00173         /**
00174         *  @brief
00175         *    Adds omega to the bodies assigned with this joint
00176         *
00177         *  @param[in] fOmega1
00178         *    Omega 1 to add
00179         *  @param[in] fOmega2
00180         *    Omega 2 to add
00181         */
00182         virtual void AddOmega(float fOmega1, float fOmega2) = 0;
00183 
00184 
00185     //[-------------------------------------------------------]
00186     //[ Protected functions                                   ]
00187     //[-------------------------------------------------------]
00188     protected:
00189         /**
00190         *  @brief
00191         *    Constructor
00192         *
00193         *  @param[in] cWorld
00194         *    World this joint is in
00195         *  @param[in] cJointImpl
00196         *    Reference to the physics API specific joint implementation
00197         *  @param[in] pParentBody
00198         *    Pointer to the parent rigid body, can be a null pointer
00199         *  @param[in] pChildBody
00200         *    Pointer to the attached rigid body, can be a null pointer
00201         *  @param[in] vPivotPoint
00202         *    Origin of the universal in world space
00203         *  @param[in] vPinDir1
00204         *    First axis of rotation fixed on THIS body and perpendicular to 'PinDir2' in world space
00205         *  @param[in] vPinDir2
00206         *    Second axis of rotation fixed on 'Parent' body and perpendicular to 'PinDir1' in world space
00207         */
00208         PLPHYSICS_API JointUniversal(World &cWorld, JointImpl &cJointImpl, Body *pParentBody, Body *pChildBody, const PLMath::Vector3 &vPivotPoint,
00209                                      const PLMath::Vector3 &vPinDir1, const PLMath::Vector3 &vPinDir2);
00210 
00211 
00212     //[-------------------------------------------------------]
00213     //[ Protected data                                        ]
00214     //[-------------------------------------------------------]
00215     protected:
00216         PLMath::Vector3 m_vPivotPoint;  /**< Origin of the universal in world space */
00217         PLMath::Vector3 m_vPinDir1;     /**< First axis of rotation fixed on THIS body and perpendicular to 'PinDir2' in world space */
00218         PLMath::Vector3 m_vPinDir2;     /**< Second axis of rotation fixed on 'Parent' body and perpendicular to 'PinDir1' in world space */
00219 
00220 
00221     //[-------------------------------------------------------]
00222     //[ Private data                                          ]
00223     //[-------------------------------------------------------]
00224     private:
00225         float m_fLowRange1;     /**< Low range of the first axis in degree */
00226         float m_fHighRange1;    /**< High range of the first axis  in degree */
00227         float m_fLowRange2;     /**< Low range of the second axis in degree */
00228         float m_fHighRange2;    /**< High range of the second axis  in degree */
00229 
00230 
00231 };
00232 
00233 
00234 //[-------------------------------------------------------]
00235 //[ Namespace                                             ]
00236 //[-------------------------------------------------------]
00237 } // PLPhysics
00238 
00239 
00240 #endif // __PLPHYSICS_JOINTUNIVERSAL_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:50:57
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported