Skip to content

Commit 0a73a64

Browse files
committed
skip unnecessary loops in Composites.mesh, closes #85
1 parent 8b5192d commit 0a73a64

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

src/factory/Composites.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,14 @@ var Composites = {};
119119
bodyC;
120120

121121
for (row = 0; row < rows; row++) {
122-
for (col = 0; col < columns; col++) {
123-
if (col > 0) {
124-
bodyA = bodies[(col - 1) + (row * columns)];
125-
bodyB = bodies[col + (row * columns)];
126-
Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyA, bodyB: bodyB }, options)));
127-
}
122+
for (col = 1; col < columns; col++) {
123+
bodyA = bodies[(col - 1) + (row * columns)];
124+
bodyB = bodies[col + (row * columns)];
125+
Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyA, bodyB: bodyB }, options)));
128126
}
129127

130-
for (col = 0; col < columns; col++) {
131-
if (row > 0) {
128+
if (row > 0) {
129+
for (col = 0; col < columns; col++) {
132130
bodyA = bodies[col + ((row - 1) * columns)];
133131
bodyB = bodies[col + (row * columns)];
134132
Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyA, bodyB: bodyB }, options)));

0 commit comments

Comments
 (0)