My Project: dynamics.mod/NewtonDynamics/source/physics/dgCollisionBox.h Source File

My Project

dgCollisionBox.h
Go to the documentation of this file.
1 /* Copyright (c) <2003-2011> <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 _DG_BOX_H_
23 #define _DG_BOX_H_
24
25
26 #include "dgCollisionConvex.h"
27
28
29 class dgCollisionBox: public dgCollisionConvex
30 {
31 public:
32
33 dgCollisionBox(dgMemoryAllocator* const allocator, dgUnsigned32 signature, dgFloat32 size_x, dgFloat32 size_y, dgFloat32 size_z);
34 dgCollisionBox(dgWorld* const world, dgDeserialize deserialization, void* const userData);
35 virtual ~dgCollisionBox();
36
37 protected:
38 void Init (dgFloat32 size_x, dgFloat32 size_y, dgFloat32 size_z);
39 virtual void CalcAABB (const dgMatrix& matrix, dgVector& p0, dgVector& p1) const;
40 virtual dgFloat32 RayCast (const dgVector& localP0, const dgVector& localP1, dgFloat32 maxT, dgContactPoint& contactOut, const dgBody* const body, void* const userData, OnRayPrecastAction preFilter) const;
41 virtual dgVector SupportVertex (const dgVector& dir, dgInt32* const vertexIndex) const;
42 virtual dgInt32 CalculatePlaneIntersection (const dgVector& normal, const dgVector& point, dgVector* const contactsOut, dgFloat32 normalSign) const;
43 virtual const dgConvexSimplexEdge** GetVertexToEdgeMapping() const;
44
45 virtual dgInt32 CalculateSignature () const;
46 virtual void SetCollisionBBox (const dgVector& p0, const dgVector& p1);
47 virtual void MassProperties ();
48
49 virtual void GetCollisionInfo(dgCollisionInfo* const info) const;
50 virtual void Serialize(dgSerialize callback, void* const userData) const;
51
52 static dgInt32 CalculateSignature (dgFloat32 dx, dgFloat32 dy, dgFloat32 dz);
53
54 dgVector m_size[2];
55 dgVector m_vertex[8];
56 static dgInt32 m_initSimplex;
57 static dgInt32 m_faces[][4];
58 static dgVector m_indexMark;
59 static dgConvexSimplexEdge m_edgeArray[];
60 static dgConvexSimplexEdge* m_edgeEdgeMap[];
61 static dgConvexSimplexEdge* m_vertexToEdgeMap[];
62 friend class dgWorld;
63 };
64
65 #endif
66
dgCollisionBox::m_edgeArray
static dgConvexSimplexEdge m_edgeArray[]
Definition: dgCollisionBox.h:59
dgCollisionBox::CalcAABB
virtual void CalcAABB(const dgMatrix &matrix, dgVector &p0, dgVector &p1) const
Definition: dgCollisionBox.cpp:205
dgCollisionBox::GetVertexToEdgeMapping
virtual const dgConvexSimplexEdge ** GetVertexToEdgeMapping() const
Definition: dgCollisionBox.cpp:300
dgCollisionInfo
Definition: dgCollision.h:82
dgBody
Definition: dgBody.h:44
dgCollisionBox::CalculatePlaneIntersection
virtual dgInt32 CalculatePlaneIntersection(const dgVector &normal, const dgVector &point, dgVector *const contactsOut, dgFloat32 normalSign) const
Definition: dgCollisionBox.cpp:307
userData
void *const userData
Definition: dgBroadPhase.h:35
dgCollisionBox::Init
void Init(dgFloat32 size_x, dgFloat32 size_y, dgFloat32 size_z)
Definition: dgCollisionBox.cpp:63
dgFloat32
float dgFloat32
Definition: dgTypes.h:233
dgInt32
int dgInt32
Definition: dgTypes.h:218
dgConvexSimplexEdge
Definition: dgCollisionConvex.h:31
dgVector
Definition: dgVector.h:639
dgCollisionBox::SetCollisionBBox
virtual void SetCollisionBBox(const dgVector &p0, const dgVector &p1)
Definition: dgCollisionBox.cpp:164
dgCollisionBox::m_size
dgVector m_size[2]
Definition: dgCollisionBox.h:54
dgCollisionBox::SupportVertex
virtual dgVector SupportVertex(const dgVector &dir, dgInt32 *const vertexIndex) const
Definition: dgCollisionBox.cpp:190
dgCollisionBox::m_edgeEdgeMap
static dgConvexSimplexEdge * m_edgeEdgeMap[]
Definition: dgCollisionBox.h:60
dgCollisionBox::Serialize
virtual void Serialize(dgSerialize callback, void *const userData) const
Definition: dgCollisionBox.cpp:293
dgContactPoint
Definition: dgContact.h:78
dgSerialize
void(dgApi * dgSerialize)(void *const userData, const void *const buffer, size_t size)
Definition: dgTypes.h:280
dgCollisionBox::m_indexMark
static dgVector m_indexMark
Definition: dgCollisionBox.h:58
dgCollisionBox
Definition: dgCollisionBox.h:29
dgCollisionBox::CalculateSignature
virtual dgInt32 CalculateSignature() const
Definition: dgCollisionBox.cpp:184
dgDeserialize
void(dgApi * dgDeserialize)(void *const userData, void *buffer, size_t size)
Definition: dgTypes.h:279
dgCollisionBox::m_vertex
dgVector m_vertex[8]
Definition: dgCollisionBox.h:55
OnRayPrecastAction
dgUnsigned32(dgApi * OnRayPrecastAction)(const dgBody *const body, const dgCollisionInstance *const collision, void *const userData)
Definition: dgBroadPhase.h:36
dgCollisionBox::dgCollisionBox
dgCollisionBox(dgMemoryAllocator *const allocator, dgUnsigned32 signature, dgFloat32 size_x, dgFloat32 size_y, dgFloat32 size_z)
Definition: dgCollisionBox.cpp:49
dgCollisionBox::MassProperties
virtual void MassProperties()
Definition: dgCollisionBox.cpp:270
dgUnsigned32
unsigned dgUnsigned32
Definition: dgTypes.h:219
dgCollisionConvex
Definition: dgCollisionConvex.h:42
dgCollisionBox::m_vertexToEdgeMap
static dgConvexSimplexEdge * m_vertexToEdgeMap[]
Definition: dgCollisionBox.h:61
dgCollisionBox::RayCast
virtual dgFloat32 RayCast(const dgVector &localP0, const dgVector &localP1, dgFloat32 maxT, dgContactPoint &contactOut, const dgBody *const body, void *const userData, OnRayPrecastAction preFilter) const
Definition: dgCollisionBox.cpp:218
dgCollisionBox::m_initSimplex
static dgInt32 m_initSimplex
Definition: dgCollisionBox.h:56
dgCollisionBox::m_faces
static dgInt32 m_faces[][4]
Definition: dgCollisionBox.h:57
dgMatrix
Definition: dgMatrix.h:40
dgMemoryAllocator
Definition: dgMemory.h:73
dgWorld
Definition: dgWorld.h:129
dgCollisionBox::~dgCollisionBox
virtual ~dgCollisionBox()
Definition: dgCollisionBox.cpp:157
dgCollisionBox::GetCollisionInfo
virtual void GetCollisionInfo(dgCollisionInfo *const info) const
Definition: dgCollisionBox.cpp:284
dgCollisionConvex.h