PxD6Joint.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-2018 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 #ifndef PX_D6JOINT_H
00031 #define PX_D6JOINT_H
00032 
00036 #include "extensions/PxJoint.h"
00037 #include "extensions/PxJointLimit.h"
00038 #include "foundation/PxFlags.h"
00039 
00040 #if !PX_DOXYGEN
00041 namespace physx
00042 {
00043 #endif
00044 
00045 class PxD6Joint;
00046 
00058 PxD6Joint*  PxD6JointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1);
00059 
00065 struct PxD6Axis
00066 {
00067     enum Enum
00068     {
00069         eX      = 0,    
00070         eY      = 1,    
00071         eZ      = 2,    
00072         eTWIST  = 3,    
00073         eSWING1 = 4,    
00074         eSWING2 = 5,    
00075         eCOUNT  = 6
00076     };
00077 };
00078 
00079 
00085 struct PxD6Motion
00086 {
00087     enum Enum
00088     {
00089         eLOCKED,    
00090         eLIMITED,   
00091         eFREE       
00092     };
00093 };
00094 
00095 
00111 struct PxD6Drive
00112 {
00113     enum Enum
00114     {
00115         eX          = 0,    
00116         eY          = 1,    
00117         eZ          = 2,    
00118         eSWING      = 3,    
00119         eTWIST      = 4,    
00120         eSLERP      = 5,    
00121         eCOUNT      = 6
00122     };
00123 };
00124 
00130 struct PxD6JointDriveFlag
00131 {
00132     enum Enum
00133     {
00134         eACCELERATION   = 1 
00135     };
00136 };
00137 typedef PxFlags<PxD6JointDriveFlag::Enum, PxU32> PxD6JointDriveFlags;
00138 PX_FLAGS_OPERATORS(PxD6JointDriveFlag::Enum, PxU32)
00139 
00140 
00145 class PxD6JointDrive : public PxSpring
00146 {
00147 //= ATTENTION! =====================================================================================
00148 // Changing the data layout of this class breaks the binary serialization format.  See comments for 
00149 // PX_BINARY_SERIAL_VERSION.  If a modification is required, please adjust the getBinaryMetaData 
00150 // function.  If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
00151 // accordingly.
00152 //==================================================================================================
00153 
00154 public:
00155     PxReal                  forceLimit;         
00156     PxD6JointDriveFlags     flags;              
00157 
00161     PxD6JointDrive(): PxSpring(0,0), forceLimit(PX_MAX_F32), flags(0) {}
00162 
00171     PxD6JointDrive(PxReal driveStiffness, PxReal driveDamping, PxReal driveForceLimit, bool isAcceleration = false)
00172     : PxSpring(driveStiffness, driveDamping)
00173     , forceLimit(driveForceLimit)
00174     , flags(isAcceleration?PxU32(PxD6JointDriveFlag::eACCELERATION) : 0) 
00175     {}
00176 
00180     bool isValid() const
00181     {
00182         return PxIsFinite(stiffness) && stiffness>=0 &&
00183                PxIsFinite(damping) && damping >=0 &&
00184                PxIsFinite(forceLimit) && forceLimit >=0;
00185     }
00186 };
00187 
00188 
00224 class PxD6Joint : public PxJoint
00225 {
00226 public:
00227 
00241     virtual void                setMotion(PxD6Axis::Enum axis, PxD6Motion::Enum type)   = 0;
00242 
00251     virtual PxD6Motion::Enum    getMotion(PxD6Axis::Enum axis)  const   = 0;
00252 
00256     virtual PxReal              getTwistAngle() const   = 0;
00257 
00261     PX_DEPRECATED   PX_FORCE_INLINE PxReal              getTwist()  const   { return getTwistAngle();   }
00262 
00266     virtual PxReal              getSwingYAngle()    const   = 0;
00267 
00271     virtual PxReal              getSwingZAngle()    const   = 0;
00272 
00284     virtual void                setDistanceLimit(const PxJointLinearLimit& limit)   = 0;
00285 
00293     virtual PxJointLinearLimit  getDistanceLimit()  const   = 0;
00294 
00295     PX_DEPRECATED   PX_FORCE_INLINE void                setLinearLimit(const PxJointLinearLimit& limit) { setDistanceLimit(limit);      }
00296     PX_DEPRECATED   PX_FORCE_INLINE PxJointLinearLimit  getLinearLimit()    const                       { return getDistanceLimit();    }
00297 
00313     virtual void                    setLinearLimit(PxD6Axis::Enum axis, const PxJointLinearLimitPair& limit)    = 0;
00314 
00324     virtual PxJointLinearLimitPair  getLinearLimit(PxD6Axis::Enum axis) const   = 0;
00325 
00337     virtual void                setTwistLimit(const PxJointAngularLimitPair& limit) = 0;
00338 
00346     virtual PxJointAngularLimitPair getTwistLimit() const   = 0;
00347 
00359     virtual void                setSwingLimit(const PxJointLimitCone& limit)    = 0;
00360 
00368     virtual PxJointLimitCone    getSwingLimit() const   = 0;
00369 
00383     virtual void                setPyramidSwingLimit(const PxJointLimitPyramid& limit)  = 0;
00384 
00392     virtual PxJointLimitPyramid getPyramidSwingLimit()  const   = 0;
00393 
00404     virtual void                setDrive(PxD6Drive::Enum index, const PxD6JointDrive& drive)    = 0;
00405 
00413     virtual PxD6JointDrive      getDrive(PxD6Drive::Enum index) const   = 0;
00414 
00427     virtual void                setDrivePosition(const PxTransform& pose, bool autowake = true) = 0;
00428 
00434     virtual PxTransform         getDrivePosition()  const   = 0;
00435 
00447     virtual void                setDriveVelocity(const PxVec3& linear, const PxVec3& angular, bool autowake = true) = 0;
00448 
00457     virtual void                getDriveVelocity(PxVec3& linear, PxVec3& angular)   const   = 0;
00458     
00477     virtual void                setProjectionLinearTolerance(PxReal tolerance)  = 0;
00478 
00486     virtual PxReal              getProjectionLinearTolerance()  const   = 0;
00487 
00509     virtual void                setProjectionAngularTolerance(PxReal tolerance) = 0;
00510 
00518     virtual PxReal              getProjectionAngularTolerance() const   = 0;
00519 
00523     virtual const char*         getConcreteTypeName() const { return "PxD6Joint"; }
00524 
00525 protected:
00526 
00527     //serialization
00528 
00532     PX_INLINE                   PxD6Joint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {}
00533 
00537     PX_INLINE                   PxD6Joint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {}
00538 
00542     virtual bool                isKindOf(const char* name) const { return !::strcmp("PxD6Joint", name) || PxJoint::isKindOf(name); }
00543 
00544     //~serialization
00545 };
00546 
00547 #if !PX_DOXYGEN
00548 } // namespace physx
00549 #endif
00550 
00552 #endif


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