mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Clean up code a bit and add comment about possible further optimsiations.
This commit is contained in:
parent
a3065a59d1
commit
680ae49ec8
1 changed files with 10 additions and 9 deletions
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue