pbox2d 0.6.0-java → 0.8.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +8 -0
  3. data/.mvn/wrapper/maven-wrapper.properties +1 -0
  4. data/.travis.yml +23 -0
  5. data/CHANGELOG.md +8 -0
  6. data/README.md +7 -7
  7. data/Rakefile +1 -2
  8. data/lib/box2d.jar +0 -0
  9. data/lib/pbox2d/version.rb +1 -1
  10. data/lib/pbox2d.rb +1 -0
  11. data/pbox2d.gemspec +6 -11
  12. data/pom.rb +59 -0
  13. data/pom.xml +82 -73
  14. data/src/org/jbox2d/JBox2D.gwt.xml +12 -0
  15. data/src/org/jbox2d/callbacks/ContactAdaptor.java +27 -0
  16. data/src/org/jbox2d/callbacks/ContactFilter.java +59 -0
  17. data/src/org/jbox2d/callbacks/ContactImpulse.java +42 -0
  18. data/src/org/jbox2d/callbacks/ContactListener.java +87 -0
  19. data/src/org/jbox2d/callbacks/DebugDraw.java +297 -0
  20. data/src/org/jbox2d/callbacks/DestructionListener.java +53 -0
  21. data/src/org/jbox2d/callbacks/PairCallback.java +29 -0
  22. data/src/org/jbox2d/callbacks/ParticleDestructionListener.java +20 -0
  23. data/src/org/jbox2d/callbacks/ParticleQueryCallback.java +19 -0
  24. data/src/org/jbox2d/callbacks/ParticleRaycastCallback.java +19 -0
  25. data/src/org/jbox2d/callbacks/QueryCallback.java +45 -0
  26. data/src/org/jbox2d/callbacks/RayCastCallback.java +55 -0
  27. data/src/org/jbox2d/callbacks/TreeCallback.java +42 -0
  28. data/src/org/jbox2d/callbacks/TreeRayCastCallback.java +44 -0
  29. data/src/org/jbox2d/collision/AABB.java +338 -0
  30. data/src/org/jbox2d/collision/Collision.java +1444 -0
  31. data/src/org/jbox2d/collision/ContactID.java +106 -0
  32. data/src/org/jbox2d/collision/Distance.java +773 -0
  33. data/src/org/jbox2d/collision/DistanceInput.java +41 -0
  34. data/src/org/jbox2d/collision/DistanceOutput.java +43 -0
  35. data/src/org/jbox2d/collision/Manifold.java +116 -0
  36. data/src/org/jbox2d/collision/ManifoldPoint.java +104 -0
  37. data/src/org/jbox2d/collision/RayCastInput.java +47 -0
  38. data/src/org/jbox2d/collision/RayCastOutput.java +46 -0
  39. data/src/org/jbox2d/collision/TimeOfImpact.java +526 -0
  40. data/src/org/jbox2d/collision/WorldManifold.java +200 -0
  41. data/src/org/jbox2d/collision/broadphase/BroadPhase.java +92 -0
  42. data/src/org/jbox2d/collision/broadphase/BroadPhaseStrategy.java +88 -0
  43. data/src/org/jbox2d/collision/broadphase/DefaultBroadPhaseBuffer.java +268 -0
  44. data/src/org/jbox2d/collision/broadphase/DynamicTree.java +883 -0
  45. data/src/org/jbox2d/collision/broadphase/DynamicTreeFlatNodes.java +873 -0
  46. data/src/org/jbox2d/collision/broadphase/DynamicTreeNode.java +54 -0
  47. data/src/org/jbox2d/collision/broadphase/Pair.java +46 -0
  48. data/src/org/jbox2d/collision/shapes/ChainShape.java +264 -0
  49. data/src/org/jbox2d/collision/shapes/CircleShape.java +207 -0
  50. data/src/org/jbox2d/collision/shapes/EdgeShape.java +254 -0
  51. data/src/org/jbox2d/collision/shapes/MassData.java +105 -0
  52. data/src/org/jbox2d/collision/shapes/PolygonShape.java +718 -0
  53. data/src/org/jbox2d/collision/shapes/Shape.java +136 -0
  54. data/src/org/jbox2d/collision/shapes/ShapeType.java +32 -0
  55. data/src/org/jbox2d/common/BufferUtils.java +209 -0
  56. data/src/org/jbox2d/common/Color3f.java +88 -0
  57. data/src/org/jbox2d/common/IViewportTransform.java +133 -0
  58. data/src/org/jbox2d/common/Mat22.java +609 -0
  59. data/src/org/jbox2d/common/Mat33.java +290 -0
  60. data/src/org/jbox2d/common/MathUtils.java +335 -0
  61. data/src/org/jbox2d/common/OBBViewportTransform.java +174 -0
  62. data/src/org/jbox2d/common/PlatformMathUtils.java +46 -0
  63. data/src/org/jbox2d/common/RaycastResult.java +37 -0
  64. data/src/org/jbox2d/common/Rot.java +150 -0
  65. data/src/org/jbox2d/common/Settings.java +246 -0
  66. data/src/org/jbox2d/common/Sweep.java +116 -0
  67. data/src/org/jbox2d/common/Timer.java +46 -0
  68. data/src/org/jbox2d/common/Transform.java +203 -0
  69. data/src/org/jbox2d/common/Vec2.java +388 -0
  70. data/src/org/jbox2d/common/Vec3.java +170 -0
  71. data/src/org/jbox2d/dynamics/Body.java +1246 -0
  72. data/src/org/jbox2d/dynamics/BodyDef.java +382 -0
  73. data/src/org/jbox2d/dynamics/BodyType.java +41 -0
  74. data/src/org/jbox2d/dynamics/ContactManager.java +293 -0
  75. data/src/org/jbox2d/dynamics/Filter.java +62 -0
  76. data/src/org/jbox2d/dynamics/Fixture.java +454 -0
  77. data/src/org/jbox2d/dynamics/FixtureDef.java +214 -0
  78. data/src/org/jbox2d/dynamics/FixtureProxy.java +38 -0
  79. data/src/org/jbox2d/dynamics/Island.java +602 -0
  80. data/src/org/jbox2d/dynamics/Profile.java +97 -0
  81. data/src/org/jbox2d/dynamics/SolverData.java +33 -0
  82. data/src/org/jbox2d/dynamics/TimeStep.java +46 -0
  83. data/src/org/jbox2d/dynamics/World.java +2075 -0
  84. data/src/org/jbox2d/dynamics/contacts/ChainAndCircleContact.java +57 -0
  85. data/src/org/jbox2d/dynamics/contacts/ChainAndPolygonContact.java +57 -0
  86. data/src/org/jbox2d/dynamics/contacts/CircleContact.java +50 -0
  87. data/src/org/jbox2d/dynamics/contacts/Contact.java +365 -0
  88. data/src/org/jbox2d/dynamics/contacts/ContactCreator.java +35 -0
  89. data/src/org/jbox2d/dynamics/contacts/ContactEdge.java +56 -0
  90. data/src/org/jbox2d/dynamics/contacts/ContactPositionConstraint.java +49 -0
  91. data/src/org/jbox2d/dynamics/contacts/ContactRegister.java +31 -0
  92. data/src/org/jbox2d/dynamics/contacts/ContactSolver.java +1104 -0
  93. data/src/org/jbox2d/dynamics/contacts/ContactVelocityConstraint.java +60 -0
  94. data/src/org/jbox2d/dynamics/contacts/EdgeAndCircleContact.java +52 -0
  95. data/src/org/jbox2d/dynamics/contacts/EdgeAndPolygonContact.java +52 -0
  96. data/src/org/jbox2d/dynamics/contacts/PolygonAndCircleContact.java +51 -0
  97. data/src/org/jbox2d/dynamics/contacts/PolygonContact.java +50 -0
  98. data/src/org/jbox2d/dynamics/contacts/Position.java +31 -0
  99. data/src/org/jbox2d/dynamics/contacts/Velocity.java +31 -0
  100. data/src/org/jbox2d/dynamics/joints/ConstantVolumeJoint.java +258 -0
  101. data/src/org/jbox2d/dynamics/joints/ConstantVolumeJointDef.java +75 -0
  102. data/src/org/jbox2d/dynamics/joints/DistanceJoint.java +356 -0
  103. data/src/org/jbox2d/dynamics/joints/DistanceJointDef.java +106 -0
  104. data/src/org/jbox2d/dynamics/joints/FrictionJoint.java +294 -0
  105. data/src/org/jbox2d/dynamics/joints/FrictionJointDef.java +78 -0
  106. data/src/org/jbox2d/dynamics/joints/GearJoint.java +520 -0
  107. data/src/org/jbox2d/dynamics/joints/GearJointDef.java +58 -0
  108. data/src/org/jbox2d/dynamics/joints/Jacobian.java +32 -0
  109. data/src/org/jbox2d/dynamics/joints/Joint.java +235 -0
  110. data/src/org/jbox2d/dynamics/joints/JointDef.java +65 -0
  111. data/src/org/jbox2d/dynamics/joints/JointEdge.java +57 -0
  112. data/src/org/jbox2d/dynamics/joints/JointType.java +28 -0
  113. data/src/org/jbox2d/dynamics/joints/LimitState.java +28 -0
  114. data/src/org/jbox2d/dynamics/joints/MotorJoint.java +339 -0
  115. data/src/org/jbox2d/dynamics/joints/MotorJointDef.java +55 -0
  116. data/src/org/jbox2d/dynamics/joints/MouseJoint.java +262 -0
  117. data/src/org/jbox2d/dynamics/joints/MouseJointDef.java +62 -0
  118. data/src/org/jbox2d/dynamics/joints/PrismaticJoint.java +808 -0
  119. data/src/org/jbox2d/dynamics/joints/PrismaticJointDef.java +120 -0
  120. data/src/org/jbox2d/dynamics/joints/PulleyJoint.java +393 -0
  121. data/src/org/jbox2d/dynamics/joints/PulleyJointDef.java +105 -0
  122. data/src/org/jbox2d/dynamics/joints/RevoluteJoint.java +554 -0
  123. data/src/org/jbox2d/dynamics/joints/RevoluteJointDef.java +137 -0
  124. data/src/org/jbox2d/dynamics/joints/RopeJoint.java +276 -0
  125. data/src/org/jbox2d/dynamics/joints/RopeJointDef.java +34 -0
  126. data/src/org/jbox2d/dynamics/joints/WeldJoint.java +424 -0
  127. data/src/org/jbox2d/dynamics/joints/WeldJointDef.java +85 -0
  128. data/src/org/jbox2d/dynamics/joints/WheelJoint.java +498 -0
  129. data/src/org/jbox2d/dynamics/joints/WheelJointDef.java +98 -0
  130. data/src/org/jbox2d/particle/ParticleBodyContact.java +17 -0
  131. data/src/org/jbox2d/particle/ParticleColor.java +52 -0
  132. data/src/org/jbox2d/particle/ParticleContact.java +14 -0
  133. data/src/org/jbox2d/particle/ParticleDef.java +24 -0
  134. data/src/org/jbox2d/particle/ParticleGroup.java +154 -0
  135. data/src/org/jbox2d/particle/ParticleGroupDef.java +62 -0
  136. data/src/org/jbox2d/particle/ParticleGroupType.java +8 -0
  137. data/src/org/jbox2d/particle/ParticleSystem.java +2172 -0
  138. data/src/org/jbox2d/particle/ParticleType.java +28 -0
  139. data/src/org/jbox2d/particle/StackQueue.java +44 -0
  140. data/src/org/jbox2d/particle/VoronoiDiagram.java +209 -0
  141. data/src/org/jbox2d/pooling/IDynamicStack.java +47 -0
  142. data/src/org/jbox2d/pooling/IOrderedStack.java +57 -0
  143. data/src/org/jbox2d/pooling/IWorldPool.java +101 -0
  144. data/src/org/jbox2d/pooling/arrays/FloatArray.java +50 -0
  145. data/src/org/jbox2d/pooling/arrays/GeneratorArray.java +33 -0
  146. data/src/org/jbox2d/pooling/arrays/IntArray.java +53 -0
  147. data/src/org/jbox2d/pooling/arrays/Vec2Array.java +57 -0
  148. data/src/org/jbox2d/pooling/normal/CircleStack.java +77 -0
  149. data/src/org/jbox2d/pooling/normal/DefaultWorldPool.java +331 -0
  150. data/src/org/jbox2d/pooling/normal/MutableStack.java +72 -0
  151. data/src/org/jbox2d/pooling/normal/OrderedStack.java +73 -0
  152. data/src/org/jbox2d/pooling/stacks/DynamicIntStack.java +60 -0
  153. metadata +161 -14
  154. data/lib/jbox2d-library-2.3.1-SNAPSHOT.jar +0 -0
