1 | /* |
2 | * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. |
3 | * |
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property |
5 | * and proprietary rights in and to this software, related documentation |
6 | * and any modifications thereto. Any use, reproduction, disclosure or |
7 | * distribution of this software and related documentation without an express |
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited. |
9 | */ |
10 | // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. |
11 | // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. |
12 | |
13 | |
14 | #ifndef PX_PHYSICS_NX_PLANE_GEOMETRY |
15 | #define PX_PHYSICS_NX_PLANE_GEOMETRY |
16 | /** \addtogroup geomutils |
17 | @{ |
18 | */ |
19 | #include "foundation/PxPlane.h" |
20 | #include "foundation/PxTransform.h" |
21 | #include "geometry/PxGeometry.h" |
22 | |
23 | #ifndef PX_DOXYGEN |
24 | namespace physx |
25 | { |
26 | #endif |
27 | |
28 | /** |
29 | \brief Class describing a plane geometry. |
30 | |
31 | The plane geometry specifies the half-space volume x<=0. As with other geometry types, |
32 | when used in a PxShape the collision volume is obtained by transforming the halfspace |
33 | by the shape local pose and the actor global pose. |
34 | |
35 | To generate a PxPlane from a PxTransform, transform PxPlane(1,0,0,0). |
36 | |
37 | To generate a PxTransform from a PxPlane, use PxTransformFromPlaneEquation. |
38 | |
39 | @see PxShape.setGeometry() PxShape.getPlaneGeometry() PxTransformFromPlaneEquation |
40 | */ |
41 | class PxPlaneGeometry : public PxGeometry |
42 | { |
43 | public: |
44 | PX_INLINE PxPlaneGeometry() : PxGeometry(PxGeometryType::ePLANE) {} |
45 | |
46 | /** |
47 | \brief Returns true if the geometry is valid. |
48 | |
49 | \return True if the current settings are valid |
50 | */ |
51 | PX_INLINE bool isValid() const; |
52 | }; |
53 | |
54 | |
55 | PX_INLINE bool PxPlaneGeometry::isValid() const |
56 | { |
57 | if (mType != PxGeometryType::ePLANE) |
58 | return false; |
59 | |
60 | return true; |
61 | } |
62 | |
63 | |
64 | /** \brief creates a transform from a plane equation, suitable for an actor transform for a PxPlaneGeometry |
65 | |
66 | \param[in] plane the desired plane equation |
67 | \return a PxTransform which will transform the plane PxPlane(1,0,0,0) to the specified plane |
68 | */ |
69 | |
70 | PX_FOUNDATION_API PxTransform PxTransformFromPlaneEquation(const PxPlane& plane); |
71 | |
72 | /** \brief creates a plane equation from a transform, such as the actor transform for a PxPlaneGeometry |
73 | |
74 | \param[in] transform the transform |
75 | \return the plane |
76 | */ |
77 | |
78 | |
79 | PX_INLINE PxPlane PxPlaneEquationFromTransform(const PxTransform& transform) |
80 | { |
81 | return transform.transform(PxPlane(1.f,0.f,0.f,0.f)); |
82 | } |
83 | |
84 | |
85 | #ifndef PX_DOXYGEN |
86 | } // namespace physx |
87 | #endif |
88 | |
89 | /** @} */ |
90 | #endif |
91 | |