Newton Dynamics  4.00
ndShapeNull.h
1 /* Copyright (c) <2003-2022> <Julio Jerez, Newton Game Dynamics>
2 *
3 * This software is provided 'as-is', without any express or implied
4 * warranty. In no event will the authors be held liable for any damages
5 * arising from the use of this software.
6 *
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 *
11 * 1. The origin of this software must not be misrepresented; you must not
12 * claim that you wrote the original software. If you use this software
13 * in a product, an acknowledgment in the product documentation would be
14 * appreciated but is not required.
15 *
16 * 2. Altered source versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software.
18 *
19 * 3. This notice may not be removed or altered from any source distribution.
20 */
21 
22 #ifndef __ND_SHAPE_NULL_H__
23 #define __ND_SHAPE_NULL_H__
24 
25 #include "ndCollisionStdafx.h"
26 #include "ndShape.h"
27 
28 class ndShapeNull : public ndShape
29 {
30  public:
31  ndShapeNull();
32  virtual ~ndShapeNull();
33 
34  virtual ndShapeNull* GetAsShapeNull();
35 
36  virtual ndFloat32 GetVolume() const;
37  virtual ndShapeInfo GetShapeInfo() const;
38  virtual ndFloat32 GetBoxMinRadius() const;
39  virtual ndFloat32 GetBoxMaxRadius() const;
40  virtual void CalculateAabb(const ndMatrix& matrix, ndVector& p0, ndVector& p1) const;
41  virtual ndVector SupportVertex(const ndVector& dir, ndInt32* const vertexIndex) const;
42  virtual void DebugShape(const ndMatrix& matrix, ndShapeDebugNotify& debugCallback) const;
43  virtual ndVector SupportVertexSpecialProjectPoint(const ndVector& point, const ndVector& dir) const;
44  virtual ndVector SupportVertexSpecial(const ndVector& dir, ndFloat32 skinMargin, ndInt32* const vertexIndex) const;
45  virtual ndInt32 CalculatePlaneIntersection(const ndVector& normal, const ndVector& point, ndVector* const contactsOut) const;
46  virtual ndVector CalculateVolumeIntegral(const ndMatrix& globalMatrix, const ndVector& globalPlane, const ndShapeInstance& parentScale) const;
47  virtual ndFloat32 RayCast(ndRayCastNotify& callback, const ndVector& localP0, const ndVector& localP1, ndFloat32 maxT, const ndBody* const body, ndContactPoint& contactOut) const;
48 };
49 
50 inline ndShapeNull::ndShapeNull()
51  :ndShape(m_nullCollision)
52 {
53  m_inertia = ndVector::m_one | ndVector::m_triplexMask;
54 }
55 
56 inline ndShapeNull::~ndShapeNull()
57 {
58 }
59 
60 inline ndShapeNull* ndShapeNull::GetAsShapeNull()
61 {
62  return this;
63 }
64 
65 inline ndVector ndShapeNull::SupportVertex(const ndVector&, ndInt32* const) const
66 {
67  return ndVector::m_zero;
68 }
69 
70 inline ndVector ndShapeNull::SupportVertexSpecial(const ndVector&, ndFloat32, ndInt32* const) const
71 {
72  return ndVector::m_zero;
73 }
74 
75 inline ndFloat32 ndShapeNull::RayCast(ndRayCastNotify&, const ndVector&, const ndVector&, ndFloat32, const ndBody* const, ndContactPoint&) const
76 {
77  return ndFloat32(1.2f);
78 }
79 
80 inline void ndShapeNull::DebugShape(const ndMatrix&, ndShapeDebugNotify&) const
81 {
82 }
83 
84 inline void ndShapeNull::CalculateAabb(const ndMatrix&, ndVector& p0, ndVector& p1) const
85 {
86  p0 = ndVector::m_zero;
87  p1 = ndVector::m_zero;
88 }
89 
90 inline ndShapeInfo ndShapeNull::GetShapeInfo() const
91 {
92  ndAssert(0);
93  ndShapeInfo info;
94  return info;
95 }
96 
97 inline ndFloat32 ndShapeNull::GetVolume() const
98 {
99  return ndFloat32(0.0f);
100 }
101 
102 inline ndFloat32 ndShapeNull::GetBoxMinRadius() const
103 {
104  return ndFloat32(0.0f);
105 }
106 
107 inline ndFloat32 ndShapeNull::GetBoxMaxRadius() const
108 {
109  return ndFloat32(0.0f);
110 }
111 
112 inline ndVector ndShapeNull::CalculateVolumeIntegral(const ndMatrix&, const ndVector&, const ndShapeInstance&) const
113 {
114  return ndVector::m_zero;
115 }
116 
117 inline ndVector ndShapeNull::SupportVertexSpecialProjectPoint(const ndVector& point, const ndVector&) const
118 {
119  return point;
120 }
121 
122 inline ndInt32 ndShapeNull::CalculatePlaneIntersection(const ndVector&, const ndVector&, ndVector* const) const
123 {
124  return 0;
125 }
126 
127 #endif
128 
ndBody
Definition: ndBody.h:43
ndShapeNull
Definition: ndShapeNull.h:29
ndShape
Definition: ndShape.h:209
ndRayCastNotify
Definition: ndRayCastNotify.h:31
ndContactPoint
Definition: ndContact.h:39
ndMatrix
Definition: ndMatrix.h:42
ndShapeDebugNotify
Definition: ndShapeInstance.h:38
ndShapeInfo
Definition: ndShape.h:182
ndShapeInstance
Definition: ndShapeInstance.h:62
ndVector
Definition: ndVectorArmNeon.h:41