mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-28 17:02:24 -05:00
parent
3ff5560c0c
commit
ef8ba35911
4 changed files with 29 additions and 3 deletions
|
@ -492,7 +492,7 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
|||
// Count how many times curve2 angles appear between the curve1 angles.
|
||||
// If each pair of angles split the other two, then the edges cross.
|
||||
// Use t1Inside to decide which angle pair to check against.
|
||||
// If t1 is inside the curve, check against a3 & a4, othrwise a1 & a2.
|
||||
// If t1 is inside the curve, check against a3 & a4, otherwise a1 & a2.
|
||||
return !!(t1Inside
|
||||
? (isInRange(a1, a3, a4) ^ isInRange(a2, a3, a4)) &&
|
||||
(isInRange(a1, a4, a3) ^ isInRange(a2, a4, a3))
|
||||
|
|
|
@ -227,8 +227,8 @@ var compareImageData = function(imageData1, imageData2, tolerance, diffDetail) {
|
|||
var entry = document.getElementById('qunit-test-output-' + id)
|
||||
.querySelector('li:nth-child(' + (index) + ')'),
|
||||
bounds = result.diffBounds;
|
||||
entry.querySelector('.test-expected td').appendChild(image(imageData1));
|
||||
entry.querySelector('.test-actual td').appendChild(image(imageData2));
|
||||
entry.querySelector('.test-expected td').appendChild(image(imageData2));
|
||||
entry.querySelector('.test-actual td').appendChild(image(imageData1));
|
||||
entry.querySelector('.test-diff td').innerHTML = '<pre>' + detail
|
||||
+ '</pre><br>'
|
||||
+ '<img src="' + result.getImageDataUrl() + '">';
|
||||
|
|
|
@ -1202,3 +1202,16 @@ test('#1513', function () {
|
|||
var result = 'M100,100h200v100c0,-55.22847 -44.77153,-100 -100,-100c-55.22847,0 -100,44.77153 -100,100z';
|
||||
compareBoolean(path1.subtract(path2), result);
|
||||
});
|
||||
|
||||
test('#1419', function() {
|
||||
var circle1 = Path.Circle({
|
||||
center: [0, 0],
|
||||
radius: 50
|
||||
});
|
||||
var circle2 = Path.Circle({
|
||||
center: circle1.position.subtract(25),
|
||||
radius: 50
|
||||
});
|
||||
var result = 'M-50,0c0,-27.61424 22.38576,-50 50,-50c7.33673,0 14.30439,1.5802 20.58119,4.41881c-7.84546,-17.34804 -25.30368,-29.41881 -45.58119,-29.41881c-27.61424,0 -50,22.38576 -50,50c0,20.27751 12.07077,37.73573 29.41881,45.58119c-2.83861,-6.2768 -4.41881,-13.24446 -4.41881,-20.58119zM50,0c0,27.61424 -22.38576,50 -50,50c-20.27751,0 -37.73573,-12.07077 -45.58119,-29.41881c6.2768,2.83861 13.24446,4.41881 20.58119,4.41881c27.61424,0 50,-22.38576 50,-50c0,-7.33673 -1.5802,-14.30439 -4.41881,-20.58119c17.34804,7.84546 29.41881,25.30368 29.41881,45.58119z';
|
||||
compareBoolean(circle1.exclude(circle2), result);
|
||||
})
|
||||
|
|
|
@ -358,3 +358,16 @@ test('#1638', function() {
|
|||
{ point: { x: 58.83762, y: 191.16238 }, index: 3, time: 0.26569, crossing: true }
|
||||
]);
|
||||
})
|
||||
|
||||
test('#1263', function() {
|
||||
var path = new Path({
|
||||
segments: [
|
||||
[[479,495], [0,0], [-10,4]],
|
||||
[[437,479], [5,12], [-22,-51]],
|
||||
[[479,495], [33,-15]]
|
||||
]
|
||||
});
|
||||
testIntersections(path.getIntersections(), [
|
||||
{ point: { x: 479, y: 495 }, index: 0, time: 0, crossing: false }
|
||||
]);
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue