NVIDIA(R) PhysX(R) SDK 3.4 API Reference: PxD6Joint.h Source File

NVIDIA PhysX SDK 3.4 API

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-2017 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_D6JOINT_H
00032 #define PX_D6JOINT_H
00033 
00037 #include "extensions/PxJoint.h"
00038 #include "extensions/PxJointLimit.h"
00039 #include "foundation/PxFlags.h"
00040 
00041 #if !PX_DOXYGEN
00042 namespace physx
00043 {
00044 #endif
00045 
00046 class PxD6Joint;
00047 
00060 PxD6Joint*          PxD6JointCreate(PxPhysics& physics, 
00061                                     PxRigidActor* actor0, const PxTransform& localFrame0, 
00062                                     PxRigidActor* actor1, const PxTransform& localFrame1);
00063 
00064 
00065 
00066 
00073 struct PxD6Axis
00074 {
00075     enum Enum
00076     {
00077         eX      = 0,    
00078         eY      = 1,    
00079         eZ      = 2,    
00080         eTWIST  = 3,    
00081         eSWING1 = 4,    
00082         eSWING2 = 5,    
00083         eCOUNT  = 6
00084     };
00085 };
00086 
00087 
00093 struct PxD6Motion
00094 {
00095     enum Enum
00096     {
00097         eLOCKED,    
00098         eLIMITED,   
00099         eFREE       
00100     };
00101 };
00102 
00103 
00120 struct PxD6Drive
00121 {
00122     enum Enum
00123     {
00124         eX          = 0,        
00125         eY          = 1,        
00126         eZ          = 2,        
00127         eSWING      = 3,        
00128         eTWIST      = 4,        
00129         eSLERP      = 5,        
00130         eCOUNT      = 6
00131     };
00132 };
00133 
00140 struct PxD6JointDriveFlag
00141 {
00142     enum Enum
00143     {
00144         eACCELERATION   = 1 
00145     };
00146 };
00147 typedef PxFlags<PxD6JointDriveFlag::Enum, PxU32> PxD6JointDriveFlags;
00148 PX_FLAGS_OPERATORS(PxD6JointDriveFlag::Enum, PxU32)
00149 
00150 
00151 
00157 class PxD6JointDrive : public PxSpring
00158 {
00159 //= ATTENTION! =====================================================================================
00160 // Changing the data layout of this class breaks the binary serialization format.  See comments for 
00161 // PX_BINARY_SERIAL_VERSION.  If a modification is required, please adjust the getBinaryMetaData 
00162 // function.  If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
00163 // accordingly.
00164 //==================================================================================================
00165 
00166 public:
00167     PxReal                  forceLimit;         
00168     PxD6JointDriveFlags     flags;              
00169 
00170 
00175     PxD6JointDrive(): PxSpring(0,0), forceLimit(PX_MAX_F32), flags(0) {}
00176 
00187     PxD6JointDrive(PxReal driveStiffness, PxReal driveDamping, PxReal driveForceLimit, bool isAcceleration = false)
00188     : PxSpring(driveStiffness, driveDamping)
00189     , forceLimit(driveForceLimit)
00190     , flags(isAcceleration?PxU32(PxD6JointDriveFlag::eACCELERATION) : 0) 
00191     {}
00192 
00197     bool isValid() const
00198     {
00199         return PxIsFinite(stiffness) && stiffness>=0 &&
00200                PxIsFinite(damping) && damping >=0 &&
00201                PxIsFinite(forceLimit) && forceLimit >=0;
00202     }
00203 };
00204 
00205 
00238 class PxD6Joint : public PxJoint
00239 {
00240 public:
00241 
00256     virtual void                setMotion(PxD6Axis::Enum axis, PxD6Motion::Enum type)           = 0;
00257 
00268     virtual PxD6Motion::Enum    getMotion(PxD6Axis::Enum axis)          const                   = 0;
00269 
00274     virtual PxReal              getTwist()                              const                   = 0;
00275 
00280     virtual PxReal              getSwingYAngle()                        const                   = 0;
00281 
00286     virtual PxReal              getSwingZAngle()                        const                   = 0;
00287 
00288 
00299     virtual void                setLinearLimit(const PxJointLinearLimit& limit)                     = 0;
00300 
00309     virtual PxJointLinearLimit  getLinearLimit()                        const                   = 0;
00310 
00311 
00323     virtual void                setTwistLimit(const PxJointAngularLimitPair& limit)             = 0;
00324 
00325 
00333     virtual PxJointAngularLimitPair getTwistLimit()                         const                   = 0;
00334 
00346     virtual void                setSwingLimit(const PxJointLimitCone& limit)                        = 0;
00347 
00355     virtual PxJointLimitCone    getSwingLimit()                         const                   = 0;
00356 
00368     virtual void                setDrive(PxD6Drive::Enum index, const PxD6JointDrive& drive)        = 0;
00369 
00377     virtual PxD6JointDrive      getDrive(PxD6Drive::Enum index) const                           = 0;
00378 
00390     virtual void                setDrivePosition(const PxTransform& pose)                       = 0;
00391 
00398     virtual PxTransform         getDrivePosition()                      const                   = 0;
00399 
00400 
00412     virtual void                setDriveVelocity(const PxVec3& linear,
00413                                                  const PxVec3& angular)                         = 0;
00414 
00424     virtual void                getDriveVelocity(PxVec3& linear,
00425                                                  PxVec3& angular)       const                   = 0;
00426     
00427 
00447     virtual void                setProjectionLinearTolerance(PxReal tolerance)                  = 0;
00448 
00449 
00458     virtual PxReal              getProjectionLinearTolerance()          const                   = 0;
00459 
00482     virtual void                setProjectionAngularTolerance(PxReal tolerance)                         = 0;
00483 
00492     virtual PxReal              getProjectionAngularTolerance()         const                   = 0;
00493 
00497     virtual const char*         getConcreteTypeName() const { return "PxD6Joint"; }
00498 
00499 
00500 protected:
00501 
00502     //serialization
00503 
00507     PX_INLINE                   PxD6Joint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {}
00508 
00512     PX_INLINE                   PxD6Joint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {}
00513 
00517     virtual bool                isKindOf(const char* name) const { return !::strcmp("PxD6Joint", name) || PxJoint::isKindOf(name); }
00518 
00519     //~serialization
00520 };
00521 
00522 #if !PX_DOXYGEN
00523 } // namespace physx
00524 #endif
00525 
00527 #endif


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