PhysX SDK 3.2 API Reference: PxJointLimit.h Source File

PhysX SDK 3.2 API

PxJointLimit.h

Go to the documentation of this file.
00001 // This code contains NVIDIA Confidential Information and is disclosed to you 
00002 // under a form of NVIDIA software license agreement provided separately to you.
00003 //
00004 // Notice
00005 // NVIDIA Corporation and its licensors retain all intellectual property and
00006 // proprietary rights in and to this software and related documentation and 
00007 // any modifications thereto. Any use, reproduction, disclosure, or 
00008 // distribution of this software and related documentation without an express 
00009 // license agreement from NVIDIA Corporation is strictly prohibited.
00010 // 
00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
00015 //
00016 // Information and code furnished is believed to be accurate and reliable.
00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
00018 // information or for any infringement of patents or other rights of third parties that may
00019 // result from its use. No license is granted by implication or otherwise under any patent
00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
00021 // This code supersedes and replaces all information previously supplied.
00022 // NVIDIA Corporation products are not authorized for use as critical
00023 // components in life support devices or systems without express written approval of
00024 // NVIDIA Corporation.
00025 //
00026 // Copyright (c) 2008-2012 NVIDIA Corporation. All rights reserved.
00027 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
00028 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.  
00029 
00030 
00031 #ifndef PX_EXTENSIONS_JOINT_LIMIT
00032 #define PX_EXTENSIONS_JOINT_LIMIT
00033 
00037 #include "foundation/PxMath.h"
00038 #include "PxPhysX.h"
00039 
00040 #ifndef PX_DOXYGEN
00041 namespace physx
00042 {
00043 #endif
00044 
00054 class PxJointLimitParameters
00055 {
00056 public:
00077     PxReal restitution;
00078 
00085     PxReal spring;
00086 
00093     PxReal damping;
00094 
00111     PxReal contactDistance;
00112 
00113 
00114 
00115     PxJointLimitParameters()
00116     : restitution(0)
00117     , spring(0)
00118     , damping(0)
00119     , contactDistance(0)
00120     {
00121     }   
00122 
00128     PX_INLINE bool isValid() const
00129     {
00130         return  PxIsFinite(restitution) && restitution >= 0 && restitution <= 1 && 
00131                 PxIsFinite(spring) && spring >= 0 && 
00132                 PxIsFinite(damping) && damping >= 0 &&
00133                 PxIsFinite(contactDistance);
00134     }
00135 
00136 protected:
00137     ~PxJointLimitParameters() {}
00138 };
00139 
00140 
00147 class PxJointLimit : public PxJointLimitParameters
00148 {
00149 public:
00156     PxReal value;
00157 
00166     PxJointLimit(PxReal limitValue, PxReal limitContactDistance)
00167     : value(limitValue)
00168     {
00169         contactDistance = limitContactDistance;
00170     }
00171 
00172 
00178     PX_INLINE bool isValid() const
00179     {
00180         return PxJointLimitParameters::isValid() &&
00181                PxIsFinite(value);
00182     }
00183 };
00184 
00185 
00193 class PxJointLimitPair : public PxJointLimitParameters
00194 {
00195 public:
00205     PxReal upper, lower;
00206 
00207 
00220     PxJointLimitPair(PxReal lowerLimit, PxReal upperLimit, PxReal limitContactDistance)
00221     : upper(upperLimit)
00222     , lower(lowerLimit)
00223     {
00224         contactDistance = limitContactDistance;
00225     }
00226 
00232     PX_INLINE bool isValid() const
00233     {
00234         return PxJointLimitParameters::isValid() &&
00235                PxIsFinite(upper) && PxIsFinite(lower) && upper >= lower &&
00236                PxIsFinite(contactDistance) && contactDistance <= upper - lower;
00237     }
00238 };
00239 
00240 
00241 
00242 
00252 class PxJointLimitCone : public PxJointLimitParameters
00253 {
00254 public:
00262     PxReal yAngle;
00263 
00264 
00272     PxReal zAngle;
00273 
00285     PxJointLimitCone(PxReal yLimitAngle, PxReal zLimitAngle, PxReal limitContactDistance):
00286       yAngle(yLimitAngle),
00287       zAngle(zLimitAngle)
00288       {
00289           contactDistance = limitContactDistance;
00290       }
00291 
00297     PX_INLINE bool isValid() const
00298     {
00299         return PxJointLimitParameters::isValid() &&
00300                PxIsFinite(yAngle) && yAngle>0 && yAngle<PxPi && 
00301                PxIsFinite(zAngle) && zAngle>0 && zAngle<PxPi;
00302     }
00303 };
00304 
00305 #ifndef PX_DOXYGEN
00306 } // namespace physx
00307 #endif
00308 
00310 #endif


Copyright © 2008-2012 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com