Clean up code a bit and add comment about possible further optimsiations.

This commit is contained in:
Jürg Lehni 2011-05-06 00:44:54 +01:00
parent a3065a59d1
commit 680ae49ec8

View file

@ -836,14 +836,15 @@ var Path = this.Path = PathItem.extend({
z = 4 / 3 * Math.sin(halfInc) / (1 + Math.cos(halfInc)); z = 4 / 3 * Math.sin(halfInc) / (1 + Math.cos(halfInc));
var segments = []; var segments = [];
// TODO: Use Point#setAngle() and Point vector algebra instead.
for (var i = 0; i <= arcSegs; i++) { for (var i = 0; i <= arcSegs; i++) {
var relx = Math.cos(angle), var relx = Math.cos(angle),
rely = Math.sin(angle), rely = Math.sin(angle),
pt = new Point( pt = new Point(
centerX + relx * radius, centerX + relx * radius,
centerY + rely * radius centerY + rely * radius
); ),
var out = i == arcSegs out = i == arcSegs
? null ? null
: new Point( : new Point(
centerX + (relx - z * rely) * radius - pt.x, centerX + (relx - z * rely) * radius - pt.x,