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

My Project

dgCollisionCone.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_DGCOLLISIONCONE_H__AS235640FER_H)
23 #define AFX_DGCOLLISIONCONE_H__AS235640FER_H
24
25 #include "dgCollisionConvex.h"
26
27 #define DG_CONE_SEGMENTS 8
28
29
30 class dgCollisionCone: public dgCollisionConvex
31 {
32 public:
33 dgCollisionCone (dgMemoryAllocator* const allocator, dgUnsigned32 signature, dgFloat32 radius, dgFloat32 height);
34 dgCollisionCone(dgWorld* const world, dgDeserialize deserialization, void* const userData);
35 virtual ~dgCollisionCone();
36
37 private:
38 void Init (dgFloat32 radius, dgFloat32 height);
39 virtual dgVector SupportVertex (const dgVector& dir, dgInt32* const vertexIndex) const;
40
41 virtual dgInt32 CalculatePlaneIntersection (const dgVector& normal, const dgVector& origin, dgVector* const contactsOut, dgFloat32 normalSign) const;
42
43 virtual void MassProperties ();
44 virtual void DebugCollision (const dgMatrix& matrix, dgCollision::OnDebugCollisionMeshCallback callback, void* const userData) const;
45
46 virtual dgInt32 CalculateSignature () const;
47 virtual void SetCollisionBBox (const dgVector& p0, const dgVector& p1);
48 virtual void GetCollisionInfo(dgCollisionInfo* const info) const;
49 virtual void Serialize(dgSerialize callback, void* const userData) const;
50
51 static dgInt32 CalculateSignature (dgFloat32 radius, dgFloat32 height);
52
53 dgFloat32 m_height;
54 dgFloat32 m_radius;
55 dgFloat32 m_sinAngle;
56
57 // dgFloat32 m_delCosTetha;
58 // dgFloat32 m_delSinTetha;
59 // dgFloat32 m_tethaStep;
60 // dgFloat32 m_tethaStepInv;
61
62 dgFloat32 m_amp;
63
64 dgVector m_vertex[DG_CONE_SEGMENTS + 1];
65 static dgInt32 m_shapeRefCount;
66 static dgConvexSimplexEdge m_edgeArray[];
67
68 friend class dgWorld;
69 };
70
71 #endif
72
dgCollision::OnDebugCollisionMeshCallback
void(dgApi * OnDebugCollisionMeshCallback)(void *userData, int vertexCount, const dgFloat32 *FaceArray, int faceId)
Definition: dgCollision.h:220
dgCollisionInfo
Definition: dgCollision.h:82
DG_CONE_SEGMENTS
#define DG_CONE_SEGMENTS
Definition: dgCollisionCone.h:27
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
dgCollisionCone::dgCollisionCone
dgCollisionCone(dgMemoryAllocator *const allocator, dgUnsigned32 signature, dgFloat32 radius, dgFloat32 height)
Definition: dgCollisionCone.cpp:35
dgSerialize
void(dgApi * dgSerialize)(void *const userData, const void *const buffer, size_t size)
Definition: dgTypes.h:280
dgDeserialize
void(dgApi * dgDeserialize)(void *const userData, void *buffer, size_t size)
Definition: dgTypes.h:279
dgUnsigned32
unsigned dgUnsigned32
Definition: dgTypes.h:219
dgCollisionConvex
Definition: dgCollisionConvex.h:42
dgMatrix
Definition: dgMatrix.h:40
dgMemoryAllocator
Definition: dgMemory.h:73
dgWorld
Definition: dgWorld.h:129
dgCollisionCone
Definition: dgCollisionCone.h:30
dgCollisionCone::~dgCollisionCone
virtual ~dgCollisionCone()
Definition: dgCollisionCone.cpp:50
dgCollisionConvex.h