mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Replace links to issues with short references.
This commit is contained in:
parent
45a8a69d67
commit
7152942719
6 changed files with 18 additions and 25 deletions
|
@ -187,8 +187,7 @@ var Line = Base.extend(/** @lends Line# */{
|
||||||
vx -= px;
|
vx -= px;
|
||||||
vy -= py;
|
vy -= py;
|
||||||
}
|
}
|
||||||
// Based on the error analysis by @iconexperience outlined in
|
// Based on the error analysis by @iconexperience outlined in #799
|
||||||
// https://github.com/paperjs/paper.js/issues/799
|
|
||||||
return vx === 0 ? vy > 0 ? x - px : px - x
|
return vx === 0 ? vy > 0 ? x - px : px - x
|
||||||
: vy === 0 ? vx < 0 ? y - py : py - y
|
: vy === 0 ? vx < 0 ? y - py : py - y
|
||||||
: ((x-px) * vy - (y-py) * vx) / Math.sqrt(vx * vx + vy * vy);
|
: ((x-px) * vy - (y-py) * vx) / Math.sqrt(vx * vx + vy * vy);
|
||||||
|
|
|
@ -1437,8 +1437,7 @@ new function() { // Scope for intersection using bezier fat-line clipping
|
||||||
// NOTE: @iconexperience determined that more than 20 recursions are
|
// NOTE: @iconexperience determined that more than 20 recursions are
|
||||||
// needed sometimes, depending on the tDiff threshold values further
|
// needed sometimes, depending on the tDiff threshold values further
|
||||||
// below when determining which curve converges the least. He also
|
// below when determining which curve converges the least. He also
|
||||||
// recommended a threshold of 0.5 instead of the initial 0.8
|
// recommended a threshold of 0.5 instead of the initial 0.8, see: #565
|
||||||
// See: https://github.com/paperjs/paper.js/issues/565
|
|
||||||
if (++recursion >= 24)
|
if (++recursion >= 24)
|
||||||
return;
|
return;
|
||||||
// Let P be the first curve and Q be the second
|
// Let P be the first curve and Q be the second
|
||||||
|
@ -1747,7 +1746,7 @@ new function() { // Scope for intersection using bezier fat-line clipping
|
||||||
// tMin, tMax, uMin, uMax, oldTDiff, reverse, recursion
|
// tMin, tMax, uMin, uMax, oldTDiff, reverse, recursion
|
||||||
0, 1, 0, 1, 0, false, 0);
|
0, 1, 0, 1, 0, false, 0);
|
||||||
// We're done if we handle lines and found one intersection already:
|
// We're done if we handle lines and found one intersection already:
|
||||||
// https://github.com/paperjs/paper.js/issues/805#issuecomment-148503018
|
// #805#issuecomment-148503018
|
||||||
if (straight && locations.length > before)
|
if (straight && locations.length > before)
|
||||||
return locations;
|
return locations;
|
||||||
// Handle the special case where the first curve's start- or end-
|
// Handle the special case where the first curve's start- or end-
|
||||||
|
@ -1770,7 +1769,7 @@ new function() { // Scope for intersection using bezier fat-line clipping
|
||||||
_getSelfIntersection: function(v1, c1, locations, param) {
|
_getSelfIntersection: function(v1, c1, locations, param) {
|
||||||
// Read a detailed description of the approach used to handle self-
|
// Read a detailed description of the approach used to handle self-
|
||||||
// intersection, developed by @iconexperience here:
|
// intersection, developed by @iconexperience here:
|
||||||
// https://github.com/paperjs/paper.js/issues/773#issuecomment-144018379
|
// #773#issuecomment-144018379
|
||||||
var p1x = v1[0], p1y = v1[1],
|
var p1x = v1[0], p1y = v1[1],
|
||||||
h1x = v1[2], h1y = v1[3],
|
h1x = v1[2], h1y = v1[3],
|
||||||
h2x = v1[4], h2y = v1[5],
|
h2x = v1[4], h2y = v1[5],
|
||||||
|
@ -1848,7 +1847,7 @@ new function() { // Scope for intersection using bezier fat-line clipping
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Code to detect overlaps of intersecting based on work by
|
* Code to detect overlaps of intersecting based on work by
|
||||||
* @iconexperience: https://github.com/paperjs/paper.js/issues/648
|
* @iconexperience in #648
|
||||||
*/
|
*/
|
||||||
getOverlaps: function(v1, v2) {
|
getOverlaps: function(v1, v2) {
|
||||||
var abs = Math.abs,
|
var abs = Math.abs,
|
||||||
|
|
|
@ -317,8 +317,7 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
var res = this === loc,
|
var res = this === loc,
|
||||||
epsilon = /*#=*/Numerical.GEOMETRIC_EPSILON;
|
epsilon = /*#=*/Numerical.GEOMETRIC_EPSILON;
|
||||||
// NOTE: We need to compare both by (index + parameter) and by proximity
|
// NOTE: We need to compare both by (index + parameter) and by proximity
|
||||||
// of points. See:
|
// of points. See: #784#issuecomment-143161586
|
||||||
// https://github.com/paperjs/paper.js/issues/784#issuecomment-143161586
|
|
||||||
if (!res && loc instanceof CurveLocation
|
if (!res && loc instanceof CurveLocation
|
||||||
&& this.getPath() === loc.getPath()
|
&& this.getPath() === loc.getPath()
|
||||||
&& this.getPoint().isClose(loc.getPoint(), epsilon)) {
|
&& this.getPoint().isClose(loc.getPoint(), epsilon)) {
|
||||||
|
|
|
@ -758,8 +758,8 @@ new function() { // Injection scope for mouse events on the browser
|
||||||
var view = View._focused,
|
var view = View._focused,
|
||||||
target = DomEvent.getRelatedTarget(event);
|
target = DomEvent.getRelatedTarget(event);
|
||||||
if (view && (!target || target.nodeName === 'HTML')) {
|
if (view && (!target || target.nodeName === 'HTML')) {
|
||||||
// See https://github.com/paperjs/paper.js/issues/800 for this
|
// See #800 for this bizarre workaround for an issue of Chrome
|
||||||
// bizarre workaround for an issue of Chrome on Windows:
|
// on Windows:
|
||||||
// TODO: Remove again after Dec 2016 once it is fixed in Chrome.
|
// TODO: Remove again after Dec 2016 once it is fixed in Chrome.
|
||||||
var offset = DomEvent.getOffset(event, view._element),
|
var offset = DomEvent.getOffset(event, view._element),
|
||||||
x = offset.x,
|
x = offset.x,
|
||||||
|
|
|
@ -414,7 +414,7 @@ test('Selected edge-cases from @hari\'s boolean-test suite', function() {
|
||||||
|
|
||||||
test('Isolated edge-cases from @iconexperience\'s boolean-test suite', function() {
|
test('Isolated edge-cases from @iconexperience\'s boolean-test suite', function() {
|
||||||
// Test all of @iconexperience's isolated cases in one batch.
|
// Test all of @iconexperience's isolated cases in one batch.
|
||||||
// Read more in https://github.com/paperjs/paper.js/issues/784
|
// Read more in #784
|
||||||
var paths = [[
|
var paths = [[
|
||||||
[
|
[
|
||||||
[450, 230, 0, 0, 0, 0],
|
[450, 230, 0, 0, 0, 0],
|
||||||
|
@ -776,7 +776,7 @@ test('Isolated edge-cases from @iconexperience\'s boolean-test suite', function(
|
||||||
compareBoolean(path1.intersect(path2), result[1], 'path1.intersect(path2); // Test ' + (i + 1));
|
compareBoolean(path1.intersect(path2), result[1], 'path1.intersect(path2); // Test ' + (i + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/paperjs/paper.js/issues/784#issuecomment-144653463
|
// #784#issuecomment-144653463
|
||||||
var path1 = new Path({
|
var path1 = new Path({
|
||||||
segments: [
|
segments: [
|
||||||
[400, 300, 0, 0, 0, 0],
|
[400, 300, 0, 0, 0, 0],
|
||||||
|
@ -805,7 +805,7 @@ test('Isolated edge-cases from @iconexperience\'s boolean-test suite', function(
|
||||||
'M400,300l-3.5759,86.76021l-16.26693,-25.2069l0,0l-11.19918,27.83126l-16.84048,-17.16458l1.75482,-25.27995l24.8115,12.3302l-14.79357,-22.92381z M352.1175,372.22z');
|
'M400,300l-3.5759,86.76021l-16.26693,-25.2069l0,0l-11.19918,27.83126l-16.84048,-17.16458l1.75482,-25.27995l24.8115,12.3302l-14.79357,-22.92381z M352.1175,372.22z');
|
||||||
|
|
||||||
|
|
||||||
// https://github.com/paperjs/paper.js/issues/784#issuecomment-144993215
|
// #784#issuecomment-144993215
|
||||||
var path1 = new Path({
|
var path1 = new Path({
|
||||||
segments: [
|
segments: [
|
||||||
[428.65986693122585, 123.24312916360232, 0, 0, 0, 0],
|
[428.65986693122585, 123.24312916360232, 0, 0, 0, 0],
|
||||||
|
@ -818,7 +818,7 @@ test('Isolated edge-cases from @iconexperience\'s boolean-test suite', function(
|
||||||
compareBoolean(function() { return path1.unite(); },
|
compareBoolean(function() { return path1.unite(); },
|
||||||
'M428.65987,123.24313c0,0 18.24445,159.97772 20.21157,166.76806c-3.05664,-6.18082 -73.53131,-139.25432 -73.53131,-139.25432z M448.97323,290.23336c0,0 0,0 0,0c0.22704,0.04317 -0.06896,-0.00471 0,0c-0.02659,-0.00506 -0.06063,-0.08007 -0.1018,-0.22217c0.07286,0.14733 0.10741,0.22256 0.1018,0.22217z');
|
'M428.65987,123.24313c0,0 18.24445,159.97772 20.21157,166.76806c-3.05664,-6.18082 -73.53131,-139.25432 -73.53131,-139.25432z M448.97323,290.23336c0,0 0,0 0,0c0.22704,0.04317 -0.06896,-0.00471 0,0c-0.02659,-0.00506 -0.06063,-0.08007 -0.1018,-0.22217c0.07286,0.14733 0.10741,0.22256 0.1018,0.22217z');
|
||||||
|
|
||||||
// https://github.com/paperjs/paper.js/issues/784#issuecomment-168605018
|
// #784#issuecomment-168605018
|
||||||
var path1 = new CompoundPath();
|
var path1 = new CompoundPath();
|
||||||
path1.setChildren([
|
path1.setChildren([
|
||||||
new Path({
|
new Path({
|
||||||
|
|
|
@ -25,8 +25,7 @@ function testIntersection(intersections, results) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test('path.getIntersections(); #565', function() {
|
test('#565', function() {
|
||||||
// https://github.com/paperjs/paper.js/issues/565
|
|
||||||
var curve1 = new Curve(new Point(421.75945, 416.40481), new Point(-181.49299, -224.94946), new Point(44.52004, -194.13319), new Point(397.47615, 331.34712));
|
var curve1 = new Curve(new Point(421.75945, 416.40481), new Point(-181.49299, -224.94946), new Point(44.52004, -194.13319), new Point(397.47615, 331.34712));
|
||||||
var curve2 = new Curve(new Point(360.09446, 350.97254), new Point(-58.58867, -218.45806), new Point(-109.55091, -220.99561), new Point(527.83582, 416.79948));
|
var curve2 = new Curve(new Point(360.09446, 350.97254), new Point(-58.58867, -218.45806), new Point(-109.55091, -220.99561), new Point(527.83582, 416.79948));
|
||||||
var path1 = new Path([curve1.segment1, curve1.segment2]);
|
var path1 = new Path([curve1.segment1, curve1.segment2]);
|
||||||
|
@ -46,8 +45,7 @@ test('path.getIntersections(); #565', function() {
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('path.getIntersections(); #568', function() {
|
test('#568', function() {
|
||||||
// https://github.com/paperjs/paper.js/issues/568
|
|
||||||
var curve1 = new Curve(new Point(509.05465863179415, 440.1211663847789), new Point(233.6728838738054, -245.8216403145343), new Point(-270.755685120821, 53.14275110140443), new Point(514.079892472364, 481.95262297522277));
|
var curve1 = new Curve(new Point(509.05465863179415, 440.1211663847789), new Point(233.6728838738054, -245.8216403145343), new Point(-270.755685120821, 53.14275110140443), new Point(514.079892472364, 481.95262297522277));
|
||||||
var curve2 = new Curve(new Point(542.1666181180626, 451.06309361290187), new Point(179.91238399408758, 148.68241581134498), new Point(193.42650789767504, -47.97609066590667), new Point(423.66228222381324, 386.3876062911004));
|
var curve2 = new Curve(new Point(542.1666181180626, 451.06309361290187), new Point(179.91238399408758, 148.68241581134498), new Point(193.42650789767504, -47.97609066590667), new Point(423.66228222381324, 386.3876062911004));
|
||||||
var path1 = new Path([curve1.segment1, curve1.segment2]);
|
var path1 = new Path([curve1.segment1, curve1.segment2]);
|
||||||
|
@ -66,8 +64,7 @@ test('path.getIntersections(); #568', function() {
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('path.getIntersections(); #570', function() {
|
test('#570', function() {
|
||||||
// https://github.com/paperjs/paper.js/issues/570
|
|
||||||
var curve1 = new Curve(new Point(171, 359), new Point(65.26926656546078, 62.85188632229557), new Point(-37.43795644844329, 7.813022000754188), new Point(311.16034791674826, 406.2985255840872));
|
var curve1 = new Curve(new Point(171, 359), new Point(65.26926656546078, 62.85188632229557), new Point(-37.43795644844329, 7.813022000754188), new Point(311.16034791674826, 406.2985255840872));
|
||||||
var curve2 = new Curve(new Point(311.16034791674826, 406.2985255840872), new Point(39.997020018940304, -8.347079462067768), new Point(-73.86292504547487, -77.47859270504358), new Point(465, 467));
|
var curve2 = new Curve(new Point(311.16034791674826, 406.2985255840872), new Point(39.997020018940304, -8.347079462067768), new Point(-73.86292504547487, -77.47859270504358), new Point(465, 467));
|
||||||
var path1 = new Path([curve1.segment1, curve1.segment2]);
|
var path1 = new Path([curve1.segment1, curve1.segment2]);
|
||||||
|
@ -78,8 +75,7 @@ test('path.getIntersections(); #570', function() {
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('path.getIntersections(); #571', function() {
|
test('#571', function() {
|
||||||
// https://github.com/paperjs/paper.js/issues/571
|
|
||||||
var curve1 = new Curve(new Point(171, 359), new Point(205.3908899553486, -14.994581100305595), new Point(5.767644819815757, 28.49094950835297), new Point(420.1235851920127, 275.8351912321666));
|
var curve1 = new Curve(new Point(171, 359), new Point(205.3908899553486, -14.994581100305595), new Point(5.767644819815757, 28.49094950835297), new Point(420.1235851920127, 275.8351912321666));
|
||||||
var curve2 = new Curve(new Point(420.1235851920127, 275.8351912321666), new Point(-10.77224553077383, -53.21262197949682), new Point(-259.2129470250785, -258.56165821345775), new Point(465, 467));
|
var curve2 = new Curve(new Point(420.1235851920127, 275.8351912321666), new Point(-10.77224553077383, -53.21262197949682), new Point(-259.2129470250785, -258.56165821345775), new Point(465, 467));
|
||||||
var path1 = new Path([curve1.segment1, curve1.segment2]);
|
var path1 = new Path([curve1.segment1, curve1.segment2]);
|
||||||
|
@ -91,7 +87,7 @@ test('path.getIntersections(); #571', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('path.getIntersections(); overlapping circles', function() {
|
test('overlapping circles', function() {
|
||||||
var path1 = new Path.Circle(new paper.Point(50, 50), 50);
|
var path1 = new Path.Circle(new paper.Point(50, 50), 50);
|
||||||
var path2 = new Path.Circle(new paper.Point(100, 100), 50);
|
var path2 = new Path.Circle(new paper.Point(100, 100), 50);
|
||||||
testIntersection(path1.getIntersections(path2), [
|
testIntersection(path1.getIntersections(path2), [
|
||||||
|
@ -101,7 +97,7 @@ test('path.getIntersections(); overlapping circles', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('path.getIntersections(); circle and square (existing segments overlaps on curves)', function() {
|
test('circle and square (existing segments overlaps on curves)', function() {
|
||||||
var path1 = new Path.Circle(new Point(110, 110), 80);
|
var path1 = new Path.Circle(new Point(110, 110), 80);
|
||||||
var path2 = new Path.Rectangle(new Point(110, 110), [100, 100]);
|
var path2 = new Path.Rectangle(new Point(110, 110), [100, 100]);
|
||||||
testIntersection(path1.getIntersections(path2), [
|
testIntersection(path1.getIntersections(path2), [
|
||||||
|
|
Loading…
Reference in a new issue