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,28 @@
|
|
1
|
+
package org.jbox2d.particle;
|
2
|
+
|
3
|
+
/**
|
4
|
+
* The particle type. Can be combined with | operator. Zero means liquid.
|
5
|
+
*
|
6
|
+
* @author dmurph
|
7
|
+
*/
|
8
|
+
public class ParticleType {
|
9
|
+
public static final int b2_waterParticle = 0;
|
10
|
+
/** removed after next step */
|
11
|
+
public static final int b2_zombieParticle = 1 << 1;
|
12
|
+
/** zero velocity */
|
13
|
+
public static final int b2_wallParticle = 1 << 2;
|
14
|
+
/** with restitution from stretching */
|
15
|
+
public static final int b2_springParticle = 1 << 3;
|
16
|
+
/** with restitution from deformation */
|
17
|
+
public static final int b2_elasticParticle = 1 << 4;
|
18
|
+
/** with viscosity */
|
19
|
+
public static final int b2_viscousParticle = 1 << 5;
|
20
|
+
/** without isotropic pressure */
|
21
|
+
public static final int b2_powderParticle = 1 << 6;
|
22
|
+
/** with surface tension */
|
23
|
+
public static final int b2_tensileParticle = 1 << 7;
|
24
|
+
/** mixing color between contacting particles */
|
25
|
+
public static final int b2_colorMixingParticle = 1 << 8;
|
26
|
+
/** call b2DestructionListener on destruction */
|
27
|
+
public static final int b2_destructionListener = 1 << 9;
|
28
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
package org.jbox2d.particle;
|
2
|
+
|
3
|
+
|
4
|
+
public class StackQueue<T> {
|
5
|
+
|
6
|
+
private T[] m_buffer;
|
7
|
+
private int m_front;
|
8
|
+
private int m_back;
|
9
|
+
private int m_end;
|
10
|
+
|
11
|
+
public StackQueue() {}
|
12
|
+
|
13
|
+
public void reset(T[] buffer) {
|
14
|
+
m_buffer = buffer;
|
15
|
+
m_front = 0;
|
16
|
+
m_back = 0;
|
17
|
+
m_end = buffer.length;
|
18
|
+
}
|
19
|
+
|
20
|
+
public void push(T task) {
|
21
|
+
if (m_back >= m_end) {
|
22
|
+
System.arraycopy(m_buffer, m_front, m_buffer, 0, m_back - m_front);
|
23
|
+
m_back -= m_front;
|
24
|
+
m_front = 0;
|
25
|
+
if (m_back >= m_end) {
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
m_buffer[m_back++] = task;
|
30
|
+
}
|
31
|
+
|
32
|
+
public T pop() {
|
33
|
+
assert (m_front < m_back);
|
34
|
+
return m_buffer[m_front++];
|
35
|
+
}
|
36
|
+
|
37
|
+
public boolean empty() {
|
38
|
+
return m_front >= m_back;
|
39
|
+
}
|
40
|
+
|
41
|
+
public T front() {
|
42
|
+
return m_buffer[m_front];
|
43
|
+
}
|
44
|
+
}
|
@@ -0,0 +1,209 @@
|
|
1
|
+
package org.jbox2d.particle;
|
2
|
+
|
3
|
+
import org.jbox2d.common.MathUtils;
|
4
|
+
import org.jbox2d.common.Vec2;
|
5
|
+
import org.jbox2d.pooling.normal.MutableStack;
|
6
|
+
|
7
|
+
public class VoronoiDiagram {
|
8
|
+
public static class Generator {
|
9
|
+
final Vec2 center = new Vec2();
|
10
|
+
int tag;
|
11
|
+
}
|
12
|
+
public static class VoronoiDiagramTask {
|
13
|
+
int m_x, m_y, m_i;
|
14
|
+
Generator m_generator;
|
15
|
+
|
16
|
+
public VoronoiDiagramTask() {}
|
17
|
+
|
18
|
+
public VoronoiDiagramTask(int x, int y, int i, Generator g) {
|
19
|
+
m_x = x;
|
20
|
+
m_y = y;
|
21
|
+
m_i = i;
|
22
|
+
m_generator = g;
|
23
|
+
}
|
24
|
+
|
25
|
+
public VoronoiDiagramTask set(int x, int y, int i, Generator g) {
|
26
|
+
m_x = x;
|
27
|
+
m_y = y;
|
28
|
+
m_i = i;
|
29
|
+
m_generator = g;
|
30
|
+
return this;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
public static interface VoronoiDiagramCallback {
|
35
|
+
void callback(int aTag, int bTag, int cTag);
|
36
|
+
}
|
37
|
+
|
38
|
+
private Generator[] m_generatorBuffer;
|
39
|
+
private int m_generatorCount;
|
40
|
+
private int m_countX, m_countY;
|
41
|
+
// The diagram is an array of "pointers".
|
42
|
+
private Generator[] m_diagram;
|
43
|
+
|
44
|
+
public VoronoiDiagram(int generatorCapacity) {
|
45
|
+
m_generatorBuffer = new Generator[generatorCapacity];
|
46
|
+
for (int i = 0; i < generatorCapacity; i++) {
|
47
|
+
m_generatorBuffer[i] = new Generator();
|
48
|
+
}
|
49
|
+
m_generatorCount = 0;
|
50
|
+
m_countX = 0;
|
51
|
+
m_countY = 0;
|
52
|
+
m_diagram = null;
|
53
|
+
}
|
54
|
+
|
55
|
+
public void getNodes(VoronoiDiagramCallback callback) {
|
56
|
+
for (int y = 0; y < m_countY - 1; y++) {
|
57
|
+
for (int x = 0; x < m_countX - 1; x++) {
|
58
|
+
int i = x + y * m_countX;
|
59
|
+
Generator a = m_diagram[i];
|
60
|
+
Generator b = m_diagram[i + 1];
|
61
|
+
Generator c = m_diagram[i + m_countX];
|
62
|
+
Generator d = m_diagram[i + 1 + m_countX];
|
63
|
+
if (b != c) {
|
64
|
+
if (a != b && a != c) {
|
65
|
+
callback.callback(a.tag, b.tag, c.tag);
|
66
|
+
}
|
67
|
+
if (d != b && d != c) {
|
68
|
+
callback.callback(b.tag, d.tag, c.tag);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
public void addGenerator(Vec2 center, int tag) {
|
76
|
+
Generator g = m_generatorBuffer[m_generatorCount++];
|
77
|
+
g.center.x = center.x;
|
78
|
+
g.center.y = center.y;
|
79
|
+
g.tag = tag;
|
80
|
+
}
|
81
|
+
|
82
|
+
private final Vec2 lower = new Vec2();
|
83
|
+
private final Vec2 upper = new Vec2();
|
84
|
+
private MutableStack<VoronoiDiagramTask> taskPool =
|
85
|
+
new MutableStack<VoronoiDiagram.VoronoiDiagramTask>(50) {
|
86
|
+
@Override
|
87
|
+
protected VoronoiDiagramTask newInstance() {
|
88
|
+
return new VoronoiDiagramTask();
|
89
|
+
}
|
90
|
+
|
91
|
+
@Override
|
92
|
+
protected VoronoiDiagramTask[] newArray(int size) {
|
93
|
+
return new VoronoiDiagramTask[size];
|
94
|
+
}
|
95
|
+
};
|
96
|
+
private final StackQueue<VoronoiDiagramTask> queue = new StackQueue<VoronoiDiagramTask>();
|
97
|
+
|
98
|
+
public void generate(float radius) {
|
99
|
+
assert (m_diagram == null);
|
100
|
+
float inverseRadius = 1 / radius;
|
101
|
+
lower.x = Float.MAX_VALUE;
|
102
|
+
lower.y = Float.MAX_VALUE;
|
103
|
+
upper.x = -Float.MAX_VALUE;
|
104
|
+
upper.y = -Float.MAX_VALUE;
|
105
|
+
for (int k = 0; k < m_generatorCount; k++) {
|
106
|
+
Generator g = m_generatorBuffer[k];
|
107
|
+
Vec2.minToOut(lower, g.center, lower);
|
108
|
+
Vec2.maxToOut(upper, g.center, upper);
|
109
|
+
}
|
110
|
+
m_countX = 1 + (int) (inverseRadius * (upper.x - lower.x));
|
111
|
+
m_countY = 1 + (int) (inverseRadius * (upper.y - lower.y));
|
112
|
+
m_diagram = new Generator[m_countX * m_countY];
|
113
|
+
queue.reset(new VoronoiDiagramTask[4 * m_countX * m_countX]);
|
114
|
+
for (int k = 0; k < m_generatorCount; k++) {
|
115
|
+
Generator g = m_generatorBuffer[k];
|
116
|
+
g.center.x = inverseRadius * (g.center.x - lower.x);
|
117
|
+
g.center.y = inverseRadius * (g.center.y - lower.y);
|
118
|
+
int x = MathUtils.max(0, MathUtils.min((int) g.center.x, m_countX - 1));
|
119
|
+
int y = MathUtils.max(0, MathUtils.min((int) g.center.y, m_countY - 1));
|
120
|
+
queue.push(taskPool.pop().set(x, y, x + y * m_countX, g));
|
121
|
+
}
|
122
|
+
while (!queue.empty()) {
|
123
|
+
VoronoiDiagramTask front = queue.pop();
|
124
|
+
int x = front.m_x;
|
125
|
+
int y = front.m_y;
|
126
|
+
int i = front.m_i;
|
127
|
+
Generator g = front.m_generator;
|
128
|
+
if (m_diagram[i] == null) {
|
129
|
+
m_diagram[i] = g;
|
130
|
+
if (x > 0) {
|
131
|
+
queue.push(taskPool.pop().set(x - 1, y, i - 1, g));
|
132
|
+
}
|
133
|
+
if (y > 0) {
|
134
|
+
queue.push(taskPool.pop().set(x, y - 1, i - m_countX, g));
|
135
|
+
}
|
136
|
+
if (x < m_countX - 1) {
|
137
|
+
queue.push(taskPool.pop().set(x + 1, y, i + 1, g));
|
138
|
+
}
|
139
|
+
if (y < m_countY - 1) {
|
140
|
+
queue.push(taskPool.pop().set(x, y + 1, i + m_countX, g));
|
141
|
+
}
|
142
|
+
}
|
143
|
+
taskPool.push(front);
|
144
|
+
}
|
145
|
+
int maxIteration = m_countX + m_countY;
|
146
|
+
for (int iteration = 0; iteration < maxIteration; iteration++) {
|
147
|
+
for (int y = 0; y < m_countY; y++) {
|
148
|
+
for (int x = 0; x < m_countX - 1; x++) {
|
149
|
+
int i = x + y * m_countX;
|
150
|
+
Generator a = m_diagram[i];
|
151
|
+
Generator b = m_diagram[i + 1];
|
152
|
+
if (a != b) {
|
153
|
+
queue.push(taskPool.pop().set(x, y, i, b));
|
154
|
+
queue.push(taskPool.pop().set(x + 1, y, i + 1, a));
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
for (int y = 0; y < m_countY - 1; y++) {
|
159
|
+
for (int x = 0; x < m_countX; x++) {
|
160
|
+
int i = x + y * m_countX;
|
161
|
+
Generator a = m_diagram[i];
|
162
|
+
Generator b = m_diagram[i + m_countX];
|
163
|
+
if (a != b) {
|
164
|
+
queue.push(taskPool.pop().set(x, y, i, b));
|
165
|
+
queue.push(taskPool.pop().set(x, y + 1, i + m_countX, a));
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
169
|
+
boolean updated = false;
|
170
|
+
while (!queue.empty()) {
|
171
|
+
VoronoiDiagramTask front = queue.pop();
|
172
|
+
int x = front.m_x;
|
173
|
+
int y = front.m_y;
|
174
|
+
int i = front.m_i;
|
175
|
+
Generator k = front.m_generator;
|
176
|
+
Generator a = m_diagram[i];
|
177
|
+
Generator b = k;
|
178
|
+
if (a != b) {
|
179
|
+
float ax = a.center.x - x;
|
180
|
+
float ay = a.center.y - y;
|
181
|
+
float bx = b.center.x - x;
|
182
|
+
float by = b.center.y - y;
|
183
|
+
float a2 = ax * ax + ay * ay;
|
184
|
+
float b2 = bx * bx + by * by;
|
185
|
+
if (a2 > b2) {
|
186
|
+
m_diagram[i] = b;
|
187
|
+
if (x > 0) {
|
188
|
+
queue.push(taskPool.pop().set(x - 1, y, i - 1, b));
|
189
|
+
}
|
190
|
+
if (y > 0) {
|
191
|
+
queue.push(taskPool.pop().set(x, y - 1, i - m_countX, b));
|
192
|
+
}
|
193
|
+
if (x < m_countX - 1) {
|
194
|
+
queue.push(taskPool.pop().set(x + 1, y, i + 1, b));
|
195
|
+
}
|
196
|
+
if (y < m_countY - 1) {
|
197
|
+
queue.push(taskPool.pop().set(x, y + 1, i + m_countX, b));
|
198
|
+
}
|
199
|
+
updated = true;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
taskPool.push(front);
|
203
|
+
}
|
204
|
+
if (!updated) {
|
205
|
+
break;
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
@@ -0,0 +1,47 @@
|
|
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.pooling;
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Same functionality of a regular java.util stack. Object
|
28
|
+
* return order does not matter.
|
29
|
+
* @author Daniel
|
30
|
+
*
|
31
|
+
* @param <E>
|
32
|
+
*/
|
33
|
+
public interface IDynamicStack<E> {
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Pops an item off the stack
|
37
|
+
* @return
|
38
|
+
*/
|
39
|
+
public E pop();
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Pushes an item back on the stack
|
43
|
+
* @param argObject
|
44
|
+
*/
|
45
|
+
public void push(E argObject);
|
46
|
+
|
47
|
+
}
|
@@ -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.pooling;
|
25
|
+
|
26
|
+
/**
|
27
|
+
* This stack assumes that when you push 'n' items back,
|
28
|
+
* you're pushing back the last 'n' items popped.
|
29
|
+
* @author Daniel
|
30
|
+
*
|
31
|
+
* @param <E>
|
32
|
+
*/
|
33
|
+
public interface IOrderedStack<E> {
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Returns the next object in the pool
|
37
|
+
* @return
|
38
|
+
*/
|
39
|
+
public E pop();
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Returns the next 'argNum' objects in the pool
|
43
|
+
* in an array
|
44
|
+
* @param argNum
|
45
|
+
* @return an array containing the next pool objects in
|
46
|
+
* items 0-argNum. Array length and uniqueness not
|
47
|
+
* guaranteed.
|
48
|
+
*/
|
49
|
+
public E[] pop(int argNum);
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Tells the stack to take back the last 'argNum' items
|
53
|
+
* @param argNum
|
54
|
+
*/
|
55
|
+
public void push(int argNum);
|
56
|
+
|
57
|
+
}
|
@@ -0,0 +1,101 @@
|
|
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.pooling;
|
25
|
+
|
26
|
+
import org.jbox2d.collision.AABB;
|
27
|
+
import org.jbox2d.collision.Collision;
|
28
|
+
import org.jbox2d.collision.Distance;
|
29
|
+
import org.jbox2d.collision.TimeOfImpact;
|
30
|
+
import org.jbox2d.common.Mat22;
|
31
|
+
import org.jbox2d.common.Mat33;
|
32
|
+
import org.jbox2d.common.Rot;
|
33
|
+
import org.jbox2d.common.Vec2;
|
34
|
+
import org.jbox2d.common.Vec3;
|
35
|
+
import org.jbox2d.dynamics.contacts.Contact;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* World pool interface
|
39
|
+
* @author Daniel
|
40
|
+
*
|
41
|
+
*/
|
42
|
+
public interface IWorldPool {
|
43
|
+
|
44
|
+
public IDynamicStack<Contact> getPolyContactStack();
|
45
|
+
|
46
|
+
public IDynamicStack<Contact> getCircleContactStack();
|
47
|
+
|
48
|
+
public IDynamicStack<Contact> getPolyCircleContactStack();
|
49
|
+
|
50
|
+
public IDynamicStack<Contact> getEdgeCircleContactStack();
|
51
|
+
|
52
|
+
public IDynamicStack<Contact> getEdgePolyContactStack();
|
53
|
+
|
54
|
+
public IDynamicStack<Contact> getChainCircleContactStack();
|
55
|
+
|
56
|
+
public IDynamicStack<Contact> getChainPolyContactStack();
|
57
|
+
|
58
|
+
public Vec2 popVec2();
|
59
|
+
|
60
|
+
public Vec2[] popVec2(int num);
|
61
|
+
|
62
|
+
public void pushVec2(int num);
|
63
|
+
|
64
|
+
public Vec3 popVec3();
|
65
|
+
|
66
|
+
public Vec3[] popVec3(int num);
|
67
|
+
|
68
|
+
public void pushVec3(int num);
|
69
|
+
|
70
|
+
public Mat22 popMat22();
|
71
|
+
|
72
|
+
public Mat22[] popMat22(int num);
|
73
|
+
|
74
|
+
public void pushMat22(int num);
|
75
|
+
|
76
|
+
public Mat33 popMat33();
|
77
|
+
|
78
|
+
public void pushMat33(int num);
|
79
|
+
|
80
|
+
public AABB popAABB();
|
81
|
+
|
82
|
+
public AABB[] popAABB(int num);
|
83
|
+
|
84
|
+
public void pushAABB(int num);
|
85
|
+
|
86
|
+
public Rot popRot();
|
87
|
+
|
88
|
+
public void pushRot(int num);
|
89
|
+
|
90
|
+
public Collision getCollision();
|
91
|
+
|
92
|
+
public TimeOfImpact getTimeOfImpact();
|
93
|
+
|
94
|
+
public Distance getDistance();
|
95
|
+
|
96
|
+
public float[] getFloatArray(int argLength);
|
97
|
+
|
98
|
+
public int[] getIntArray(int argLength);
|
99
|
+
|
100
|
+
public Vec2[] getVec2Array(int argLength);
|
101
|
+
}
|
@@ -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.pooling.arrays;
|
25
|
+
|
26
|
+
import java.util.HashMap;
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Not thread safe float[] pooling.
|
30
|
+
* @author Daniel
|
31
|
+
*/
|
32
|
+
public class FloatArray {
|
33
|
+
|
34
|
+
private final HashMap<Integer, float[]> map = new HashMap<>();
|
35
|
+
|
36
|
+
public float[] get( int argLength){
|
37
|
+
assert(argLength > 0);
|
38
|
+
|
39
|
+
if(!map.containsKey(argLength)){
|
40
|
+
map.put(argLength, getInitializedArray(argLength));
|
41
|
+
}
|
42
|
+
|
43
|
+
assert(map.get(argLength).length == argLength) : "Array not built of correct length";
|
44
|
+
return map.get(argLength);
|
45
|
+
}
|
46
|
+
|
47
|
+
protected float[] getInitializedArray(int argLength){
|
48
|
+
return new float[argLength];
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
package org.jbox2d.pooling.arrays;
|
2
|
+
|
3
|
+
import java.util.HashMap;
|
4
|
+
|
5
|
+
import org.jbox2d.particle.VoronoiDiagram;
|
6
|
+
|
7
|
+
public class GeneratorArray {
|
8
|
+
|
9
|
+
private final HashMap<Integer, VoronoiDiagram.Generator[]> map;
|
10
|
+
|
11
|
+
public GeneratorArray() {
|
12
|
+
this.map = new HashMap<>();
|
13
|
+
}
|
14
|
+
|
15
|
+
public VoronoiDiagram.Generator[] get(int length) {
|
16
|
+
assert (length > 0);
|
17
|
+
|
18
|
+
if (!map.containsKey(length)) {
|
19
|
+
map.put(length, getInitializedArray(length));
|
20
|
+
}
|
21
|
+
|
22
|
+
assert (map.get(length).length == length) : "Array not built of correct length";
|
23
|
+
return map.get(length);
|
24
|
+
}
|
25
|
+
|
26
|
+
protected VoronoiDiagram.Generator[] getInitializedArray(int length) {
|
27
|
+
final VoronoiDiagram.Generator[] ray = new VoronoiDiagram.Generator[length];
|
28
|
+
for (int i = 0; i < ray.length; i++) {
|
29
|
+
ray[i] = new VoronoiDiagram.Generator();
|
30
|
+
}
|
31
|
+
return ray;
|
32
|
+
}
|
33
|
+
}
|
@@ -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:14:34 AM Jul 17, 2010
|
26
|
+
*/
|
27
|
+
package org.jbox2d.pooling.arrays;
|
28
|
+
|
29
|
+
import java.util.HashMap;
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Not thread safe int[] pooling
|
33
|
+
* @author Daniel Murphy
|
34
|
+
*/
|
35
|
+
public class IntArray {
|
36
|
+
|
37
|
+
private final HashMap<Integer, int[]> map = new HashMap<>();
|
38
|
+
|
39
|
+
public int[] get( int argLength){
|
40
|
+
assert(argLength > 0);
|
41
|
+
|
42
|
+
if(!map.containsKey(argLength)){
|
43
|
+
map.put(argLength, getInitializedArray(argLength));
|
44
|
+
}
|
45
|
+
|
46
|
+
assert(map.get(argLength).length == argLength) : "Array not built of correct length";
|
47
|
+
return map.get(argLength);
|
48
|
+
}
|
49
|
+
|
50
|
+
protected int[] getInitializedArray(int argLength){
|
51
|
+
return new int[argLength];
|
52
|
+
}
|
53
|
+
}
|
@@ -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.pooling.arrays;
|
25
|
+
|
26
|
+
import java.util.HashMap;
|
27
|
+
|
28
|
+
import org.jbox2d.common.Vec2;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* not thread safe Vec2[] pool
|
32
|
+
* @author dmurph
|
33
|
+
*
|
34
|
+
*/
|
35
|
+
public class Vec2Array {
|
36
|
+
|
37
|
+
private final HashMap<Integer, Vec2[]> map = new HashMap<>();
|
38
|
+
|
39
|
+
public Vec2[] get( int argLength){
|
40
|
+
assert(argLength > 0);
|
41
|
+
|
42
|
+
if(!map.containsKey(argLength)){
|
43
|
+
map.put(argLength, getInitializedArray(argLength));
|
44
|
+
}
|
45
|
+
|
46
|
+
assert(map.get(argLength).length == argLength) : "Array not built of correct length";
|
47
|
+
return map.get(argLength);
|
48
|
+
}
|
49
|
+
|
50
|
+
protected Vec2[] getInitializedArray(int argLength){
|
51
|
+
final Vec2[] ray = new Vec2[argLength];
|
52
|
+
for (int i = 0; i < ray.length; i++) {
|
53
|
+
ray[i] = new Vec2();
|
54
|
+
}
|
55
|
+
return ray;
|
56
|
+
}
|
57
|
+
}
|