0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-27 09:50:52 -05:00

skip unnecessary loops in Composites.mesh, closes #85

This commit is contained in:
liabru 2015-05-21 00:07:30 +01:00
parent 8b5192d04d
commit 0a73a64520

View file

@ -119,16 +119,14 @@ var Composites = {};
bodyC;
for (row = 0; row < rows; row++) {
for (col = 0; col < columns; col++) {
if (col > 0) {
bodyA = bodies[(col - 1) + (row * columns)];
bodyB = bodies[col + (row * columns)];
Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyA, bodyB: bodyB }, options)));
}
for (col = 1; col < columns; col++) {
bodyA = bodies[(col - 1) + (row * columns)];
bodyB = bodies[col + (row * columns)];
Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyA, bodyB: bodyB }, options)));
}
for (col = 0; col < columns; col++) {
if (row > 0) {
if (row > 0) {
for (col = 0; col < columns; col++) {
bodyA = bodies[col + ((row - 1) * columns)];
bodyB = bodies[col + (row * columns)];
Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyA, bodyB: bodyB }, options)));