mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Use faster Point.create(x, y) internally.
This commit is contained in:
parent
ad2abfb71f
commit
96f7d140a7
1 changed files with 7 additions and 7 deletions
|
@ -1599,13 +1599,13 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
||||||
segment.setHandleIn(handleIn.subtract(segment._point));
|
segment.setHandleIn(handleIn.subtract(segment._point));
|
||||||
if (i < n) {
|
if (i < n) {
|
||||||
segment.setHandleOut(
|
segment.setHandleOut(
|
||||||
new Point(x[i], y[i]).subtract(segment._point));
|
Point.create(x[i], y[i]).subtract(segment._point));
|
||||||
if (i < n - 1)
|
if (i < n - 1)
|
||||||
handleIn = new Point(
|
handleIn = Point.create(
|
||||||
2 * knots[i + 1]._x - x[i + 1],
|
2 * knots[i + 1]._x - x[i + 1],
|
||||||
2 * knots[i + 1]._y - y[i + 1]);
|
2 * knots[i + 1]._y - y[i + 1]);
|
||||||
else
|
else
|
||||||
handleIn = new Point(
|
handleIn = Point.create(
|
||||||
(knots[n]._x + x[n - 1]) / 2,
|
(knots[n]._x + x[n - 1]) / 2,
|
||||||
(knots[n]._y + y[n - 1]) / 2);
|
(knots[n]._y + y[n - 1]) / 2);
|
||||||
}
|
}
|
||||||
|
@ -1909,8 +1909,8 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
||||||
// Get rotated hor and ver vectors, and determine rotation angle
|
// Get rotated hor and ver vectors, and determine rotation angle
|
||||||
// and elipse values from them:
|
// and elipse values from them:
|
||||||
var mx = matrix.createShiftless(),
|
var mx = matrix.createShiftless(),
|
||||||
hor = mx.transform(new Point(radius, 0)),
|
hor = mx.transform(Point.create(radius, 0)),
|
||||||
ver = mx.transform(new Point(0, radius)),
|
ver = mx.transform(Point.create(0, radius)),
|
||||||
phi = hor.getAngleInRadians(),
|
phi = hor.getAngleInRadians(),
|
||||||
a = hor.getLength(),
|
a = hor.getLength(),
|
||||||
b = ver.getLength();
|
b = ver.getLength();
|
||||||
|
@ -1995,9 +1995,9 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
||||||
normal2 = curve2.getNormal(0).normalize(radius),
|
normal2 = curve2.getNormal(0).normalize(radius),
|
||||||
// Intersect the two lines
|
// Intersect the two lines
|
||||||
line1 = new Line(point.subtract(normal1),
|
line1 = new Line(point.subtract(normal1),
|
||||||
new Point(-normal1.y, normal1.x)),
|
Point.create(-normal1.y, normal1.x)),
|
||||||
line2 = new Line(point.subtract(normal2),
|
line2 = new Line(point.subtract(normal2),
|
||||||
new Point(-normal2.y, normal2.x)),
|
Point.create(-normal2.y, normal2.x)),
|
||||||
corner = line1.intersect(line2);
|
corner = line1.intersect(line2);
|
||||||
// Now measure the distance from the segment to the
|
// Now measure the distance from the segment to the
|
||||||
// intersection, which his half of the miter distance
|
// intersection, which his half of the miter distance
|
||||||
|
|
Loading…
Reference in a new issue