0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-01-12 16:08:50 -05:00

removed complexity check in Bodies.fromVertices, enforce clockwise sort

This commit is contained in:
liabru 2015-03-01 15:51:45 +00:00
parent 90adf147e9
commit 2d1ef0d6d4

View file

@ -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));
@ -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
@ -298,4 +292,4 @@ var Bodies = {};
}
};
})();
})();