Skip to content

Commit

Permalink
removed complexity check in Bodies.fromVertices, enforce clockwise sort
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Mar 1, 2015
1 parent 90adf14 commit 2d1ef0d
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/factory/Bodies.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ var Bodies = {};
// vertices are convex, so just create a body normally
body = {
position: { x: x, y: y },
vertices: vertices
vertices: Vertices.clockwiseSort(vertices)
};

return Body.create(Common.extend({}, body, options));
Expand All @@ -209,12 +209,6 @@ var Bodies = {};
concave.vertices.push([vertices[i].x, vertices[i].y]);
}

// check for complexity
if (!concave.isSimple()) {
Common.log('Bodies.fromVertices: Non-simple polygons are not supported. Could not decompose vertices. Fallback to convex hull.', 'warn');
canDecompose = false;
}

// try to decompose
if (canDecompose) {
// vertices are concave and simple, we can decompose into parts
Expand Down Expand Up @@ -298,4 +292,4 @@ var Bodies = {};
}
};

})();
})();

0 comments on commit 2d1ef0d

Please sign in to comment.