Clean up Path.RegularPolygon constructor.

This commit is contained in:
Jonathan Puckey 2011-02-26 19:21:52 +01:00
parent eebe7e2731
commit 9496ac70bd

View file

@ -109,8 +109,9 @@ Path.inject({ statics: new function() {
var path = new Path();
var three = !(numSides % 3);
var vector = new Point(0, three ? -radius : radius);
var offset = three ? -1 : 0.5;
for(var i = 0; i < numSides; i++) {
var angle = (360 / numSides) * (i + (three ? -1 : 0.5));
var angle = (360 / numSides) * (i + offset);
path.add(center.add(vector.rotate(angle)));
}
path.closed = true;