Don't overuse variable chaining - use only were readibility does not suffer.

This commit is contained in:
Jürg Lehni 2011-05-15 14:29:00 +01:00
parent 3078e74f27
commit 057b71ff4c

View file

@ -855,20 +855,20 @@ var Path = this.Path = PathItem.extend({
inc = Math.min(Math.max(extent, -d180), d180) / arcSegs, inc = Math.min(Math.max(extent, -d180), d180) / arcSegs,
z = 4 / 3 * Math.sin(inc / 2) / (1 + Math.cos(inc / 2)), z = 4 / 3 * Math.sin(inc / 2) / (1 + Math.cos(inc / 2)),
segments = []; segments = [];
// TODO: Use Point#setAngle() and Point vector algebra instead. // 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( var pt = new Point(
cx + relx * radius, cx + relx * radius,
cy + rely * radius cy + rely * radius
), );
out = i == arcSegs var out = i == arcSegs
? null ? null
: new Point( : new Point(
cx + (relx - z * rely) * radius - pt.x, cx + (relx - z * rely) * radius - pt.x,
cy + (rely + z * relx) * radius - pt.y cy + (rely + z * relx) * radius - pt.y
); );
if (i == 0) { if (i == 0) {
// Modify startSegment // Modify startSegment
current.setHandleOut(out); current.setHandleOut(out);