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

My Project

dgCollisionConvexHull.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 #if !defined(AFX_DGCOLLISIONCONVEXHULL_H__AS235640FER_H)
23 #define AFX_DGCOLLISIONCONVEXHULL_H__AS235640FER_H
24
25 #include "dgCollisionConvex.h"
26
27
28 class dgCollisionConvexHull: public dgCollisionConvex
29 {
30 public:
31 class dgConvexBox;
32
33 dgCollisionConvexHull(dgMemoryAllocator* const allocator, dgUnsigned32 signature);
34 dgCollisionConvexHull(dgMemoryAllocator* const allocator, dgUnsigned32 signature, dgInt32 count, dgInt32 strideInBytes, dgFloat32 tolerance, const dgFloat32* const vertexArray);
35 dgCollisionConvexHull(dgWorld* const world, dgDeserialize deserialization, void* const userData);
36 virtual ~dgCollisionConvexHull();
37
38 dgInt32 GetFaceIndices (dgInt32 index, dgInt32* const indices) const;
39
40 static dgInt32 CalculateSignature (dgInt32 vertexCount, const dgFloat32* const vertexArray, dgInt32 strideInBytes);
41
42 protected:
43 void BuildHull (dgInt32 count, dgInt32 strideInBytes, dgFloat32 tolerance, const dgFloat32* const vertexArray);
44 bool Create (dgInt32 count, dgInt32 strideInBytes, const dgFloat32* const vertexArray, dgFloat32 tolerance);
45
46 bool RemoveCoplanarEdge (dgPolyhedra& convex, const dgBigVector* const hullVertexArray) const;
47 dgBigVector FaceNormal (const dgEdge *face, const dgBigVector* const pool) const;
48 bool CheckConvex (dgPolyhedra& polyhedra, const dgBigVector* hullVertexArray) const;
49
50 virtual dgVector SupportVertex (const dgVector& dir, dgInt32* const vertexIndex) const;
51
52 virtual dgInt32 CalculateSignature () const;
53 virtual void SetCollisionBBox (const dgVector& p0, const dgVector& p1);
54 virtual void DebugCollision (const dgMatrix& matrix, dgCollision::OnDebugCollisionMeshCallback callback, void* const userData) const;
55 virtual void GetCollisionInfo(dgCollisionInfo* const info) const;
56 virtual void Serialize(dgSerialize callback, void* const userData) const;
57
58 virtual const dgConvexSimplexEdge** GetVertexToEdgeMapping() const {return m_vertexToEdgeMapping;}
59
60 // virtual dgFloat32 RayCast (const dgVector& localQ0, const dgVector& localP1, dgContactPoint& contactOut, const dgBody* const body, void* const userData) const;
61
62 dgInt32 m_faceCount;
63 dgInt32 m_supportTreeCount;
64 dgConvexSimplexEdge** m_faceArray;
65 const dgConvexSimplexEdge** m_vertexToEdgeMapping;
66 dgConvexBox* m_supportTree;
67
68 friend class dgWorld;
69 friend class dgCollisionConvex;
70 };
71
72 #endif
73
dgCollisionConvexHull::RemoveCoplanarEdge
bool RemoveCoplanarEdge(dgPolyhedra &convex, const dgBigVector *const hullVertexArray) const
Definition: dgCollisionConvexHull.cpp:202
dgCollisionConvexHull::DebugCollision
virtual void DebugCollision(const dgMatrix &matrix, dgCollision::OnDebugCollisionMeshCallback callback, void *const userData) const
Definition: dgCollisionConvexHull.cpp:760
dgCollision::OnDebugCollisionMeshCallback
void(dgApi * OnDebugCollisionMeshCallback)(void *userData, int vertexCount, const dgFloat32 *FaceArray, int faceId)
Definition: dgCollision.h:220
dgCollisionInfo
Definition: dgCollision.h:82
dgCollisionConvexHull::GetVertexToEdgeMapping
virtual const dgConvexSimplexEdge ** GetVertexToEdgeMapping() const
Definition: dgCollisionConvexHull.h:58
userData
void *const userData
Definition: dgBroadPhase.h:35
dgFloat32
float dgFloat32
Definition: dgTypes.h:233
dgInt32
int dgInt32
Definition: dgTypes.h:218
dgConvexSimplexEdge
Definition: dgCollisionConvex.h:31
dgVector
Definition: dgVector.h:639
dgCollisionConvexHull::dgConvexBox
Definition: dgCollisionConvexHull.cpp:37
dgEdge
Definition: dgPolyhedra.h:45
dgCollisionConvexHull::m_vertexToEdgeMapping
const dgConvexSimplexEdge ** m_vertexToEdgeMapping
Definition: dgCollisionConvexHull.h:65
dgCollisionConvexHull::CheckConvex
bool CheckConvex(dgPolyhedra &polyhedra, const dgBigVector *hullVertexArray) const
Definition: dgCollisionConvexHull.cpp:289
dgCollisionConvexHull::~dgCollisionConvexHull
virtual ~dgCollisionConvexHull()
Definition: dgCollisionConvexHull.cpp:129
dgCollisionConvexHull::SetCollisionBBox
virtual void SetCollisionBBox(const dgVector &p0, const dgVector &p1)
Definition: dgCollisionConvexHull.cpp:753
dgCollisionConvexHull::SupportVertex
virtual dgVector SupportVertex(const dgVector &dir, dgInt32 *const vertexIndex) const
Definition: dgCollisionConvexHull.cpp:784
dgCollisionConvexHull::FaceNormal
dgBigVector FaceNormal(const dgEdge *face, const dgBigVector *const pool) const
Definition: dgCollisionConvexHull.cpp:161
dgSerialize
void(dgApi * dgSerialize)(void *const userData, const void *const buffer, size_t size)
Definition: dgTypes.h:280
dgPolyhedra
Definition: dgPolyhedra.h:62
dgDeserialize
void(dgApi * dgDeserialize)(void *const userData, void *buffer, size_t size)
Definition: dgTypes.h:279
dgCollisionConvexHull::CalculateSignature
virtual dgInt32 CalculateSignature() const
Definition: dgCollisionConvexHull.cpp:745
dgCollisionConvexHull::GetFaceIndices
dgInt32 GetFaceIndices(dgInt32 index, dgInt32 *const indices) const
Definition: dgCollisionConvexHull.cpp:148
dgCollisionConvexHull::Create
bool Create(dgInt32 count, dgInt32 strideInBytes, const dgFloat32 *const vertexArray, dgFloat32 tolerance)
Definition: dgCollisionConvexHull.cpp:335
dgCollisionConvexHull::Serialize
virtual void Serialize(dgSerialize callback, void *const userData) const
Definition: dgCollisionConvexHull.cpp:915
dgCollisionConvexHull::m_faceCount
dgInt32 m_faceCount
Definition: dgCollisionConvexHull.h:62
dgUnsigned32
unsigned dgUnsigned32
Definition: dgTypes.h:219
dgCollisionConvex
Definition: dgCollisionConvex.h:42
dgCollisionConvexHull::m_supportTree
dgConvexBox * m_supportTree
Definition: dgCollisionConvexHull.h:66
dgCollisionConvexHull::dgCollisionConvexHull
dgCollisionConvexHull(dgMemoryAllocator *const allocator, dgUnsigned32 signature)
Definition: dgCollisionConvexHull.cpp:47
dgCollisionConvexHull::GetCollisionInfo
virtual void GetCollisionInfo(dgCollisionInfo *const info) const
Definition: dgCollisionConvexHull.cpp:904
dgMatrix
Definition: dgMatrix.h:40
dgMemoryAllocator
Definition: dgMemory.h:73
dgCollisionConvexHull::m_supportTreeCount
dgInt32 m_supportTreeCount
Definition: dgCollisionConvexHull.h:63
dgWorld
Definition: dgWorld.h:129
dgCollisionConvexHull::BuildHull
void BuildHull(dgInt32 count, dgInt32 strideInBytes, dgFloat32 tolerance, const dgFloat32 *const vertexArray)
Definition: dgCollisionConvexHull.cpp:143
dgCollisionConvexHull
Definition: dgCollisionConvexHull.h:28
dgBigVector
Definition: dgVector.h:207
dgCollisionConvexHull::m_faceArray
dgConvexSimplexEdge ** m_faceArray
Definition: dgCollisionConvexHull.h:64
dgCollisionConvex.h