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.
- checksums.yaml +4 -4
- data/.mvn/extensions.xml +8 -0
- data/.mvn/wrapper/maven-wrapper.properties +1 -0
- data/.travis.yml +23 -0
- data/CHANGELOG.md +8 -0
- data/README.md +7 -7
- data/Rakefile +1 -2
- data/lib/box2d.jar +0 -0
- data/lib/pbox2d/version.rb +1 -1
- data/lib/pbox2d.rb +1 -0
- data/pbox2d.gemspec +6 -11
- data/pom.rb +59 -0
- data/pom.xml +82 -73
- data/src/org/jbox2d/JBox2D.gwt.xml +12 -0
- data/src/org/jbox2d/callbacks/ContactAdaptor.java +27 -0
- data/src/org/jbox2d/callbacks/ContactFilter.java +59 -0
- data/src/org/jbox2d/callbacks/ContactImpulse.java +42 -0
- data/src/org/jbox2d/callbacks/ContactListener.java +87 -0
- data/src/org/jbox2d/callbacks/DebugDraw.java +297 -0
- data/src/org/jbox2d/callbacks/DestructionListener.java +53 -0
- data/src/org/jbox2d/callbacks/PairCallback.java +29 -0
- data/src/org/jbox2d/callbacks/ParticleDestructionListener.java +20 -0
- data/src/org/jbox2d/callbacks/ParticleQueryCallback.java +19 -0
- data/src/org/jbox2d/callbacks/ParticleRaycastCallback.java +19 -0
- data/src/org/jbox2d/callbacks/QueryCallback.java +45 -0
- data/src/org/jbox2d/callbacks/RayCastCallback.java +55 -0
- data/src/org/jbox2d/callbacks/TreeCallback.java +42 -0
- data/src/org/jbox2d/callbacks/TreeRayCastCallback.java +44 -0
- data/src/org/jbox2d/collision/AABB.java +338 -0
- data/src/org/jbox2d/collision/Collision.java +1444 -0
- data/src/org/jbox2d/collision/ContactID.java +106 -0
- data/src/org/jbox2d/collision/Distance.java +773 -0
- data/src/org/jbox2d/collision/DistanceInput.java +41 -0
- data/src/org/jbox2d/collision/DistanceOutput.java +43 -0
- data/src/org/jbox2d/collision/Manifold.java +116 -0
- data/src/org/jbox2d/collision/ManifoldPoint.java +104 -0
- data/src/org/jbox2d/collision/RayCastInput.java +47 -0
- data/src/org/jbox2d/collision/RayCastOutput.java +46 -0
- data/src/org/jbox2d/collision/TimeOfImpact.java +526 -0
- data/src/org/jbox2d/collision/WorldManifold.java +200 -0
- data/src/org/jbox2d/collision/broadphase/BroadPhase.java +92 -0
- data/src/org/jbox2d/collision/broadphase/BroadPhaseStrategy.java +88 -0
- data/src/org/jbox2d/collision/broadphase/DefaultBroadPhaseBuffer.java +268 -0
- data/src/org/jbox2d/collision/broadphase/DynamicTree.java +883 -0
- data/src/org/jbox2d/collision/broadphase/DynamicTreeFlatNodes.java +873 -0
- data/src/org/jbox2d/collision/broadphase/DynamicTreeNode.java +54 -0
- data/src/org/jbox2d/collision/broadphase/Pair.java +46 -0
- data/src/org/jbox2d/collision/shapes/ChainShape.java +264 -0
- data/src/org/jbox2d/collision/shapes/CircleShape.java +207 -0
- data/src/org/jbox2d/collision/shapes/EdgeShape.java +254 -0
- data/src/org/jbox2d/collision/shapes/MassData.java +105 -0
- data/src/org/jbox2d/collision/shapes/PolygonShape.java +718 -0
- data/src/org/jbox2d/collision/shapes/Shape.java +136 -0
- data/src/org/jbox2d/collision/shapes/ShapeType.java +32 -0
- data/src/org/jbox2d/common/BufferUtils.java +209 -0
- data/src/org/jbox2d/common/Color3f.java +88 -0
- data/src/org/jbox2d/common/IViewportTransform.java +133 -0
- data/src/org/jbox2d/common/Mat22.java +609 -0
- data/src/org/jbox2d/common/Mat33.java +290 -0
- data/src/org/jbox2d/common/MathUtils.java +335 -0
- data/src/org/jbox2d/common/OBBViewportTransform.java +174 -0
- data/src/org/jbox2d/common/PlatformMathUtils.java +46 -0
- data/src/org/jbox2d/common/RaycastResult.java +37 -0
- data/src/org/jbox2d/common/Rot.java +150 -0
- data/src/org/jbox2d/common/Settings.java +246 -0
- data/src/org/jbox2d/common/Sweep.java +116 -0
- data/src/org/jbox2d/common/Timer.java +46 -0
- data/src/org/jbox2d/common/Transform.java +203 -0
- data/src/org/jbox2d/common/Vec2.java +388 -0
- data/src/org/jbox2d/common/Vec3.java +170 -0
- data/src/org/jbox2d/dynamics/Body.java +1246 -0
- data/src/org/jbox2d/dynamics/BodyDef.java +382 -0
- data/src/org/jbox2d/dynamics/BodyType.java +41 -0
- data/src/org/jbox2d/dynamics/ContactManager.java +293 -0
- data/src/org/jbox2d/dynamics/Filter.java +62 -0
- data/src/org/jbox2d/dynamics/Fixture.java +454 -0
- data/src/org/jbox2d/dynamics/FixtureDef.java +214 -0
- data/src/org/jbox2d/dynamics/FixtureProxy.java +38 -0
- data/src/org/jbox2d/dynamics/Island.java +602 -0
- data/src/org/jbox2d/dynamics/Profile.java +97 -0
- data/src/org/jbox2d/dynamics/SolverData.java +33 -0
- data/src/org/jbox2d/dynamics/TimeStep.java +46 -0
- data/src/org/jbox2d/dynamics/World.java +2075 -0
- data/src/org/jbox2d/dynamics/contacts/ChainAndCircleContact.java +57 -0
- data/src/org/jbox2d/dynamics/contacts/ChainAndPolygonContact.java +57 -0
- data/src/org/jbox2d/dynamics/contacts/CircleContact.java +50 -0
- data/src/org/jbox2d/dynamics/contacts/Contact.java +365 -0
- data/src/org/jbox2d/dynamics/contacts/ContactCreator.java +35 -0
- data/src/org/jbox2d/dynamics/contacts/ContactEdge.java +56 -0
- data/src/org/jbox2d/dynamics/contacts/ContactPositionConstraint.java +49 -0
- data/src/org/jbox2d/dynamics/contacts/ContactRegister.java +31 -0
- data/src/org/jbox2d/dynamics/contacts/ContactSolver.java +1104 -0
- data/src/org/jbox2d/dynamics/contacts/ContactVelocityConstraint.java +60 -0
- data/src/org/jbox2d/dynamics/contacts/EdgeAndCircleContact.java +52 -0
- data/src/org/jbox2d/dynamics/contacts/EdgeAndPolygonContact.java +52 -0
- data/src/org/jbox2d/dynamics/contacts/PolygonAndCircleContact.java +51 -0
- data/src/org/jbox2d/dynamics/contacts/PolygonContact.java +50 -0
- data/src/org/jbox2d/dynamics/contacts/Position.java +31 -0
- data/src/org/jbox2d/dynamics/contacts/Velocity.java +31 -0
- data/src/org/jbox2d/dynamics/joints/ConstantVolumeJoint.java +258 -0
- data/src/org/jbox2d/dynamics/joints/ConstantVolumeJointDef.java +75 -0
- data/src/org/jbox2d/dynamics/joints/DistanceJoint.java +356 -0
- data/src/org/jbox2d/dynamics/joints/DistanceJointDef.java +106 -0
- data/src/org/jbox2d/dynamics/joints/FrictionJoint.java +294 -0
- data/src/org/jbox2d/dynamics/joints/FrictionJointDef.java +78 -0
- data/src/org/jbox2d/dynamics/joints/GearJoint.java +520 -0
- data/src/org/jbox2d/dynamics/joints/GearJointDef.java +58 -0
- data/src/org/jbox2d/dynamics/joints/Jacobian.java +32 -0
- data/src/org/jbox2d/dynamics/joints/Joint.java +235 -0
- data/src/org/jbox2d/dynamics/joints/JointDef.java +65 -0
- data/src/org/jbox2d/dynamics/joints/JointEdge.java +57 -0
- data/src/org/jbox2d/dynamics/joints/JointType.java +28 -0
- data/src/org/jbox2d/dynamics/joints/LimitState.java +28 -0
- data/src/org/jbox2d/dynamics/joints/MotorJoint.java +339 -0
- data/src/org/jbox2d/dynamics/joints/MotorJointDef.java +55 -0
- data/src/org/jbox2d/dynamics/joints/MouseJoint.java +262 -0
- data/src/org/jbox2d/dynamics/joints/MouseJointDef.java +62 -0
- data/src/org/jbox2d/dynamics/joints/PrismaticJoint.java +808 -0
- data/src/org/jbox2d/dynamics/joints/PrismaticJointDef.java +120 -0
- data/src/org/jbox2d/dynamics/joints/PulleyJoint.java +393 -0
- data/src/org/jbox2d/dynamics/joints/PulleyJointDef.java +105 -0
- data/src/org/jbox2d/dynamics/joints/RevoluteJoint.java +554 -0
- data/src/org/jbox2d/dynamics/joints/RevoluteJointDef.java +137 -0
- data/src/org/jbox2d/dynamics/joints/RopeJoint.java +276 -0
- data/src/org/jbox2d/dynamics/joints/RopeJointDef.java +34 -0
- data/src/org/jbox2d/dynamics/joints/WeldJoint.java +424 -0
- data/src/org/jbox2d/dynamics/joints/WeldJointDef.java +85 -0
- data/src/org/jbox2d/dynamics/joints/WheelJoint.java +498 -0
- data/src/org/jbox2d/dynamics/joints/WheelJointDef.java +98 -0
- data/src/org/jbox2d/particle/ParticleBodyContact.java +17 -0
- data/src/org/jbox2d/particle/ParticleColor.java +52 -0
- data/src/org/jbox2d/particle/ParticleContact.java +14 -0
- data/src/org/jbox2d/particle/ParticleDef.java +24 -0
- data/src/org/jbox2d/particle/ParticleGroup.java +154 -0
- data/src/org/jbox2d/particle/ParticleGroupDef.java +62 -0
- data/src/org/jbox2d/particle/ParticleGroupType.java +8 -0
- data/src/org/jbox2d/particle/ParticleSystem.java +2172 -0
- data/src/org/jbox2d/particle/ParticleType.java +28 -0
- data/src/org/jbox2d/particle/StackQueue.java +44 -0
- data/src/org/jbox2d/particle/VoronoiDiagram.java +209 -0
- data/src/org/jbox2d/pooling/IDynamicStack.java +47 -0
- data/src/org/jbox2d/pooling/IOrderedStack.java +57 -0
- data/src/org/jbox2d/pooling/IWorldPool.java +101 -0
- data/src/org/jbox2d/pooling/arrays/FloatArray.java +50 -0
- data/src/org/jbox2d/pooling/arrays/GeneratorArray.java +33 -0
- data/src/org/jbox2d/pooling/arrays/IntArray.java +53 -0
- data/src/org/jbox2d/pooling/arrays/Vec2Array.java +57 -0
- data/src/org/jbox2d/pooling/normal/CircleStack.java +77 -0
- data/src/org/jbox2d/pooling/normal/DefaultWorldPool.java +331 -0
- data/src/org/jbox2d/pooling/normal/MutableStack.java +72 -0
- data/src/org/jbox2d/pooling/normal/OrderedStack.java +73 -0
- data/src/org/jbox2d/pooling/stacks/DynamicIntStack.java +60 -0
- metadata +161 -14
- data/lib/jbox2d-library-2.3.1-SNAPSHOT.jar +0 -0
@@ -0,0 +1,57 @@
|
|
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.dynamics.contacts;
|
25
|
+
|
26
|
+
import org.jbox2d.collision.Manifold;
|
27
|
+
import org.jbox2d.collision.shapes.ChainShape;
|
28
|
+
import org.jbox2d.collision.shapes.CircleShape;
|
29
|
+
import org.jbox2d.collision.shapes.EdgeShape;
|
30
|
+
import org.jbox2d.collision.shapes.ShapeType;
|
31
|
+
import org.jbox2d.common.Transform;
|
32
|
+
import org.jbox2d.dynamics.Fixture;
|
33
|
+
import org.jbox2d.pooling.IWorldPool;
|
34
|
+
|
35
|
+
public class ChainAndCircleContact extends Contact {
|
36
|
+
|
37
|
+
public ChainAndCircleContact(IWorldPool argPool) {
|
38
|
+
super(argPool);
|
39
|
+
}
|
40
|
+
|
41
|
+
@Override
|
42
|
+
public void init(Fixture fA, int indexA, Fixture fB, int indexB) {
|
43
|
+
super.init(fA, indexA, fB, indexB);
|
44
|
+
assert (m_fixtureA.getType() == ShapeType.CHAIN);
|
45
|
+
assert (m_fixtureB.getType() == ShapeType.CIRCLE);
|
46
|
+
}
|
47
|
+
|
48
|
+
private final EdgeShape edge = new EdgeShape();
|
49
|
+
|
50
|
+
@Override
|
51
|
+
public void evaluate(Manifold manifold, Transform xfA, Transform xfB) {
|
52
|
+
ChainShape chain = (ChainShape) m_fixtureA.getShape();
|
53
|
+
chain.getChildEdge(edge, m_indexA);
|
54
|
+
pool.getCollision().collideEdgeAndCircle(manifold, edge, xfA,
|
55
|
+
(CircleShape) m_fixtureB.getShape(), xfB);
|
56
|
+
}
|
57
|
+
}
|
@@ -0,0 +1,57 @@
|
|
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.dynamics.contacts;
|
25
|
+
|
26
|
+
import org.jbox2d.collision.Manifold;
|
27
|
+
import org.jbox2d.collision.shapes.ChainShape;
|
28
|
+
import org.jbox2d.collision.shapes.EdgeShape;
|
29
|
+
import org.jbox2d.collision.shapes.PolygonShape;
|
30
|
+
import org.jbox2d.collision.shapes.ShapeType;
|
31
|
+
import org.jbox2d.common.Transform;
|
32
|
+
import org.jbox2d.dynamics.Fixture;
|
33
|
+
import org.jbox2d.pooling.IWorldPool;
|
34
|
+
|
35
|
+
public class ChainAndPolygonContact extends Contact {
|
36
|
+
|
37
|
+
public ChainAndPolygonContact(IWorldPool argPool) {
|
38
|
+
super(argPool);
|
39
|
+
}
|
40
|
+
|
41
|
+
@Override
|
42
|
+
public void init(Fixture fA, int indexA, Fixture fB, int indexB) {
|
43
|
+
super.init(fA, indexA, fB, indexB);
|
44
|
+
assert (m_fixtureA.getType() == ShapeType.CHAIN);
|
45
|
+
assert (m_fixtureB.getType() == ShapeType.POLYGON);
|
46
|
+
}
|
47
|
+
|
48
|
+
private final EdgeShape edge = new EdgeShape();
|
49
|
+
|
50
|
+
@Override
|
51
|
+
public void evaluate(Manifold manifold, Transform xfA, Transform xfB) {
|
52
|
+
ChainShape chain = (ChainShape) m_fixtureA.getShape();
|
53
|
+
chain.getChildEdge(edge, m_indexA);
|
54
|
+
pool.getCollision().collideEdgeAndPolygon(manifold, edge, xfA,
|
55
|
+
(PolygonShape) m_fixtureB.getShape(), xfB);
|
56
|
+
}
|
57
|
+
}
|
@@ -0,0 +1,50 @@
|
|
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.dynamics.contacts;
|
25
|
+
|
26
|
+
import org.jbox2d.collision.Manifold;
|
27
|
+
import org.jbox2d.collision.shapes.CircleShape;
|
28
|
+
import org.jbox2d.collision.shapes.ShapeType;
|
29
|
+
import org.jbox2d.common.Transform;
|
30
|
+
import org.jbox2d.dynamics.Fixture;
|
31
|
+
import org.jbox2d.pooling.IWorldPool;
|
32
|
+
|
33
|
+
public class CircleContact extends Contact {
|
34
|
+
|
35
|
+
public CircleContact(IWorldPool argPool) {
|
36
|
+
super(argPool);
|
37
|
+
}
|
38
|
+
|
39
|
+
public void init(Fixture fixtureA, Fixture fixtureB) {
|
40
|
+
super.init(fixtureA, 0, fixtureB, 0);
|
41
|
+
assert (m_fixtureA.getType() == ShapeType.CIRCLE);
|
42
|
+
assert (m_fixtureB.getType() == ShapeType.CIRCLE);
|
43
|
+
}
|
44
|
+
|
45
|
+
@Override
|
46
|
+
public void evaluate(Manifold manifold, Transform xfA, Transform xfB) {
|
47
|
+
pool.getCollision().collideCircles(manifold, (CircleShape) m_fixtureA.getShape(), xfA,
|
48
|
+
(CircleShape) m_fixtureB.getShape(), xfB);
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1,365 @@
|
|
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.dynamics.contacts;
|
25
|
+
|
26
|
+
|
27
|
+
import org.jbox2d.callbacks.ContactListener;
|
28
|
+
import org.jbox2d.collision.ContactID;
|
29
|
+
import org.jbox2d.collision.Manifold;
|
30
|
+
import org.jbox2d.collision.ManifoldPoint;
|
31
|
+
import org.jbox2d.collision.WorldManifold;
|
32
|
+
import org.jbox2d.collision.shapes.Shape;
|
33
|
+
import org.jbox2d.common.MathUtils;
|
34
|
+
import org.jbox2d.common.Transform;
|
35
|
+
import org.jbox2d.dynamics.Body;
|
36
|
+
import org.jbox2d.dynamics.Fixture;
|
37
|
+
import org.jbox2d.pooling.IWorldPool;
|
38
|
+
|
39
|
+
/**
|
40
|
+
* The class manages contact between two shapes. A contact exists for each overlapping AABB in the
|
41
|
+
* broad-phase (except if filtered). Therefore a contact object may exist that has no contact
|
42
|
+
* points.
|
43
|
+
*
|
44
|
+
* @author daniel
|
45
|
+
*/
|
46
|
+
public abstract class Contact {
|
47
|
+
|
48
|
+
// Flags stored in m_flags
|
49
|
+
// Used when crawling contact graph when forming islands.
|
50
|
+
public static final int ISLAND_FLAG = 0x0001;
|
51
|
+
// Set when the shapes are touching.
|
52
|
+
public static final int TOUCHING_FLAG = 0x0002;
|
53
|
+
// This contact can be disabled (by user)
|
54
|
+
public static final int ENABLED_FLAG = 0x0004;
|
55
|
+
// This contact needs filtering because a fixture filter was changed.
|
56
|
+
public static final int FILTER_FLAG = 0x0008;
|
57
|
+
// This bullet contact had a TOI event
|
58
|
+
public static final int BULLET_HIT_FLAG = 0x0010;
|
59
|
+
|
60
|
+
public static final int TOI_FLAG = 0x0020;
|
61
|
+
|
62
|
+
public int m_flags;
|
63
|
+
|
64
|
+
// World pool and list pointers.
|
65
|
+
public Contact m_prev;
|
66
|
+
public Contact m_next;
|
67
|
+
|
68
|
+
// Nodes for connecting bodies.
|
69
|
+
public ContactEdge m_nodeA = null;
|
70
|
+
public ContactEdge m_nodeB = null;
|
71
|
+
|
72
|
+
public Fixture m_fixtureA;
|
73
|
+
public Fixture m_fixtureB;
|
74
|
+
|
75
|
+
public int m_indexA;
|
76
|
+
public int m_indexB;
|
77
|
+
|
78
|
+
public final Manifold m_manifold;
|
79
|
+
|
80
|
+
public float m_toiCount;
|
81
|
+
public float m_toi;
|
82
|
+
|
83
|
+
public float m_friction;
|
84
|
+
public float m_restitution;
|
85
|
+
|
86
|
+
public float m_tangentSpeed;
|
87
|
+
|
88
|
+
protected final IWorldPool pool;
|
89
|
+
|
90
|
+
protected Contact(IWorldPool argPool) {
|
91
|
+
m_fixtureA = null;
|
92
|
+
m_fixtureB = null;
|
93
|
+
m_nodeA = new ContactEdge();
|
94
|
+
m_nodeB = new ContactEdge();
|
95
|
+
m_manifold = new Manifold();
|
96
|
+
pool = argPool;
|
97
|
+
}
|
98
|
+
|
99
|
+
/** initialization for pooling */
|
100
|
+
public void init(Fixture fA, int indexA, Fixture fB, int indexB) {
|
101
|
+
m_flags = ENABLED_FLAG;
|
102
|
+
|
103
|
+
m_fixtureA = fA;
|
104
|
+
m_fixtureB = fB;
|
105
|
+
|
106
|
+
m_indexA = indexA;
|
107
|
+
m_indexB = indexB;
|
108
|
+
|
109
|
+
m_manifold.pointCount = 0;
|
110
|
+
|
111
|
+
m_prev = null;
|
112
|
+
m_next = null;
|
113
|
+
|
114
|
+
m_nodeA.contact = null;
|
115
|
+
m_nodeA.prev = null;
|
116
|
+
m_nodeA.next = null;
|
117
|
+
m_nodeA.other = null;
|
118
|
+
|
119
|
+
m_nodeB.contact = null;
|
120
|
+
m_nodeB.prev = null;
|
121
|
+
m_nodeB.next = null;
|
122
|
+
m_nodeB.other = null;
|
123
|
+
|
124
|
+
m_toiCount = 0;
|
125
|
+
m_friction = Contact.mixFriction(fA.m_friction, fB.m_friction);
|
126
|
+
m_restitution = Contact.mixRestitution(fA.m_restitution, fB.m_restitution);
|
127
|
+
|
128
|
+
m_tangentSpeed = 0;
|
129
|
+
}
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Get the contact manifold. Do not set the point count to zero. Instead call Disable.
|
133
|
+
*/
|
134
|
+
public Manifold getManifold() {
|
135
|
+
return m_manifold;
|
136
|
+
}
|
137
|
+
|
138
|
+
/**
|
139
|
+
* Get the world manifold.
|
140
|
+
*/
|
141
|
+
public void getWorldManifold(WorldManifold worldManifold) {
|
142
|
+
final Body bodyA = m_fixtureA.getBody();
|
143
|
+
final Body bodyB = m_fixtureB.getBody();
|
144
|
+
final Shape shapeA = m_fixtureA.getShape();
|
145
|
+
final Shape shapeB = m_fixtureB.getShape();
|
146
|
+
|
147
|
+
worldManifold.initialize(m_manifold, bodyA.getTransform(), shapeA.m_radius,
|
148
|
+
bodyB.getTransform(), shapeB.m_radius);
|
149
|
+
}
|
150
|
+
|
151
|
+
/**
|
152
|
+
* Is this contact touching
|
153
|
+
*
|
154
|
+
* @return
|
155
|
+
*/
|
156
|
+
public boolean isTouching() {
|
157
|
+
return (m_flags & TOUCHING_FLAG) == TOUCHING_FLAG;
|
158
|
+
}
|
159
|
+
|
160
|
+
/**
|
161
|
+
* Enable/disable this contact. This can be used inside the pre-solve contact listener. The
|
162
|
+
* contact is only disabled for the current time step (or sub-step in continuous collisions).
|
163
|
+
*
|
164
|
+
* @param flag
|
165
|
+
*/
|
166
|
+
public void setEnabled(boolean flag) {
|
167
|
+
if (flag) {
|
168
|
+
m_flags |= ENABLED_FLAG;
|
169
|
+
} else {
|
170
|
+
m_flags &= ~ENABLED_FLAG;
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
/**
|
175
|
+
* Has this contact been disabled?
|
176
|
+
*
|
177
|
+
* @return
|
178
|
+
*/
|
179
|
+
public boolean isEnabled() {
|
180
|
+
return (m_flags & ENABLED_FLAG) == ENABLED_FLAG;
|
181
|
+
}
|
182
|
+
|
183
|
+
/**
|
184
|
+
* Get the next contact in the world's contact list.
|
185
|
+
*
|
186
|
+
* @return
|
187
|
+
*/
|
188
|
+
public Contact getNext() {
|
189
|
+
return m_next;
|
190
|
+
}
|
191
|
+
|
192
|
+
/**
|
193
|
+
* Get the first fixture in this contact.
|
194
|
+
*
|
195
|
+
* @return
|
196
|
+
*/
|
197
|
+
public Fixture getFixtureA() {
|
198
|
+
return m_fixtureA;
|
199
|
+
}
|
200
|
+
|
201
|
+
public int getChildIndexA() {
|
202
|
+
return m_indexA;
|
203
|
+
}
|
204
|
+
|
205
|
+
/**
|
206
|
+
* Get the second fixture in this contact.
|
207
|
+
*
|
208
|
+
* @return
|
209
|
+
*/
|
210
|
+
public Fixture getFixtureB() {
|
211
|
+
return m_fixtureB;
|
212
|
+
}
|
213
|
+
|
214
|
+
public int getChildIndexB() {
|
215
|
+
return m_indexB;
|
216
|
+
}
|
217
|
+
|
218
|
+
public void setFriction(float friction) {
|
219
|
+
m_friction = friction;
|
220
|
+
}
|
221
|
+
|
222
|
+
public float getFriction() {
|
223
|
+
return m_friction;
|
224
|
+
}
|
225
|
+
|
226
|
+
public void resetFriction() {
|
227
|
+
m_friction = Contact.mixFriction(m_fixtureA.m_friction, m_fixtureB.m_friction);
|
228
|
+
}
|
229
|
+
|
230
|
+
public void setRestitution(float restitution) {
|
231
|
+
m_restitution = restitution;
|
232
|
+
}
|
233
|
+
|
234
|
+
public float getRestitution() {
|
235
|
+
return m_restitution;
|
236
|
+
}
|
237
|
+
|
238
|
+
public void resetRestitution() {
|
239
|
+
m_restitution = Contact.mixRestitution(m_fixtureA.m_restitution, m_fixtureB.m_restitution);
|
240
|
+
}
|
241
|
+
|
242
|
+
public void setTangentSpeed(float speed) {
|
243
|
+
m_tangentSpeed = speed;
|
244
|
+
}
|
245
|
+
|
246
|
+
public float getTangentSpeed() {
|
247
|
+
return m_tangentSpeed;
|
248
|
+
}
|
249
|
+
|
250
|
+
public abstract void evaluate(Manifold manifold, Transform xfA, Transform xfB);
|
251
|
+
|
252
|
+
/**
|
253
|
+
* Flag this contact for filtering. Filtering will occur the next time step.
|
254
|
+
*/
|
255
|
+
public void flagForFiltering() {
|
256
|
+
m_flags |= FILTER_FLAG;
|
257
|
+
}
|
258
|
+
|
259
|
+
// djm pooling
|
260
|
+
private final Manifold oldManifold = new Manifold();
|
261
|
+
|
262
|
+
public void update(ContactListener listener) {
|
263
|
+
|
264
|
+
oldManifold.set(m_manifold);
|
265
|
+
|
266
|
+
// Re-enable this contact.
|
267
|
+
m_flags |= ENABLED_FLAG;
|
268
|
+
|
269
|
+
boolean touching = false;
|
270
|
+
boolean wasTouching = (m_flags & TOUCHING_FLAG) == TOUCHING_FLAG;
|
271
|
+
|
272
|
+
boolean sensorA = m_fixtureA.isSensor();
|
273
|
+
boolean sensorB = m_fixtureB.isSensor();
|
274
|
+
boolean sensor = sensorA || sensorB;
|
275
|
+
|
276
|
+
Body bodyA = m_fixtureA.getBody();
|
277
|
+
Body bodyB = m_fixtureB.getBody();
|
278
|
+
Transform xfA = bodyA.getTransform();
|
279
|
+
Transform xfB = bodyB.getTransform();
|
280
|
+
// log.debug("TransformA: "+xfA);
|
281
|
+
// log.debug("TransformB: "+xfB);
|
282
|
+
|
283
|
+
if (sensor) {
|
284
|
+
Shape shapeA = m_fixtureA.getShape();
|
285
|
+
Shape shapeB = m_fixtureB.getShape();
|
286
|
+
touching = pool.getCollision().testOverlap(shapeA, m_indexA, shapeB, m_indexB, xfA, xfB);
|
287
|
+
|
288
|
+
// Sensors don't generate manifolds.
|
289
|
+
m_manifold.pointCount = 0;
|
290
|
+
} else {
|
291
|
+
evaluate(m_manifold, xfA, xfB);
|
292
|
+
touching = m_manifold.pointCount > 0;
|
293
|
+
|
294
|
+
// Match old contact ids to new contact ids and copy the
|
295
|
+
// stored impulses to warm start the solver.
|
296
|
+
for (int i = 0; i < m_manifold.pointCount; ++i) {
|
297
|
+
ManifoldPoint mp2 = m_manifold.points[i];
|
298
|
+
mp2.normalImpulse = 0.0f;
|
299
|
+
mp2.tangentImpulse = 0.0f;
|
300
|
+
ContactID id2 = mp2.id;
|
301
|
+
|
302
|
+
for (int j = 0; j < oldManifold.pointCount; ++j) {
|
303
|
+
ManifoldPoint mp1 = oldManifold.points[j];
|
304
|
+
|
305
|
+
if (mp1.id.isEqual(id2)) {
|
306
|
+
mp2.normalImpulse = mp1.normalImpulse;
|
307
|
+
mp2.tangentImpulse = mp1.tangentImpulse;
|
308
|
+
break;
|
309
|
+
}
|
310
|
+
}
|
311
|
+
}
|
312
|
+
|
313
|
+
if (touching != wasTouching) {
|
314
|
+
bodyA.setAwake(true);
|
315
|
+
bodyB.setAwake(true);
|
316
|
+
}
|
317
|
+
}
|
318
|
+
|
319
|
+
if (touching) {
|
320
|
+
m_flags |= TOUCHING_FLAG;
|
321
|
+
} else {
|
322
|
+
m_flags &= ~TOUCHING_FLAG;
|
323
|
+
}
|
324
|
+
|
325
|
+
if (listener == null) {
|
326
|
+
return;
|
327
|
+
}
|
328
|
+
|
329
|
+
if (wasTouching == false && touching == true) {
|
330
|
+
listener.beginContact(this);
|
331
|
+
}
|
332
|
+
|
333
|
+
if (wasTouching == true && touching == false) {
|
334
|
+
listener.endContact(this);
|
335
|
+
}
|
336
|
+
|
337
|
+
if (sensor == false && touching) {
|
338
|
+
listener.preSolve(this, oldManifold);
|
339
|
+
}
|
340
|
+
}
|
341
|
+
|
342
|
+
/**
|
343
|
+
* Friction mixing law. The idea is to allow either fixture to drive the restitution to zero. For
|
344
|
+
* example, anything slides on ice.
|
345
|
+
*
|
346
|
+
* @param friction1
|
347
|
+
* @param friction2
|
348
|
+
* @return
|
349
|
+
*/
|
350
|
+
public static final float mixFriction(float friction1, float friction2) {
|
351
|
+
return MathUtils.sqrt(friction1 * friction2);
|
352
|
+
}
|
353
|
+
|
354
|
+
/**
|
355
|
+
* Restitution mixing law. The idea is allow for anything to bounce off an inelastic surface. For
|
356
|
+
* example, a superball bounces on anything.
|
357
|
+
*
|
358
|
+
* @param restitution1
|
359
|
+
* @param restitution2
|
360
|
+
* @return
|
361
|
+
*/
|
362
|
+
public static final float mixRestitution(float restitution1, float restitution2) {
|
363
|
+
return restitution1 > restitution2 ? restitution1 : restitution2;
|
364
|
+
}
|
365
|
+
}
|
@@ -0,0 +1,35 @@
|
|
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.dynamics.contacts;
|
25
|
+
|
26
|
+
import org.jbox2d.dynamics.Fixture;
|
27
|
+
import org.jbox2d.pooling.IWorldPool;
|
28
|
+
|
29
|
+
// updated to rev 100
|
30
|
+
public interface ContactCreator {
|
31
|
+
|
32
|
+
public Contact contactCreateFcn(IWorldPool argPool, Fixture fixtureA, Fixture fixtureB);
|
33
|
+
|
34
|
+
public void contactDestroyFcn(IWorldPool argPool, Contact contact);
|
35
|
+
}
|
@@ -0,0 +1,56 @@
|
|
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.dynamics.contacts;
|
25
|
+
|
26
|
+
import org.jbox2d.dynamics.Body;
|
27
|
+
|
28
|
+
/**
|
29
|
+
* A contact edge is used to connect bodies and contacts together in a contact graph where each body
|
30
|
+
* is a node and each contact is an edge. A contact edge belongs to a doubly linked list maintained
|
31
|
+
* in each attached body. Each contact has two contact nodes, one for each attached body.
|
32
|
+
*
|
33
|
+
* @author daniel
|
34
|
+
*/
|
35
|
+
public class ContactEdge {
|
36
|
+
|
37
|
+
/**
|
38
|
+
* provides quick access to the other body attached.
|
39
|
+
*/
|
40
|
+
public Body other = null;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* the contact
|
44
|
+
*/
|
45
|
+
public Contact contact = null;
|
46
|
+
|
47
|
+
/**
|
48
|
+
* the previous contact edge in the body's contact list
|
49
|
+
*/
|
50
|
+
public ContactEdge prev = null;
|
51
|
+
|
52
|
+
/**
|
53
|
+
* the next contact edge in the body's contact list
|
54
|
+
*/
|
55
|
+
public ContactEdge next = null;
|
56
|
+
}
|
@@ -0,0 +1,49 @@
|
|
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.dynamics.contacts;
|
25
|
+
|
26
|
+
import org.jbox2d.collision.Manifold.ManifoldType;
|
27
|
+
import org.jbox2d.common.Settings;
|
28
|
+
import org.jbox2d.common.Vec2;
|
29
|
+
|
30
|
+
public class ContactPositionConstraint {
|
31
|
+
Vec2[] localPoints = new Vec2[Settings.maxManifoldPoints];
|
32
|
+
final Vec2 localNormal = new Vec2();
|
33
|
+
final Vec2 localPoint = new Vec2();
|
34
|
+
int indexA;
|
35
|
+
int indexB;
|
36
|
+
float invMassA, invMassB;
|
37
|
+
final Vec2 localCenterA = new Vec2();
|
38
|
+
final Vec2 localCenterB = new Vec2();
|
39
|
+
float invIA, invIB;
|
40
|
+
ManifoldType type;
|
41
|
+
float radiusA, radiusB;
|
42
|
+
int pointCount;
|
43
|
+
|
44
|
+
public ContactPositionConstraint() {
|
45
|
+
for (int i = 0; i < localPoints.length; i++) {
|
46
|
+
localPoints[i] = new Vec2();
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|