@@ -0,0 +1,297 @@
1
+ /*******************************************************************************
2
+ * Copyright (c) 2013, Daniel Murphy
3
+ * All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without modification,
6
+ * are permitted provided that the following conditions are met:
7
+ * * Redistributions of source code must retain the above copyright notice,
8
+ * this list of conditions and the following disclaimer.
9
+ * * Redistributions in binary form must reproduce the above copyright notice,
10
+ * this list of conditions and the following disclaimer in the documentation
11
+ * and/or other materials provided with the distribution.
12
+ *
13
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
17
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
19
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
+ * POSSIBILITY OF SUCH DAMAGE.
23
+ ******************************************************************************/
24
+ /**
25
+ * Created at 4:35:29 AM Jul 15, 2010
26
+ */
27
+ package org.jbox2d.callbacks;
28
+
29
+ import org.jbox2d.common.Color3f;
30
+ import org.jbox2d.common.IViewportTransform;
31
+ import org.jbox2d.common.Transform;
32
+ import org.jbox2d.common.Vec2;
33
+ import org.jbox2d.particle.ParticleColor;
34
+
35
+ /**
36
+ * Implement this abstract class to allow JBox2d to automatically draw your physics for debugging
37
+ * purposes. Not intended to replace your own custom rendering routines!
38
+ *
39
+ * @author Daniel Murphy
40
+ */
41
+ public abstract class DebugDraw {
42
+
43
+ /** Draw shapes */
44
+ public static final int e_shapeBit = 1 << 1;
45
+ /** Draw joint connections */
46
+ public static final int e_jointBit = 1 << 2;
47
+ /** Draw axis aligned bounding boxes */
48
+ public static final int e_aabbBit = 1 << 3;
49
+ /** Draw pairs of connected objects */
50
+ public static final int e_pairBit = 1 << 4;
51
+ /** Draw center of mass frame */
52
+ public static final int e_centerOfMassBit = 1 << 5;
53
+ /** Draw dynamic tree */
54
+ public static final int e_dynamicTreeBit = 1 << 6;
55
+ /** Draw only the wireframe for drawing performance */
56
+ public static final int e_wireframeDrawingBit = 1 << 7;
57
+
58
+
59
+ protected int m_drawFlags;
60
+ protected IViewportTransform viewportTransform;
61
+
62
+ public DebugDraw() {
63
+ this(null);
64
+ }
65
+
66
+ public DebugDraw(IViewportTransform viewport) {
67
+ m_drawFlags = 0;
68
+ viewportTransform = viewport;
69
+ }
70
+
71
+ public void setViewportTransform(IViewportTransform viewportTransform) {
72
+ this.viewportTransform = viewportTransform;
73
+ }
74
+
75
+ public void setFlags(int flags) {
76
+ m_drawFlags = flags;
77
+ }
78
+
79
+ public int getFlags() {
80
+ return m_drawFlags;
81
+ }
82
+
83
+ public void appendFlags(int flags) {
84
+ m_drawFlags |= flags;
85
+ }
86
+
87
+ public void clearFlags(int flags) {
88
+ m_drawFlags &= ~flags;
89
+ }
90
+
91
+ /**
92
+ * Draw a closed polygon provided in CCW order. This implementation uses
93
+ * {@link #drawSegment(Vec2, Vec2, Color3f)} to draw each side of the polygon.
94
+ *
95
+ * @param vertices
96
+ * @param vertexCount
97
+ * @param color
98
+ */
99
+ public void drawPolygon(Vec2[] vertices, int vertexCount, Color3f color) {
100
+ if (vertexCount == 1) {
101
+ drawSegment(vertices[0], vertices[0], color);
102
+ return;
103
+ }
104
+
105
+ for (int i = 0; i < vertexCount - 1; i += 1) {
106
+ drawSegment(vertices[i], vertices[i + 1], color);
107
+ }
108
+
109
+ if (vertexCount > 2) {
110
+ drawSegment(vertices[vertexCount - 1], vertices[0], color);
111
+ }
112
+ }
113
+
114
+ public abstract void drawPoint(Vec2 argPoint, float argRadiusOnScreen, Color3f argColor);
115
+
116
+ /**
117
+ * Draw a solid closed polygon provided in CCW order.
118
+ *
119
+ * @param vertices
120
+ * @param vertexCount
121
+ * @param color
122
+ */
123
+ public abstract void drawSolidPolygon(Vec2[] vertices, int vertexCount, Color3f color);
124
+
125
+ /**
126
+ * Draw a circle.
127
+ *
128
+ * @param center
129
+ * @param radius
130
+ * @param color
131
+ */
132
+ public abstract void drawCircle(Vec2 center, float radius, Color3f color);
133
+
134
+ /** Draws a circle with an axis */
135
+ public void drawCircle(Vec2 center, float radius, Vec2 axis, Color3f color) {
136
+ drawCircle(center, radius, color);
137
+ }
138
+
139
+ /**
140
+ * Draw a solid circle.
141
+ *
142
+ * @param center
143
+ * @param radius
144
+ * @param axis
145
+ * @param color
146
+ */
147
+ public abstract void drawSolidCircle(Vec2 center, float radius, Vec2 axis, Color3f color);
148
+
149
+ /**
150
+ * Draw a line segment.
151
+ *
152
+ * @param p1
153
+ * @param p2
154
+ * @param color
155
+ */
156
+ public abstract void drawSegment(Vec2 p1, Vec2 p2, Color3f color);
157
+
158
+ /**
159
+ * Draw a transform. Choose your own length scale
160
+ *
161
+ * @param xf
162
+ */
163
+ public abstract void drawTransform(Transform xf);
164
+
165
+ /**
166
+ * Draw a string.
167
+ *
168
+ * @param x
169
+ * @param y
170
+ * @param s
171
+ * @param color
172
+ */
173
+ public abstract void drawString(float x, float y, String s, Color3f color);
174
+
175
+ /**
176
+ * Draw a particle array
177
+ *
178
+ * @param colors can be null
179
+ */
180
+ public abstract void drawParticles(Vec2[] centers, float radius, ParticleColor[] colors, int count);
181
+
182
+ /**
183
+ * Draw a particle array
184
+ *
185
+ * @param colors can be null
186
+ */
187
+ public abstract void drawParticlesWireframe(Vec2[] centers, float radius, ParticleColor[] colors,
188
+ int count);
189
+
190
+ /** Called at the end of drawing a world */
191
+ public void flush() {}
192
+
193
+ public void drawString(Vec2 pos, String s, Color3f color) {
194
+ drawString(pos.x, pos.y, s, color);
195
+ }
196
+
197
+ public IViewportTransform getViewportTranform() {
198
+ return viewportTransform;
199
+ }
200
+
201
+ /**
202
+ * @param x
203
+ * @param y
204
+ * @param scale
205
+ * @deprecated use the viewport transform in {@link #getViewportTranform()}
206
+ */
207
+ public void setCamera(float x, float y, float scale) {
208
+ viewportTransform.setCamera(x, y, scale);
209
+ }
210
+
211
+
212
+ /**
213
+ * @param argScreen
214
+ * @param argWorld
215
+ */
216
+ public void getScreenToWorldToOut(Vec2 argScreen, Vec2 argWorld) {
217
+ viewportTransform.getScreenToWorld(argScreen, argWorld);
218
+ }
219
+
220
+ /**
221
+ * @param argWorld
222
+ * @param argScreen
223
+ */
224
+ public void getWorldToScreenToOut(Vec2 argWorld, Vec2 argScreen) {
225
+ viewportTransform.getWorldToScreen(argWorld, argScreen);
226
+ }
227
+
228
+ /**
229
+ * Takes the world coordinates and puts the corresponding screen coordinates in argScreen.
230
+ *
231
+ * @param worldX
232
+ * @param worldY
233
+ * @param argScreen
234
+ */
235
+ public void getWorldToScreenToOut(float worldX, float worldY, Vec2 argScreen) {
236
+ argScreen.set(worldX, worldY);
237
+ viewportTransform.getWorldToScreen(argScreen, argScreen);
238
+ }
239
+
240
+ /**
241
+ * takes the world coordinate (argWorld) and returns the screen coordinates.
242
+ *
243
+ * @param argWorld
244
+ */
245
+ public Vec2 getWorldToScreen(Vec2 argWorld) {
246
+ Vec2 screen = new Vec2();
247
+ viewportTransform.getWorldToScreen(argWorld, screen);
248
+ return screen;
249
+ }
250
+
251
+ /**
252
+ * Takes the world coordinates and returns the screen coordinates.
253
+ *
254
+ * @param worldX
255
+ * @param worldY
256
+ */
257
+ public Vec2 getWorldToScreen(float worldX, float worldY) {
258
+ Vec2 argScreen = new Vec2(worldX, worldY);
259
+ viewportTransform.getWorldToScreen(argScreen, argScreen);
260
+ return argScreen;
261
+ }
262
+
263
+ /**
264
+ * takes the screen coordinates and puts the corresponding world coordinates in argWorld.
265
+ *
266
+ * @param screenX
267
+ * @param screenY
268
+ * @param argWorld
269
+ */
270
+ public void getScreenToWorldToOut(float screenX, float screenY, Vec2 argWorld) {
271
+ argWorld.set(screenX, screenY);
272
+ viewportTransform.getScreenToWorld(argWorld, argWorld);
273
+ }
274
+
275
+ /**
276
+ * takes the screen coordinates (argScreen) and returns the world coordinates
277
+ *
278
+ * @param argScreen
279
+ */
280
+ public Vec2 getScreenToWorld(Vec2 argScreen) {
281
+ Vec2 world = new Vec2();
282
+ viewportTransform.getScreenToWorld(argScreen, world);
283
+ return world;
284
+ }
285
+
286
+ /**
287
+ * takes the screen coordinates and returns the world coordinates.
288
+ *
289
+ * @param screenX
290
+ * @param screenY
291
+ */
292
+ public Vec2 getScreenToWorld(float screenX, float screenY) {
293
+ Vec2 screen = new Vec2(screenX, screenY);
294
+ viewportTransform.getScreenToWorld(screen, screen);
295
+ return screen;
296
+ }
297
+ }
@@ -0,0 +1,53 @@
1
+ /*******************************************************************************
2
+ * Copyright (c) 2013, Daniel Murphy
3
+ * All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without modification,
6
+ * are permitted provided that the following conditions are met:
7
+ * * Redistributions of source code must retain the above copyright notice,
8
+ * this list of conditions and the following disclaimer.
9
+ * * Redistributions in binary form must reproduce the above copyright notice,
10
+ * this list of conditions and the following disclaimer in the documentation
11
+ * and/or other materials provided with the distribution.
12
+ *
13
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
17
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
19
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
+ * POSSIBILITY OF SUCH DAMAGE.
23
+ ******************************************************************************/
24
+ /**
25
+ * Created at 4:23:30 AM Jul 15, 2010
26
+ */
27
+ package org.jbox2d.callbacks;
28
+
29
+ import org.jbox2d.dynamics.Fixture;
30
+ import org.jbox2d.dynamics.joints.Joint;
31
+
32
+ /**
33
+ * Joints and fixtures are destroyed when their associated
34
+ * body is destroyed. Implement this listener so that you
35
+ * may nullify references to these joints and shapes.
36
+ * @author Daniel Murphy
37
+ */
38
+ public interface DestructionListener {
39
+
40
+ /**
41
+ * Called when any joint is about to be destroyed due
42
+ * to the destruction of one of its attached bodies.
43
+ * @param joint
44
+ */
45
+ void sayGoodbye(Joint joint);
46
+
47
+ /**
48
+ * Called when any fixture is about to be destroyed due
49
+ * to the destruction of its parent body.
50
+ * @param fixture
51
+ */
52
+ void sayGoodbye(Fixture fixture);
53
+ }
@@ -0,0 +1,29 @@
1
+ /*******************************************************************************
2
+ * Copyright (c) 2013, Daniel Murphy
3
+ * All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without modification,
6
+ * are permitted provided that the following conditions are met:
7
+ * * Redistributions of source code must retain the above copyright notice,
8
+ * this list of conditions and the following disclaimer.
9
+ * * Redistributions in binary form must reproduce the above copyright notice,
10
+ * this list of conditions and the following disclaimer in the documentation
11
+ * and/or other materials provided with the distribution.
12
+ *
13
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
17
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
19
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
+ * POSSIBILITY OF SUCH DAMAGE.
23
+ ******************************************************************************/
24
+ package org.jbox2d.callbacks;
25
+
26
+ // updated to rev 100
27
+ public interface PairCallback {
28
+ public void addPair(Object userDataA, Object userDataB);
29
+ }
@@ -0,0 +1,20 @@
1
+ package org.jbox2d.callbacks;
2
+
3
+ import org.jbox2d.dynamics.World;
4
+ import org.jbox2d.particle.ParticleGroup;
5
+
6
+ public interface ParticleDestructionListener {
7
+ /**
8
+ * Called when any particle group is about to be destroyed.
9
+ * @param group
10
+ */
11
+ void sayGoodbye(ParticleGroup group);
12
+
13
+ /**
14
+ * Called when a particle is about to be destroyed. The index can be used in conjunction with
15
+ * {@link World#getParticleUserDataBuffer} to determine which particle has been destroyed.
16
+ *
17
+ * @param index
18
+ */
19
+ void sayGoodbye(int index);
20
+ }
@@ -0,0 +1,19 @@
1
+ package org.jbox2d.callbacks;
2
+
3
+ import org.jbox2d.dynamics.World;
4
+
5
+ /**
6
+ * Callback class for AABB queries. See
7
+ * {@link World#queryAABB(QueryCallback, org.jbox2d.collision.AABB)}.
8
+ *
9
+ * @author dmurph
10
+ *
11
+ */
12
+ public interface ParticleQueryCallback {
13
+ /**
14
+ * Called for each particle found in the query AABB.
15
+ *
16
+ * @return false to terminate the query.
17
+ */
18
+ boolean reportParticle(int index);
19
+ }
@@ -0,0 +1,19 @@
1
+ package org.jbox2d.callbacks;
2
+
3
+ import org.jbox2d.common.Vec2;
4
+
5
+ public interface ParticleRaycastCallback {
6
+ /**
7
+ * Called for each particle found in the query. See
8
+ * {@link RayCastCallback#reportFixture(org.jbox2d.dynamics.Fixture, Vec2, Vec2, float)} for
9
+ * argument info.
10
+ *
11
+ * @param index
12
+ * @param point
13
+ * @param normal
14
+ * @param fraction
15
+ * @return
16
+ */
17
+ float reportParticle(int index, Vec2 point, Vec2 normal, float fraction);
18
+
19
+ }
@@ -0,0 +1,45 @@
1
+ /*******************************************************************************
2
+ * Copyright (c) 2013, Daniel Murphy
3
+ * All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without modification,
6
+ * are permitted provided that the following conditions are met:
7
+ * * Redistributions of source code must retain the above copyright notice,
8
+ * this list of conditions and the following disclaimer.
9
+ * * Redistributions in binary form must reproduce the above copyright notice,
10
+ * this list of conditions and the following disclaimer in the documentation
11
+ * and/or other materials provided with the distribution.
12
+ *
13
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
17
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
19
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
+ * POSSIBILITY OF SUCH DAMAGE.
23
+ ******************************************************************************/
24
+ /**
25
+ * Created at 4:30:03 AM Jul 15, 2010
26
+ */
27
+ package org.jbox2d.callbacks;
28
+
29
+ import org.jbox2d.dynamics.Fixture;
30
+ import org.jbox2d.dynamics.World;
31
+
32
+ /**
33
+ * Callback class for AABB queries.
34
+ * See {@link World#queryAABB(QueryCallback, org.jbox2d.collision.AABB)}.
35
+ * @author Daniel Murphy
36
+ */
37
+ public interface QueryCallback {
38
+
39
+ /**
40
+ * Called for each fixture found in the query AABB.
41
+ * @param fixture
42
+ * @return false to terminate the query.
43
+ */
44
+ public boolean reportFixture(Fixture fixture);
45
+ }
@@ -0,0 +1,55 @@
1
+ /*******************************************************************************
2
+ * Copyright (c) 2013, Daniel Murphy
3
+ * All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without modification,
6
+ * are permitted provided that the following conditions are met:
7
+ * * Redistributions of source code must retain the above copyright notice,
8
+ * this list of conditions and the following disclaimer.
9
+ * * Redistributions in binary form must reproduce the above copyright notice,
10
+ * this list of conditions and the following disclaimer in the documentation
11
+ * and/or other materials provided with the distribution.
12
+ *
13
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
17
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
19
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
+ * POSSIBILITY OF SUCH DAMAGE.
23
+ ******************************************************************************/
24
+ /**
25
+ * Created at 4:33:10 AM Jul 15, 2010
26
+ */
27
+ package org.jbox2d.callbacks;
28
+
29
+ import org.jbox2d.common.Vec2;
30
+ import org.jbox2d.dynamics.Fixture;
31
+ import org.jbox2d.dynamics.World;
32
+
33
+ /**
34
+ * Callback class for ray casts.
35
+ * See {@link World#raycast(RayCastCallback, Vec2, Vec2)}
36
+ * @author Daniel Murphy
37
+ */
38
+ public interface RayCastCallback {
39
+
40
+ /**
41
+ * Called for each fixture found in the query. You control how the ray cast
42
+ * proceeds by returning a float:
43
+ * return -1: ignore this fixture and continue
44
+ * return 0: terminate the ray cast
45
+ * return fraction: clip the ray to this point
46
+ * return 1: don't clip the ray and continue
47
+ * @param fixture the fixture hit by the ray
48
+ * @param point the point of initial intersection
49
+ * @param normal the normal vector at the point of intersection
50
+ * @return -1 to filter, 0 to terminate, fraction to clip the ray for
51
+ * closest hit, 1 to continue
52
+ * @param fraction
53
+ */
54
+ public float reportFixture(Fixture fixture, Vec2 point, Vec2 normal, float fraction);
55
+ }
@@ -0,0 +1,42 @@
1
+ /*******************************************************************************
2
+ * Copyright (c) 2013, Daniel Murphy
3
+ * All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without modification,
6
+ * are permitted provided that the following conditions are met:
7
+ * * Redistributions of source code must retain the above copyright notice,
8
+ * this list of conditions and the following disclaimer.
9
+ * * Redistributions in binary form must reproduce the above copyright notice,
10
+ * this list of conditions and the following disclaimer in the documentation
11
+ * and/or other materials provided with the distribution.
12
+ *
13
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
17
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
19
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
+ * POSSIBILITY OF SUCH DAMAGE.
23
+ ******************************************************************************/
24
+ package org.jbox2d.callbacks;
25
+
26
+ import org.jbox2d.collision.broadphase.DynamicTree;
27
+
28
+ // update to rev 100
29
+ /**
30
+ * callback for {@link DynamicTree}
31
+ * @author Daniel Murphy
32
+ *
33
+ */
34
+ public interface TreeCallback {
35
+
36
+ /**
37
+ * Callback from a query request.
38
+ * @param proxyId the id of the proxy
39
+ * @return if the query should be continued
40
+ */
41
+ public boolean treeCallback(int proxyId);
42
+ }
@@ -0,0 +1,44 @@
1
+ /*******************************************************************************
2
+ * Copyright (c) 2013, Daniel Murphy
3
+ * All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without modification,
6
+ * are permitted provided that the following conditions are met:
7
+ * * Redistributions of source code must retain the above copyright notice,
8
+ * this list of conditions and the following disclaimer.
9
+ * * Redistributions in binary form must reproduce the above copyright notice,
10
+ * this list of conditions and the following disclaimer in the documentation
11
+ * and/or other materials provided with the distribution.
12
+ *
13
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
17
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
19
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
+ * POSSIBILITY OF SUCH DAMAGE.
23
+ ******************************************************************************/
24
+ package org.jbox2d.callbacks;
25
+
26
+ import org.jbox2d.collision.RayCastInput;
27
+ import org.jbox2d.collision.broadphase.DynamicTree;
28
+
29
+ // updated to rev 100
30
+
31
+ /**
32
+ * callback for {@link DynamicTree}
33
+ * @author Daniel Murphy
34
+ *
35
+ */
36
+ public interface TreeRayCastCallback {
37
+ /**
38
+ *
39
+ * @param input
40
+ * @param nodeId
41
+ * @return the fraction to the node
42
+ */
43
+ public float raycastCallback( RayCastInput input, int nodeId);
44
+ }