PhysX SDK 3.2 API Reference: PxD6Joint.h Source File

PhysX SDK 3.2 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-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_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 #ifndef 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 
00157 class PxD6JointDrive
00158 {
00159 public:
00160     PxReal                  spring;
00161     PxReal                  damping;
00162     PxReal                  forceLimit;
00163     PxD6JointDriveFlags     flags;
00164 
00165     // only needed for deprecated PxD6JointDesc
00166     PX_DEPRECATED PxD6JointDrive(): spring(0), damping(0), forceLimit(PX_MAX_F32), flags(0) {}
00167 
00168     PxD6JointDrive(PxReal driveSpring, PxReal driveDamping, PxReal _forceLimit, bool isAcceleration = false)
00169     : spring(driveSpring)
00170     , damping(driveDamping)
00171     , forceLimit(_forceLimit)
00172     , flags(isAcceleration?PxD6JointDriveFlag::eACCELERATION : 0) 
00173     {}
00174 
00179     bool isValid() const
00180     {
00181         return PxIsFinite(spring) && 
00182                PxIsFinite(damping) && 
00183                PxIsFinite(forceLimit) &&
00184                spring >= 0 && 
00185                damping >= 0;
00186     }
00187 };
00188 
00189 
00222 class PxD6Joint: public PxJoint
00223 {
00224 public:
00225     static const PxJointType::Enum Type = PxJointType::eD6;
00226 
00241     virtual void                setMotion(PxD6Axis::Enum axis, PxD6Motion::Enum type)           = 0;
00242 
00253     virtual PxD6Motion::Enum    getMotion(PxD6Axis::Enum axis)          const                   = 0;
00254 
00265     virtual void                setLinearLimit(const PxJointLimit &limit)                           = 0;
00266 
00275     virtual PxJointLimit        getLinearLimit()                        const                   = 0;
00276 
00277 
00287     virtual void                setTwistLimit(const PxJointLimitPair &limit)                    = 0;
00288 
00289 
00297     virtual PxJointLimitPair    getTwistLimit()                         const                   = 0;
00298 
00310     virtual void                setSwingLimit(const PxJointLimitCone &limit)                        = 0;
00311 
00319     virtual PxJointLimitCone    getSwingLimit()                         const                   = 0;
00320 
00332     virtual void                setDrive(PxD6Drive::Enum index, const PxD6JointDrive& drive)        = 0;
00333 
00341     virtual PxD6JointDrive      getDrive(PxD6Drive::Enum index) const                           = 0;
00342 
00354     virtual void                setDrivePosition(const PxTransform& pose)                       = 0;
00355 
00362     virtual PxTransform         getDrivePosition()                      const                   = 0;
00363 
00364 
00376     virtual void                setDriveVelocity(const PxVec3& linear,
00377                                                  const PxVec3& angular)                         = 0;
00378 
00388     virtual void                getDriveVelocity(PxVec3& linear,
00389                                                  PxVec3& angular)       const                   = 0;
00390     
00391 
00411     virtual void                setProjectionLinearTolerance(PxReal tolerance)                  = 0;
00412 
00413 
00422     virtual PxReal              getProjectionLinearTolerance()          const                   = 0;
00423 
00443     virtual void                setProjectionAngularTolerance(PxReal tolerance)                         = 0;
00444 
00453     virtual PxReal              getProjectionAngularTolerance()         const                   = 0;
00454 
00455     virtual const char*         getConcreteTypeName() const                 {   return "PxD6Joint"; }
00456 
00457 
00458 protected:
00459     PxD6Joint(PxRefResolver& v) : PxJoint(v)    {}
00460     PxD6Joint()                                 {}
00461     virtual bool                isKindOf(const char* name)  const       {   return !strcmp("PxD6Joint", name) || PxJoint::isKindOf(name); }
00462 };
00463 
00464 #ifndef PX_DOXYGEN
00465 } // namespace physx
00466 #endif
00467 
00469 #endif


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