Skip to content

Commit

Permalink
skip unnecessary loops in Composites.mesh, closes #85
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed May 20, 2015
1 parent 8b5192d commit 0a73a64
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/factory/Composites.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down

0 comments on commit 0a73a64

Please sign in to comment.