Newton Dynamics  4.00
ndShapeBox.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_BOX_H__
23 #define __ND_SHAPE_BOX_H__
24 
25 #include "ndShapeConvex.h"
26 
27 D_MSV_NEWTON_ALIGN_32
29 {
30  public:
31  D_CLASS_REFLECTION(ndShapeBox);
32  D_COLLISION_API ndShapeBox(const ndLoadSaveBase::ndLoadDescriptor& desc);
33  D_COLLISION_API ndShapeBox(ndFloat32 size_x, ndFloat32 size_y, ndFloat32 size_z);
34  D_COLLISION_API virtual ~ndShapeBox();
35 
36  D_COLLISION_API virtual ndShapeBox* GetAsShapeBox() { return this; }
37 
38  protected:
39  D_COLLISION_API void Init (ndFloat32 size_x, ndFloat32 size_y, ndFloat32 size_z);
40  D_COLLISION_API virtual void MassProperties();
41 
42  D_COLLISION_API virtual ndShapeInfo GetShapeInfo() const;
43  D_COLLISION_API virtual void CalculateAabb(const ndMatrix& matrix, ndVector& p0, ndVector& p1) const;
44  D_COLLISION_API virtual ndVector SupportVertexSpecialProjectPoint(const ndVector& point, const ndVector& dir) const;
45  D_COLLISION_API virtual ndVector SupportVertex(const ndVector& dir, ndInt32* const vertexIndex) const;
46  D_COLLISION_API virtual ndVector SupportVertexSpecial(const ndVector& dir, ndFloat32 skinMargin, ndInt32* const vertexIndex) const;
47  D_COLLISION_API virtual ndFloat32 RayCast(ndRayCastNotify& callback, const ndVector& localP0, const ndVector& localP1, ndFloat32 maxT, const ndBody* const body, ndContactPoint& contactOut) const;
48 
49  D_COLLISION_API const ndConvexSimplexEdge** GetVertexToEdgeMapping() const;
50  D_COLLISION_API virtual ndInt32 CalculatePlaneIntersection(const ndVector& normal, const ndVector& point, ndVector* const contactsOut) const;
51  D_COLLISION_API virtual void Save(const ndLoadSaveBase::ndSaveDescriptor& desc) const;
52 
53  ndVector m_size[2];
54  ndVector m_vertex[8];
55 
56  static ndInt32 m_initSimplex;
57  static ndInt32 m_faces[][4];
58  static ndVector m_indexMark;
59  static ndVector m_penetrationTol;
60  static ndConvexSimplexEdge m_edgeArray[];
61  static ndConvexSimplexEdge* m_edgeEdgeMap[];
62  static ndConvexSimplexEdge* m_vertexToEdgeMap[];
63 
64 } D_GCC_NEWTON_ALIGN_32;
65 
66 #endif
67 
ndBody
Definition: ndBody.h:43
ndRayCastNotify
Definition: ndRayCastNotify.h:31
ndShapeConvex::ndConvexSimplexEdge
Definition: ndShapeConvex.h:38
ndShapeConvex
Definition: ndShapeConvex.h:34
ndContactPoint
Definition: ndContact.h:39
ndMatrix
Definition: ndMatrix.h:42
ndShapeBox
Definition: ndShapeBox.h:29
ndShapeInfo
Definition: ndShape.h:182
ndLoadSaveBase::ndLoadDescriptor
Definition: ndSaveLoadSytem.h:59
ndLoadSaveBase::ndSaveDescriptor
Definition: ndSaveLoadSytem.h:93
ndVector
Definition: ndVectorArmNeon.h:41