diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/ModifiedBulletX/ModifiedBulletX/Collision/NarrowPhaseCollision/DiscreteCollisionDetectorInterface.cs | 234 |
1 files changed, 117 insertions, 117 deletions
diff --git a/libraries/ModifiedBulletX/ModifiedBulletX/Collision/NarrowPhaseCollision/DiscreteCollisionDetectorInterface.cs b/libraries/ModifiedBulletX/ModifiedBulletX/Collision/NarrowPhaseCollision/DiscreteCollisionDetectorInterface.cs index fae2557..5b07d9b 100644 --- a/libraries/ModifiedBulletX/ModifiedBulletX/Collision/NarrowPhaseCollision/DiscreteCollisionDetectorInterface.cs +++ b/libraries/ModifiedBulletX/ModifiedBulletX/Collision/NarrowPhaseCollision/DiscreteCollisionDetectorInterface.cs | |||
@@ -1,117 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | Bullet for XNA Copyright (c) 2003-2007 Vsevolod Klementjev http://www.codeplex.com/xnadevru | 2 | Bullet for XNA Copyright (c) 2003-2007 Vsevolod Klementjev http://www.codeplex.com/xnadevru |
3 | Bullet original C++ version Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com | 3 | Bullet original C++ version Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com |
4 | 4 | ||
5 | This software is provided 'as-is', without any express or implied | 5 | This software is provided 'as-is', without any express or implied |
6 | warranty. In no event will the authors be held liable for any damages | 6 | warranty. In no event will the authors be held liable for any damages |
7 | arising from the use of this software. | 7 | arising from the use of this software. |
8 | 8 | ||
9 | Permission is granted to anyone to use this software for any purpose, | 9 | Permission is granted to anyone to use this software for any purpose, |
10 | including commercial applications, and to alter it and redistribute it | 10 | including commercial applications, and to alter it and redistribute it |
11 | freely, subject to the following restrictions: | 11 | freely, subject to the following restrictions: |
12 | 12 | ||
13 | 1. The origin of this software must not be misrepresented; you must not | 13 | 1. The origin of this software must not be misrepresented; you must not |
14 | claim that you wrote the original software. If you use this software | 14 | claim that you wrote the original software. If you use this software |
15 | in a product, an acknowledgment in the product documentation would be | 15 | in a product, an acknowledgment in the product documentation would be |
16 | appreciated but is not required. | 16 | appreciated but is not required. |
17 | 2. Altered source versions must be plainly marked as such, and must not be | 17 | 2. Altered source versions must be plainly marked as such, and must not be |
18 | misrepresented as being the original software. | 18 | misrepresented as being the original software. |
19 | 3. This notice may not be removed or altered from any source distribution. | 19 | 3. This notice may not be removed or altered from any source distribution. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | using System; | 22 | using System; |
23 | using System.Collections.Generic; | 23 | using System.Collections.Generic; |
24 | using System.Text; | 24 | using System.Text; |
25 | using MonoXnaCompactMaths; | 25 | using MonoXnaCompactMaths; |
26 | 26 | ||
27 | namespace XnaDevRu.BulletX | 27 | namespace XnaDevRu.BulletX |
28 | { | 28 | { |
29 | public abstract class DiscreteCollisionDetectorInterface | 29 | public abstract class DiscreteCollisionDetectorInterface |
30 | { | 30 | { |
31 | public abstract class Result | 31 | public abstract class Result |
32 | { | 32 | { |
33 | public abstract void SetShapeIdentifiers(int partIdA, int indexA, int partIdB, int indexB); | 33 | public abstract void SetShapeIdentifiers(int partIdA, int indexA, int partIdB, int indexB); |
34 | public abstract void AddContactPoint(Vector3 normalOnBInWorld, Vector3 pointInWorld, float depth); | 34 | public abstract void AddContactPoint(Vector3 normalOnBInWorld, Vector3 pointInWorld, float depth); |
35 | } | 35 | } |
36 | 36 | ||
37 | public class ClosestPointInput | 37 | public class ClosestPointInput |
38 | { | 38 | { |
39 | private float _maximumDistanceSquared; | 39 | private float _maximumDistanceSquared; |
40 | private Matrix _transformA, _transformB; | 40 | private Matrix _transformA, _transformB; |
41 | 41 | ||
42 | #region Properties | 42 | #region Properties |
43 | public Matrix TransformB | 43 | public Matrix TransformB |
44 | { | 44 | { |
45 | get { return _transformB; } | 45 | get { return _transformB; } |
46 | set { _transformB = value; } | 46 | set { _transformB = value; } |
47 | } | 47 | } |
48 | 48 | ||
49 | public Matrix TransformA | 49 | public Matrix TransformA |
50 | { | 50 | { |
51 | get { return _transformA; } | 51 | get { return _transformA; } |
52 | set { _transformA = value; } | 52 | set { _transformA = value; } |
53 | } | 53 | } |
54 | 54 | ||
55 | public float MaximumDistanceSquared | 55 | public float MaximumDistanceSquared |
56 | { | 56 | { |
57 | get { return _maximumDistanceSquared; } | 57 | get { return _maximumDistanceSquared; } |
58 | set { _maximumDistanceSquared = value; } | 58 | set { _maximumDistanceSquared = value; } |
59 | } | 59 | } |
60 | #endregion | 60 | #endregion |
61 | 61 | ||
62 | public ClosestPointInput() | 62 | public ClosestPointInput() |
63 | { | 63 | { |
64 | _maximumDistanceSquared = 1e30f; | 64 | _maximumDistanceSquared = 1e30f; |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | public abstract void GetClosestPoints(ClosestPointInput input, Result output, IDebugDraw debugDraw); | 68 | public abstract void GetClosestPoints(ClosestPointInput input, Result output, IDebugDraw debugDraw); |
69 | } | 69 | } |
70 | 70 | ||
71 | public class StorageResult : DiscreteCollisionDetectorInterface.Result | 71 | public class StorageResult : DiscreteCollisionDetectorInterface.Result |
72 | { | 72 | { |
73 | private Vector3 _closestPointInB; | 73 | private Vector3 _closestPointInB; |
74 | private Vector3 _normalOnSurfaceB; | 74 | private Vector3 _normalOnSurfaceB; |
75 | private float _distance; //negative means penetration ! | 75 | private float _distance; //negative means penetration ! |
76 | 76 | ||
77 | #region Properties | 77 | #region Properties |
78 | 78 | ||
79 | public float Distance | 79 | public float Distance |
80 | { | 80 | { |
81 | get { return _distance; } | 81 | get { return _distance; } |
82 | set { _distance = value; } | 82 | set { _distance = value; } |
83 | } | 83 | } |
84 | public Vector3 NormalOnSurfaceB | 84 | public Vector3 NormalOnSurfaceB |
85 | { | 85 | { |
86 | get { return _normalOnSurfaceB; } | 86 | get { return _normalOnSurfaceB; } |
87 | set { _normalOnSurfaceB = value; } | 87 | set { _normalOnSurfaceB = value; } |
88 | } | 88 | } |
89 | public Vector3 ClosestPointInB | 89 | public Vector3 ClosestPointInB |
90 | { | 90 | { |
91 | get { return _closestPointInB; } | 91 | get { return _closestPointInB; } |
92 | set { _closestPointInB = value; } | 92 | set { _closestPointInB = value; } |
93 | } | 93 | } |
94 | 94 | ||
95 | #endregion | 95 | #endregion |
96 | 96 | ||
97 | public StorageResult() | 97 | public StorageResult() |
98 | { | 98 | { |
99 | _distance = 1e30f; | 99 | _distance = 1e30f; |
100 | } | 100 | } |
101 | 101 | ||
102 | public override void AddContactPoint(Vector3 normalOnBInWorld, Vector3 pointInWorld, float depth) | 102 | public override void AddContactPoint(Vector3 normalOnBInWorld, Vector3 pointInWorld, float depth) |
103 | { | 103 | { |
104 | if (depth < _distance) | 104 | if (depth < _distance) |
105 | { | 105 | { |
106 | _normalOnSurfaceB = normalOnBInWorld; | 106 | _normalOnSurfaceB = normalOnBInWorld; |
107 | _closestPointInB = pointInWorld; | 107 | _closestPointInB = pointInWorld; |
108 | _distance = depth; | 108 | _distance = depth; |
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | public override void SetShapeIdentifiers(int partId0, int index0, int partId1, int index1) | 112 | public override void SetShapeIdentifiers(int partId0, int index0, int partId1, int index1) |
113 | { | 113 | { |
114 | throw new Exception("The method or operation is not implemented."); | 114 | throw new Exception("The method or operation is not implemented."); |
115 | } | 115 | } |
116 | } | 116 | } |
117 | } | 117 | } |