mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 06:00:56 -05:00
Include two new fail-cases for fat-line code.
This commit is contained in:
parent
d8498b6418
commit
f8e5fae826
2 changed files with 33 additions and 17 deletions
|
@ -34,17 +34,19 @@
|
|||
<p>--<br />
|
||||
hari</p>
|
||||
</footer>
|
||||
|
||||
<svg class="hide" version="1.1" id="svgrandom2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="200px" height="200px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve">
|
||||
</svg>
|
||||
<svg class="hide" version="1.1" id="svgrandom1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="200px" height="200px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve">
|
||||
<svg class="hide" version="1.1" id="svgrandom1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200px" height="200px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve">
|
||||
<path d="M121.938,15.632c-13.717-12.536 -86.488,106.314 -97.28853,96.70168c-10.79979,-9.61253 74.75206,22.03522 62.05339,14.94206c-12.69866,-7.09316 -39.33589,-120.29063 -50.13215,-122.55235c-10.79626,-2.26173 20.61549,120.92844 6.21122,120.91582c-14.40427,-0.01263 95.8736,-97.47028 79.15607,-110.0072z" />
|
||||
<path d="M112.56135,26.45534c-11.3324,-19.66938 2.46546,15.5079 -15.74899,1.46029c-18.21444,-14.04761 -66.32694,49.96681 -85.68888,45.03851c-19.36194,-4.9283 25.00762,66.13871 9.65758,51.54906c-15.35004,-14.58966 80.2128,-61.80948 76.57166,-81.27628c-3.64115,-19.4668 26.54102,2.89779 15.20863,-16.77158z" />
|
||||
</svg>
|
||||
<svg class="hide" version="1.1" id="glyphsys" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="200px" height="200px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve">
|
||||
<svg class="hide" version="1.1" id="svgrandom2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200px" height="200px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve">
|
||||
<path d="M55.84967,115.22826c-18.46018,-11.52267 -5.13012,-104.06365 -21.53505,-114.49647c-16.40494,-10.43282 37.27459,91.17124 19.75792,84.78494c-17.51668,-6.3863 0.26851,-73.4895 -13.30075,-74.14695c-13.56926,-0.65745 42.04716,92.37097 23.83192,92.28519c-18.21524,-0.08578 19.29393,-4.87778 16.98435,-4.92088c-2.30958,-0.0431 -51.21527,-19.25571 -54.68432,-27.34524c-3.46904,-8.08953 83.90965,10.70419 70.0436,2.83256c-13.86605,-7.87163 -22.4316,45.08116 -40.02591,30.30112c-17.59431,-14.78004 78.05669,16.02252 60.81191,7.3855c-17.24478,-8.63702 -102.15822,-1.12427 -107.57647,-17.95819c-5.41825,-16.83392 64.06382,50.60482 52.5646,33.01986c-11.49922,-17.58496 44.06467,-104.79755 35.13656,-115.92523c-8.9281,-11.12768 21.83572,22.02208 17.93124,16.77489c-3.90448,-5.24719 -73.60183,85.82912 -80.11354,81.74953c-6.51171,-4.07958 52.09858,-37.99084 38.6322,-40.45908c-13.46638,-2.46824 -27.57103,-4.69586 -39.27681,-8.64429c-11.70578,-3.94843 43.5615,61.40122 35.24959,61.16567c-8.31191,-0.23555 -22.81477,-84.27143 -37.4408,-96.38241c-14.62603,-12.11098 2.73944,73.29997 -15.75259,62.98147c-18.49202,-10.3185 57.22255,38.52067 38.76237,26.998" />
|
||||
<path d="M124.25112,1.79465c-16.70696,-18.16066 -84.58936,25.58959 -101.49108,15.0504c-16.90171,-10.53919 46.75597,68.79952 42.13449,57.7377c-4.62148,-11.06182 72.86975,49.45108 59.02445,33.74034c-13.8453,-15.71074 -4.64367,-61.75728 -9.946,-70.16595c-5.30233,-8.40867 -59.46844,65.85202 -68.2972,64.0792c-8.82876,-1.77282 -1.54202,5.91022 -3.69332,5.25971c-2.1513,-0.65051 2.98295,17.37807 2.6116,4.13995c-0.37136,-13.23813 87.27724,-74.83845 73.45397,-77.0332c-13.82327,-2.19475 15.33624,70.7949 3.66016,50.87465c-11.67608,-19.92026 -22.02588,-66.90805 -26.33953,-82.18776c-4.31365,-15.27971 -40.34671,96.56568 -53.32969,82.34647c-12.98297,-14.21921 18.6211,9.62964 5.16889,5.52245c-13.4522,-4.10718 -7.48163,-27.24575 -14.65512,-42.22678c-7.17349,-14.98103 -3.83069,6.03324 -12.16872,-11.55839c-8.33804,-17.59163 69.56243,3.66432 49.802,-4.30838c-19.76043,-7.9727 -8.91008,-16.5344 -28.22815,-25.86978c-19.31807,-9.33537 77.84701,76.11681 74.06207,62.04286c-3.78494,-14.07394 -11.3097,19.48559 -12.85907,19.2506c-1.54937,-0.235 -81.9015,-69.71187 -91.64027,-80.20854c-9.73878,-10.49667 129.43749,11.67511 112.73053,-6.48555" />
|
||||
</svg>
|
||||
<svg class="hide" version="1.1" id="svgrandom3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200px" height="200px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve">
|
||||
<path d="M54.01772,11.22619c-18.20709,-12.52602 61.88252,17.37566 49.98879,0.41251c-11.89373,-16.96315 -57.48885,97.79587 -67.34346,91.15361c-9.85461,-6.64226 60.06622,-52.50884 57.16797,-53.51388c-2.89825,-1.00504 14.98219,21.59751 8.75775,15.74124c-6.22444,-5.85627 -81.47973,22.0899 -87.2512,21.93702c-5.77147,-0.15288 115.79014,19.6188 97.11956,13.97034c-18.67057,-5.64846 -101.98956,27.79453 -104.1477,11.23101c-2.15813,-16.56352 80.90365,10.68429 79.81834,-4.37386c-1.08531,-15.05815 -65.38517,-82.08106 -80.14536,-88.08628c-14.76019,-6.00522 113.80993,107.20587 97.98042,90.69978c-15.82951,-16.50609 -89.07394,-20.59276 -105.0168,-23.10521c-15.94286,-2.51245 75.78212,-72.15859 58.16052,-79.11261c-17.6216,-6.95402 15.13181,122.721 7.09601,115.18191c-8.0358,-7.53909 59.80187,-57.16136 57.37929,-64.37279c-2.42257,-7.21143 -89.22172,-8.27199 -108.94442,-24.80971c-19.7227,-16.53772 -7.53422,-23.5325 -12.86198,-32.73198c-5.32776,-9.19949 125.74382,102.82176 109.25335,84.53176c-16.49047,-18.29 10.62278,-21.24625 3.54689,-34.64539c-7.07589,-13.39914 -84.53036,-23.58012 -94.96962,-37.56896c-10.43927,-13.98884 52.61874,9.98751 34.41164,-2.53851z" />
|
||||
<path d="M69.78945,75.24214c-12.03895,-11.30586 73.92983,34.48045 57.1316,15.38415c-16.79824,-19.0963 -58.31298,-32.94201 -75.0704,-44.28449c-16.75743,-11.34248 32.47247,28.1257 22.33688,25.80446c-10.13558,-2.32124 2.52538,19.16885 -14.73964,2.68085c-17.26502,-16.488 24.41384,34.60425 18.65739,19.03774c-5.75646,-15.56651 32.70649,-17.43621 27.27121,-35.27665c-5.43528,-17.84044 -21.3295,-28.98105 -27.18693,-36.14508c-5.85743,-7.16403 -36.93801,10.54966 -37.18618,-4.38317c-0.24817,-14.93283 61.34618,44.08845 59.46353,27.80393c-1.88264,-16.28453 7.98343,-11.52748 -1.74259,-26.87787c-9.72601,-15.35039 -23.36546,36.18479 -30.042,28.15101c-6.67654,-8.03378 33.52966,38.18172 18.6684,36.64374c-14.86127,-1.53798 -59.798,-26.9086 -70.33709,-46.79513c-10.53909,-19.88653 30.19654,28.52041 16.2994,25.38554c-13.89714,-3.13487 47.1942,-40.33974 32.41691,-59.30792c-14.77729,-18.96818 66.04269,88.15785 62.42887,72.45904c-3.61382,-15.69881 6.28228,35.32465 -7.29971,20.98492c-13.58198,-14.33973 -44.65756,-88.82039 -64.02677,-90.76017c-19.36921,-1.93977 -8.19355,12.06314 -10.14185,7.97409c-1.9483,-4.08906 35.13791,72.82689 23.09896,61.52103z" />
|
||||
</svg>
|
||||
<svg class="hide" version="1.1" id="glyphsys" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200px" height="200px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve">
|
||||
<path fill="none" d="M68.836,146.216c8.889,5.698,21.647,10.021,35.324,10.021c20.283,0,32.142-10.689,32.142-26.203
|
||||
c0-14.122-8.203-22.557-28.949-30.305c-25.072-9.121-40.577-22.343-40.577-43.759c0-23.93,19.829-41.708,49.688-41.708
|
||||
c15.495,0,27.112,3.646,33.719,7.516l-5.456,16.182c-4.787-2.959-15.031-7.293-28.949-7.293c-20.961,0-28.94,12.536-28.94,23.021
|
||||
|
@ -53,9 +55,7 @@
|
|||
<path fill="none" d="M82.734,183.337v-66.265L33.15,27.158h23.17l22.009,43.104c5.792,11.811,10.66,21.321,15.528,32.207h0.462
|
||||
c4.17-10.207,9.736-20.396,15.764-32.207l22.473-43.104h22.707l-52.131,89.669v66.51H82.734z"/>
|
||||
</svg>
|
||||
|
||||
<svg class="hide" version="1.1" id="glyphsacirc" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="200px" height="200px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve">
|
||||
<svg class="hide" version="1.1" id="glyphsacirc" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200px" height="200px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve">
|
||||
<path fill="none" d="M107.585,161.74c-3.868,0-9.281-2.318-12.117-5.156c-3.351-3.35-4.898-6.961-6.186-11.342
|
||||
c-10.312,6.961-22.688,16.498-30.421,16.498c-18.304,0-30.935-15.211-30.935-31.451c0-12.631,6.703-20.621,20.881-25.52
|
||||
c15.468-5.157,34.287-12.118,39.958-16.757v-4.383c0-18.818-8.766-29.13-21.913-29.13c-4.898,0-8.765,1.805-11.601,4.898
|
||||
|
@ -66,8 +66,7 @@
|
|||
c0,13.146,10.31,19.592,18.303,19.592c6.701,0,15.725-4.383,20.623-9.279V96.778z"/>
|
||||
<circle fill="none" cx="112.681" cy="105.821" r="52.076"/>
|
||||
</svg>
|
||||
<svg class="hide" version="1.1" id="svggears" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="200px" height="200px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve">
|
||||
<svg class="hide" version="1.1" id="svggears" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200px" height="200px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve">
|
||||
<path fill="none" d="M127.11,135.58c0.899,0.19,2.568,0.312,3.713,0.269l1.001-0.038c1.145-0.043,2.215-1.005,2.381-2.138
|
||||
l0.588-5.705c0.071-1.142-0.778-2.305-1.888-2.585l-0.956-0.242c-1.11-0.279-2.77-0.509-3.689-0.509s-1.724-0.936-1.785-2.077
|
||||
l-0.674-6.489c-0.181-1.13,0.407-2.211,1.305-2.401c0.899-0.191,2.475-0.76,3.5-1.266l0.901-0.441
|
||||
|
|
|
@ -35,10 +35,6 @@ function runTests() {
|
|||
paper.setup(canvas);
|
||||
var paths = handler();
|
||||
var success = testIntersections(paths[0], paths[1], caption, testName, testdata);
|
||||
if (!success) {
|
||||
window.p1 = paths[0].exportSVG();
|
||||
window.p2 = paths[1].exportSVG();
|
||||
}
|
||||
testExecuted++;
|
||||
if (testExecuted === testQueued) {
|
||||
plotData();
|
||||
|
@ -71,6 +67,22 @@ function runTests() {
|
|||
return [pathA, pathB];
|
||||
});
|
||||
|
||||
runTest('failcase 2', function() {
|
||||
group = paper.project.importSVG(document.getElementById('svgrandom2'));
|
||||
pathA = group.children[0];
|
||||
pathB = group.children[1];
|
||||
pathA.style = pathB.style = null;
|
||||
return [pathA, pathB];
|
||||
});
|
||||
|
||||
runTest('failcase 3', function() {
|
||||
group = paper.project.importSVG(document.getElementById('svgrandom3'));
|
||||
pathA = group.children[0];
|
||||
pathB = group.children[1];
|
||||
pathA.style = pathB.style = null;
|
||||
return [pathA, pathB];
|
||||
});
|
||||
|
||||
runTest('Overlapping circles', function() {
|
||||
pathA = new Path.Circle(new Point(80, 110), 50);
|
||||
pathB = new Path.Circle(new Point(150, 110), 70);
|
||||
|
@ -474,6 +486,11 @@ function testIntersections(path1, path2, caption, testname, testdata, nomark) {
|
|||
success: success
|
||||
});
|
||||
console.log(found);
|
||||
if (!success) {
|
||||
var ser = new XMLSerializer();
|
||||
console.log('failcase:', ser.serializeToString(path1.exportSVG()),
|
||||
ser.serializeToString(path2.exportSVG()));
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue