blob: c8afb448d69cf853546ffabb65ac6b47064c6597 [file] [log] [blame]
<html>
<head>
<div height="0" hidden="true">
<div id="bug8380">
SkDCubic::ComplexBreak
{{{126, 9.396100044250488281}, {125.6320571899414063, 9.295844078063964844}, {125.1227340698242188, 9.337338447570800781}, {124.6031646728515625, 9.379667282104492188}}},
inflectionsTs[0]=0.999997776 {{{126.1618761931709827, 9.252680507258252973}, {123.04446008475567, 9.506653492188940291}}},
SkDCubic::ComplexBreak
{{{124.6031646728515625, 9.379667282104492188}, {124.1427383422851563, 9.417178153991699219}, {123.6742630004882813, 9.45534515380859375}, {123.28900146484375, 9.396100044250488281}}},
inflectionsTs[0]=4.14921088e-06 {{{125.984438133710114, 9.267135117035042668}, {123.2218797495565639, 9.492200381017113386}}},
maxCurvature[0]=0.0817322831 {{{125.8735553329735666, 9.277935394706121386}, {123.1067608854740314, 9.499713475347833835}}},
SkDCubic::ComplexBreak
{{{126, 9.396200180053710938}, {125.305999755859375, 9.206999778747558594}, {124.1090011596679688, 9.522199630737304688}, {123.28900146484375, 9.396200180053710938}}},
inflectionsTs[0]=0.530286644 {{{127.5428560571536707, 9.140180090182106198}, {121.6628069847287179, 9.619260454379688241}}},
maxCurvature[0]=0.568563182 {{{127.4346914043237859, 9.15278490094694952}, {121.5456828946143446, 9.624913158409162506}}},
seg=1 {{{0, 353.891998f}, {126, 9.39610004f}}}
seg=2 {{{126, 9.39610004f}, {125.632057f, 9.29584408f}, {125.122734f, 9.33733845f}, {124.603165f, 9.37966728f}}}
seg=3 {{{124.603165f, 9.37966728f}, {124.142731f, 9.41717815f}, {123.674263f, 9.45534515f}, {123.289001f, 9.39610004f}}}
seg=4 {{{123.289001f, 9.39610004f}, {118.119003f, 8.07219982f}}}
seg=5 {{{118.119003f, 8.07219982f}, {8.17210007f, 104.212997f}}}
seg=6 {{{8.17210007f, 104.212997f}, {0, 259.298737f}}}
seg=7 {{{0, 259.298737f}, {0, 353.891998f}}}
op sect
seg=8 {{{8.17210007f, 104.212997f}, {-5.82350016f, 369.813995f}}}
seg=9 {{{-5.82350016f, 369.813995f}, {126, 9.39620018f}}}
seg=10 {{{126, 9.39620018f}, {125.631981f, 9.29586983f}, {125.12252f, 9.3373785f}, {124.602829f, 9.37972069f}}}
seg=11 {{{124.602829f, 9.37972069f}, {124.142509f, 9.41722488f}, {123.674164f, 9.45538425f}, {123.289001f, 9.39620018f}}}
seg=12 {{{123.289001f, 9.39620018f}, {118.119003f, 8.07219982f}}}
seg=13 {{{118.119003f, 8.07219982f}, {8.17210007f, 104.212997f}}}
debugShowLineIntersection wtTs[0]=1 {{{8.17210007,104.212997}, {-5.82350016,369.813995}}} {{-5.82350016,369.813995}} wnTs[0]=0 {{{-5.82350016,369.813995}, {126,9.39620018}}}
debugShowLineIntersection wtTs[0]=0 {{{8.17210007,104.212997}, {-5.82350016,369.813995}}} {{8.17210007,104.212997}} wnTs[0]=1 {{{118.119003,8.07219982}, {8.17210007,104.212997}}}
debugShowCubicLineIntersection wtTs[0]=0 {{{126,9.39620018}, {125.631981,9.29586983}, {125.12252,9.3373785}, {124.602829,9.37972069}}} {{126,9.39620018}} wnTs[0]=1 {{{-5.82350016,369.813995}, {126,9.39620018}}}
debugShowCubicLineIntersection no intersect {{{124.602829,9.37972069}, {124.142509,9.41722488}, {123.674164,9.45538425}, {123.289001,9.39620018}}} {{{-5.82350016,369.813995}, {126,9.39620018}}}
debugShowLineIntersection no intersect {{{-5.82350016,369.813995}, {126,9.39620018}}} {{{123.289001,9.39620018}, {118.119003,8.07219982}}}
debugShowLineIntersection no intersect {{{-5.82350016,369.813995}, {126,9.39620018}}} {{{118.119003,8.07219982}, {8.17210007,104.212997}}}
debugShowCubicIntersection wtTs[0]=1 {{{126,9.39620018}, {125.631981,9.29586983}, {125.12252,9.3373785}, {124.602829,9.37972069}}} {{124.602829,9.37972069}} wnTs[0]=0 {{{124.602829,9.37972069}, {124.142509,9.41722488}, {123.674164,9.45538425}, {123.289001,9.39620018}}}
debugShowCubicLineIntersection wtTs[0]=1 {{{124.602829,9.37972069}, {124.142509,9.41722488}, {123.674164,9.45538425}, {123.289001,9.39620018}}} {{123.289001,9.39620018}} wnTs[0]=0 {{{123.289001,9.39620018}, {118.119003,8.07219982}}}
debugShowLineIntersection wtTs[0]=1 {{{123.289001,9.39620018}, {118.119003,8.07219982}}} {{118.119003,8.07219982}} wnTs[0]=0 {{{118.119003,8.07219982}, {8.17210007,104.212997}}}
debugShowLineIntersection no intersect {{{8.17210007,104.212997}, {-5.82350016,369.813995}}} {{{0,353.891998}, {126,9.39610004}}}
debugShowLineIntersection wtTs[0]=0 {{{8.17210007,104.212997}, {-5.82350016,369.813995}}} {{8.17210007,104.212997}} wnTs[0]=1 {{{118.119003,8.07219982}, {8.17210007,104.212997}}}
debugShowLineIntersection wtTs[0]=0 {{{8.17210007,104.212997}, {-5.82350016,369.813995}}} {{8.17210007,104.212997}} wtTs[1]=0.583904956 {{0,259.298737}} wnTs[0]=0 {{{8.17210007,104.212997}, {0,259.298737}}} wnTs[1]=1
SkOpSegment::addT insert t=0.583904956 segID=8 spanID=27
debugShowLineIntersection wtTs[0]=0.583904956 {{{8.17210007,104.212997}, {-5.82350016,369.813995}}} {{0,259.298737}} wnTs[0]=0 {{{0,259.298737}, {0,353.891998}}}
debugShowLineIntersection wtTs[0]=0.0441765002 {{{-5.82350016,369.813995}, {126,9.39620018}}} {{0,353.891998}} wtTs[1]=1 {{126,9.39620018}} wnTs[0]=0 {{{0,353.891998}, {126,9.39610004}}} wnTs[1]=0.999999744
SkOpSegment::addT insert t=0.0441765002 segID=9 spanID=28
debugShowCubicLineIntersection no intersect {{{124.603165,9.37966728}, {124.142731,9.41717815}, {123.674263,9.45534515}, {123.289001,9.39610004}}} {{{-5.82350016,369.813995}, {126,9.39620018}}}
debugShowLineIntersection no intersect {{{-5.82350016,369.813995}, {126,9.39620018}}} {{{118.119003,8.07219982}, {8.17210007,104.212997}}}
debugShowLineIntersection no intersect {{{-5.82350016,369.813995}, {126,9.39620018}}} {{{8.17210007,104.212997}, {0,259.298737}}}
debugShowLineIntersection wtTs[0]=0.0441765002 {{{-5.82350016,369.813995}, {126,9.39620018}}} {{0,353.891998}} wnTs[0]=1 {{{0,259.298737}, {0,353.891998}}}
debugShowCubicLineIntersection wtTs[0]=0 {{{126,9.39620018}, {125.631981,9.29586983}, {125.12252,9.3373785}, {124.602829,9.37972069}}} {{126,9.39620018}} wnTs[0]=1 {{{0,353.891998}, {126,9.39610004}}}
-1=(0.375,0.5) [-1]
SkTSect::addForPerp addBounded span=-1 opp=-1
-1=(0.5,0.625) [-1]
SkTSect::addForPerp addBounded span=-1 opp=-1
-1=(0.625,0.75) [-1]
SkTSect::addForPerp addBounded span=-1 opp=-1
-1=(0.75,0.8125) [-1]
SkTSect::addForPerp addBounded span=-1 opp=-1
-1=(0.8125,0.875) [-1]
SkTSect::addForPerp addBounded span=-1 opp=-1
-1=(0.875,0.9375) [-1]
SkTSect::addForPerp addBounded span=-1 opp=-1
SkTSect::addForPerp priorSpan=-1 t=0.937702598 opp=-1
-1=(0.9375,1) []
SkTSect::addForPerp addBounded span=-1 opp=-1
debugShowCubicIntersection wtTs[0]=0.307128906 {{{126,9.39620018}, {125.631981,9.29586983}, {125.12252,9.3373785}, {124.602829,9.37972069}}} {{125.624687,9.33981037}} wtTs[1]=0.9375 {{124.700119,9.37182617}} wnTs[0]=0.307191 {{{126,9.39610004}, {125.632057,9.29584408}, {125.122734,9.33733845}, {124.603165,9.37966728}}} wnTs[1]=0.937702598
SkOpSegment::addT insert t=0.307128906 segID=10 spanID=29
SkOpSegment::addT insert t=0.307190555 segID=2 spanID=30
SkOpSegment::addT insert t=0.9375 segID=10 spanID=31
SkOpSegment::addT insert t=0.937702598 segID=2 spanID=32
debugShowCubicIntersection no intersect {{{126,9.39620018}, {125.631981,9.29586983}, {125.12252,9.3373785}, {124.602829,9.37972069}}} {{{124.603165,9.37966728}, {124.142731,9.41717815}, {123.674263,9.45534515}, {123.289001,9.39610004}}}
debugShowCubicLineIntersection no intersect {{{124.602829,9.37972069}, {124.142509,9.41722488}, {123.674164,9.45538425}, {123.289001,9.39620018}}} {{{0,353.891998}, {126,9.39610004}}}
-1=(0.125,0.1875) [-1]
SkTSect::addForPerp addBounded span=-1 opp=-1
-1=(0.1875,0.25) [-1]
SkTSect::addForPerp addBounded span=-1 opp=-1
-1=(0.25,0.375) [-1]
SkTSect::addForPerp addBounded span=-1 opp=-1
-1=(0.375,0.5) [-1]
SkTSect::addForPerp addBounded span=-1 opp=-1
-1=(0.5,0.625) [-1]
SkTSect::addForPerp addBounded span=-1 opp=-1
-1=(0.625,0.75) [-1]
SkTSect::addForPerp addBounded span=-1 opp=-1
debugShowCubicIntersection wtTs[0]=0.0625 {{{124.602829,9.37972069}, {124.142509,9.41722488}, {123.674164,9.45538425}, {123.289001,9.39620018}}} {{124.516449,9.38673687}} wtTs[1]=0.625 {{123.752594,9.4268837}} wnTs[0]=0.0627287 {{{124.603165,9.37966728}, {124.142731,9.41717815}, {123.674263,9.45534515}, {123.289001,9.39610004}}} wnTs[1]=0.625091708
SkOpSegment::addT insert t=0.0625 segID=11 spanID=33
SkOpSegment::addT insert t=0.0627286673 segID=3 spanID=34
SkOpSegment::addT insert t=0.625 segID=11 spanID=35
SkOpSegment::addT insert t=0.625091708 segID=3 spanID=36
debugShowCubicLineIntersection no intersect {{{124.602829,9.37972069}, {124.142509,9.41722488}, {123.674164,9.45538425}, {123.289001,9.39620018}}} {{{123.289001,9.39610004}, {118.119003,8.07219982}}}
debugShowLineIntersection no intersect {{{123.289001,9.39620018}, {118.119003,8.07219982}}} {{{0,353.891998}, {126,9.39610004}}}
debugShowCubicLineIntersection wtTs[0]=0.999978653 {{{124.603165,9.37966728}, {124.142731,9.41717815}, {123.674263,9.45534515}, {123.289001,9.39610004}}} {{123.289001,9.39620018}} wnTs[0]=0 {{{123.289001,9.39620018}, {118.119003,8.07219982}}}
debugShowLineIntersection wtTs[0]=4.65488731e-06 {{{123.289001,9.39620018}, {118.119003,8.07219982}}} {{123.289001,9.39610004}} wtTs[1]=1 {{118.119003,8.07219982}} wnTs[0]=0 {{{123.289001,9.39610004}, {118.119003,8.07219982}}} wnTs[1]=1
debugShowLineIntersection wtTs[0]=1 {{{123.289001,9.39620018}, {118.119003,8.07219982}}} {{118.119003,8.07219982}} wnTs[0]=0 {{{118.119003,8.07219982}, {8.17210007,104.212997}}}
debugShowLineIntersection no intersect {{{118.119003,8.07219982}, {8.17210007,104.212997}}} {{{0,353.891998}, {126,9.39610004}}}
debugShowLineIntersection wtTs[0]=0 {{{118.119003,8.07219982}, {8.17210007,104.212997}}} {{118.119003,8.07219982}} wnTs[0]=1 {{{123.289001,9.39610004}, {118.119003,8.07219982}}}
debugShowLineIntersection wtTs[0]=0 {{{118.119003,8.07219982}, {8.17210007,104.212997}}} {{118.119003,8.07219982}} wtTs[1]=1 {{8.17210007,104.212997}} wnTs[0]=0 {{{118.119003,8.07219982}, {8.17210007,104.212997}}} wnTs[1]=1
debugShowLineIntersection wtTs[0]=1 {{{118.119003,8.07219982}, {8.17210007,104.212997}}} {{8.17210007,104.212997}} wnTs[0]=0 {{{8.17210007,104.212997}, {0,259.298737}}}
debugShowCubicLineIntersection wtTs[0]=0 {{{126,9.39610004}, {125.632057,9.29584408}, {125.122734,9.33733845}, {124.603165,9.37966728}}} {{126,9.39610004}} wnTs[0]=1 {{{0,353.891998}, {126,9.39610004}}}
debugShowCubicLineIntersection no intersect {{{124.603165,9.37966728}, {124.142731,9.41717815}, {123.674263,9.45534515}, {123.289001,9.39610004}}} {{{0,353.891998}, {126,9.39610004}}}
debugShowLineIntersection no intersect {{{0,353.891998}, {126,9.39610004}}} {{{123.289001,9.39610004}, {118.119003,8.07219982}}}
debugShowLineIntersection no intersect {{{0,353.891998}, {126,9.39610004}}} {{{118.119003,8.07219982}, {8.17210007,104.212997}}}
debugShowLineIntersection no intersect {{{0,353.891998}, {126,9.39610004}}} {{{8.17210007,104.212997}, {0,259.298737}}}
debugShowLineIntersection wtTs[0]=0 {{{0,353.891998}, {126,9.39610004}}} {{0,353.891998}} wnTs[0]=1 {{{0,259.298737}, {0,353.891998}}}
debugShowCubicIntersection wtTs[0]=1 {{{126,9.39610004}, {125.632057,9.29584408}, {125.122734,9.33733845}, {124.603165,9.37966728}}} {{124.603165,9.37966728}} wnTs[0]=0 {{{124.603165,9.37966728}, {124.142731,9.41717815}, {123.674263,9.45534515}, {123.289001,9.39610004}}}
debugShowCubicLineIntersection wtTs[0]=1 {{{124.603165,9.37966728}, {124.142731,9.41717815}, {123.674263,9.45534515}, {123.289001,9.39610004}}} {{123.289001,9.39610004}} wnTs[0]=0 {{{123.289001,9.39610004}, {118.119003,8.07219982}}}
debugShowLineIntersection wtTs[0]=1 {{{123.289001,9.39610004}, {118.119003,8.07219982}}} {{118.119003,8.07219982}} wnTs[0]=0 {{{118.119003,8.07219982}, {8.17210007,104.212997}}}
debugShowLineIntersection wtTs[0]=1 {{{118.119003,8.07219982}, {8.17210007,104.212997}}} {{8.17210007,104.212997}} wnTs[0]=0 {{{8.17210007,104.212997}, {0,259.298737}}}
debugShowLineIntersection wtTs[0]=1 {{{8.17210007,104.212997}, {0,259.298737}}} {{0,259.298737}} wnTs[0]=0 {{{0,259.298737}, {0,353.891998}}}
----------------x-x--x-x-------------- addExpanded
00: coinSeg/Span/PtT=2/3/3 endSpan=30 oppSeg/Span/PtT=10/19/19 oppEndSpan=29 MissingCoin
01: coinSeg/Span/PtT=3/36/36 endSpan=6 oppSeg/Span/PtT=11/35/35 oppEndSpan=22 MissingCoin
02: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
03: coinSeg/Span/PtT=2/3/3 endSpan=30 oppSeg/Span/PtT=10/19/19 oppEndSpan=29 MissingCoin
04: coinSeg/Span/PtT=3/36/36 endSpan=6 oppSeg/Span/PtT=11/35/35 oppEndSpan=22 MissingCoin
05: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
06: coinSeg/Span/PtT=10/19/19 endSpan=29 oppSeg/Span/PtT=2/3/3 oppEndSpan=30 MissingCoin
07: coinSeg/Span/PtT=11/35/35 endSpan=22 oppSeg/Span/PtT=3/36/36 oppEndSpan=6 MissingCoin
08: coinSeg/Span/PtT=10/19/19 endSpan=29 oppSeg/Span/PtT=2/3/3 oppEndSpan=30 MissingCoin
09: coinSeg/Span/PtT=11/35/35 endSpan=22 oppSeg/Span/PtT=3/36/36 oppEndSpan=6 MissingCoin
10: coinSeg/Span/PtT=11/33/33 endSpan=6 oppSeg/Span/PtT=11/22/22 oppEndSpan=6 ExpandCoin
11: coinSeg/Span/PtT=2/30/30 endSpan=19 oppSeg/Span/PtT=2/3/3 oppEndSpan=19 ExpandCoin
12: seg/base=13/25 seg/base=5/9 MarkCoinStart
13: seg/base=13/26 seg/base=5/10 MarkCoinEnd
14: seg/base=4/7 seg/base=12/23 MarkCoinStart
15: seg/base=4/8 seg/base=12/24 MarkCoinEnd
16: seg/base=11/33 seg/base=3/34 MarkCoinStart
17: seg/base=11/35 seg/base=3/36 MarkCoinEnd
18: seg/base=2/30 seg/base=10/29 MarkCoinStart
19: seg/base=2/32 seg/base=10/31 MarkCoinEnd
20: seg/base=9/28 seg/base=1/1 MarkCoinStart
21: seg/base=9/18 seg/base=1/2 MarkCoinEnd
22: seg/base=8/15 seg/base=6/11 MarkCoinStart
23: seg/base=8/27 seg/base=6/12 MarkCoinEnd
SkOpSegment::debugShowActiveSpans id=8 (8.17210007,104.212997 -2.71619996e-07,259.298737) t=0 tEnd=0.583904956 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=8 (-2.71619996e-07,259.298737 -5.82350016,369.813995) t=0.583904956 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=9 (-5.82350016,369.813995 7.26031715e-07,353.891998) t=0 tEnd=0.0441765002 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=9 (7.26031715e-07,353.891998 126,9.39620018) t=0.0441765002 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=10 (126,9.39620018 125.886971,9.36538583 125.760599,9.34795095 125.624687,9.33981037) t=0 tEnd=0.307128906 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=10 (125.624687,9.33981037 125.345733,9.32310212 125.026588,9.34554777 124.700119,9.37182617) t=0.307128906 tEnd=0.9375 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=10 (124.700119,9.37182617 124.66775,9.37443162 124.63531,9.3770743 124.602829,9.37972069) t=0.9375 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=11 (124.602829,9.37972069 124.574059,9.3820647 124.545259,9.38441166 124.516449,9.38673687) t=0 tEnd=0.0625 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=11 (124.516449,9.38673687 124.257155,9.40766372 123.997126,9.42685982 123.752594,9.4268837) t=0.0625 tEnd=0.625 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=11 (123.752594,9.4268837 123.589573,9.42689962 123.433437,9.41839421 123.289001,9.39620018) t=0.625 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=12 (123.289001,9.39620018 118.119003,8.07219982) t=0 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=13 (118.119003,8.07219982 8.17210007,104.212997) t=0 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=1 (0,353.891998 126,9.39610004) t=0 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=2 (126,9.39610004 125.886971,9.36530236 125.760605,9.34788101 125.624695,9.33975124) t=0 tEnd=0.307190555 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=2 (125.624695,9.33975124 125.345738,9.3230648 125.026588,9.34552196 124.700119,9.37180042) t=0.307190555 tEnd=0.937702598 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=2 (124.700119,9.37180042 124.667862,9.37439685 124.635532,9.37703031 124.603165,9.37966728) t=0.937702598 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=3 (124.603165,9.37966728 124.574282,9.38202029 124.545364,9.3843762 124.516441,9.38671017) t=0 tEnd=0.0627286673 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=3 (124.516441,9.38671017 124.257145,9.40763418 123.997124,9.42681973 123.752594,9.42682648) t=0.0627286673 tEnd=0.625091708 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=3 (123.752594,9.42682648 123.589574,9.42683098 123.433439,9.41831153 123.289001,9.39610004) t=0.625091708 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=4 (123.289001,9.39610004 118.119003,8.07219982) t=0 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=5 (118.119003,8.07219982 8.17210007,104.212997) t=0 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=6 (8.17210007,104.212997 0,259.298737) t=0 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=7 (0,259.298737 0,353.891998) t=0 tEnd=1 windSum=? windValue=1
----------------x-x--x-x-------------- move_multiples
00: coinSeg/Span/PtT=2/3/3 endSpan=30 oppSeg/Span/PtT=10/19/19 oppEndSpan=29 MissingCoin
01: coinSeg/Span/PtT=3/36/36 endSpan=6 oppSeg/Span/PtT=11/35/35 oppEndSpan=22 MissingCoin
02: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
03: coinSeg/Span/PtT=2/3/3 endSpan=30 oppSeg/Span/PtT=10/19/19 oppEndSpan=29 MissingCoin
04: coinSeg/Span/PtT=3/36/36 endSpan=6 oppSeg/Span/PtT=11/35/35 oppEndSpan=22 MissingCoin
05: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
06: coinSeg/Span/PtT=10/19/19 endSpan=29 oppSeg/Span/PtT=2/3/3 oppEndSpan=30 MissingCoin
07: coinSeg/Span/PtT=11/35/35 endSpan=22 oppSeg/Span/PtT=3/36/36 oppEndSpan=6 MissingCoin
08: coinSeg/Span/PtT=10/19/19 endSpan=29 oppSeg/Span/PtT=2/3/3 oppEndSpan=30 MissingCoin
09: coinSeg/Span/PtT=11/35/35 endSpan=22 oppSeg/Span/PtT=3/36/36 oppEndSpan=6 MissingCoin
10: coinSeg/Span/PtT=11/33/33 endSpan=6 oppSeg/Span/PtT=11/22/22 oppEndSpan=6 ExpandCoin
11: coinSeg/Span/PtT=2/30/30 endSpan=19 oppSeg/Span/PtT=2/3/3 oppEndSpan=19 ExpandCoin
12: seg/base=13/25 seg/base=5/9 MarkCoinStart
13: seg/base=13/26 seg/base=5/10 MarkCoinEnd
14: seg/base=4/7 seg/base=12/23 MarkCoinStart
15: seg/base=4/8 seg/base=12/24 MarkCoinEnd
16: seg/base=11/33 seg/base=3/34 MarkCoinStart
17: seg/base=11/35 seg/base=3/36 MarkCoinEnd
18: seg/base=2/30 seg/base=10/29 MarkCoinStart
19: seg/base=2/32 seg/base=10/31 MarkCoinEnd
20: seg/base=9/28 seg/base=1/1 MarkCoinStart
21: seg/base=9/18 seg/base=1/2 MarkCoinEnd
22: seg/base=8/15 seg/base=6/11 MarkCoinStart
23: seg/base=8/27 seg/base=6/12 MarkCoinEnd
----------------x-x--x-x-------------- move_nearby
00: coinSeg/Span/PtT=2/3/3 endSpan=30 oppSeg/Span/PtT=10/19/19 oppEndSpan=29 MissingCoin
01: coinSeg/Span/PtT=3/36/36 endSpan=6 oppSeg/Span/PtT=11/35/35 oppEndSpan=22 MissingCoin
02: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
03: coinSeg/Span/PtT=2/3/3 endSpan=30 oppSeg/Span/PtT=10/19/19 oppEndSpan=29 MissingCoin
04: coinSeg/Span/PtT=3/36/36 endSpan=6 oppSeg/Span/PtT=11/35/35 oppEndSpan=22 MissingCoin
05: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
06: coinSeg/Span/PtT=10/19/19 endSpan=29 oppSeg/Span/PtT=2/3/3 oppEndSpan=30 MissingCoin
07: coinSeg/Span/PtT=11/35/35 endSpan=22 oppSeg/Span/PtT=3/36/36 oppEndSpan=6 MissingCoin
08: coinSeg/Span/PtT=10/19/19 endSpan=29 oppSeg/Span/PtT=2/3/3 oppEndSpan=30 MissingCoin
09: coinSeg/Span/PtT=11/35/35 endSpan=22 oppSeg/Span/PtT=3/36/36 oppEndSpan=6 MissingCoin
10: coinSeg/Span/PtT=11/33/33 endSpan=6 oppSeg/Span/PtT=11/22/22 oppEndSpan=6 ExpandCoin
11: coinSeg/Span/PtT=2/30/30 endSpan=19 oppSeg/Span/PtT=2/3/3 oppEndSpan=19 ExpandCoin
12: seg/base=13/25 seg/base=5/9 MarkCoinStart
13: seg/base=13/26 seg/base=5/10 MarkCoinEnd
14: seg/base=4/7 seg/base=12/23 MarkCoinStart
15: seg/base=4/8 seg/base=12/24 MarkCoinEnd
16: seg/base=11/33 seg/base=3/34 MarkCoinStart
17: seg/base=11/35 seg/base=3/36 MarkCoinEnd
18: seg/base=2/30 seg/base=10/29 MarkCoinStart
19: seg/base=2/32 seg/base=10/31 MarkCoinEnd
20: seg/base=9/28 seg/base=1/1 MarkCoinStart
21: seg/base=9/18 seg/base=1/2 MarkCoinEnd
22: seg/base=8/15 seg/base=6/11 MarkCoinStart
23: seg/base=8/27 seg/base=6/12 MarkCoinEnd
----------------x-x--x-x-------------- correctEnds
00: coinSeg/Span/PtT=2/3/3 endSpan=30 oppSeg/Span/PtT=10/19/19 oppEndSpan=29 MissingCoin
01: coinSeg/Span/PtT=3/36/36 endSpan=6 oppSeg/Span/PtT=11/35/35 oppEndSpan=22 MissingCoin
02: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
03: coinSeg/Span/PtT=2/3/3 endSpan=30 oppSeg/Span/PtT=10/19/19 oppEndSpan=29 MissingCoin
04: coinSeg/Span/PtT=3/36/36 endSpan=6 oppSeg/Span/PtT=11/35/35 oppEndSpan=22 MissingCoin
05: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
06: coinSeg/Span/PtT=10/19/19 endSpan=29 oppSeg/Span/PtT=2/3/3 oppEndSpan=30 MissingCoin
07: coinSeg/Span/PtT=11/35/35 endSpan=22 oppSeg/Span/PtT=3/36/36 oppEndSpan=6 MissingCoin
08: coinSeg/Span/PtT=10/19/19 endSpan=29 oppSeg/Span/PtT=2/3/3 oppEndSpan=30 MissingCoin
09: coinSeg/Span/PtT=11/35/35 endSpan=22 oppSeg/Span/PtT=3/36/36 oppEndSpan=6 MissingCoin
10: coinSeg/Span/PtT=11/33/33 endSpan=6 oppSeg/Span/PtT=11/22/22 oppEndSpan=6 ExpandCoin
11: coinSeg/Span/PtT=2/30/30 endSpan=19 oppSeg/Span/PtT=2/3/3 oppEndSpan=19 ExpandCoin
12: seg/base=13/25 seg/base=5/9 MarkCoinStart
13: seg/base=13/26 seg/base=5/10 MarkCoinEnd
14: seg/base=4/7 seg/base=12/23 MarkCoinStart
15: seg/base=4/8 seg/base=12/24 MarkCoinEnd
16: seg/base=11/33 seg/base=3/34 MarkCoinStart
17: seg/base=11/35 seg/base=3/36 MarkCoinEnd
18: seg/base=2/30 seg/base=10/29 MarkCoinStart
19: seg/base=2/32 seg/base=10/31 MarkCoinEnd
20: seg/base=9/28 seg/base=1/1 MarkCoinStart
21: seg/base=9/18 seg/base=1/2 MarkCoinEnd
22: seg/base=8/15 seg/base=6/11 MarkCoinStart
23: seg/base=8/27 seg/base=6/12 MarkCoinEnd
----------------x-x--x-x-------------- addEndMovedSpans
00: coinSeg/Span/PtT=2/3/3 endSpan=30 oppSeg/Span/PtT=10/19/19 oppEndSpan=29 MissingCoin
01: coinSeg/Span/PtT=3/36/36 endSpan=6 oppSeg/Span/PtT=11/35/35 oppEndSpan=22 MissingCoin
02: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
03: coinSeg/Span/PtT=2/3/3 endSpan=30 oppSeg/Span/PtT=10/19/19 oppEndSpan=29 MissingCoin
04: coinSeg/Span/PtT=3/36/36 endSpan=6 oppSeg/Span/PtT=11/35/35 oppEndSpan=22 MissingCoin
05: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
06: coinSeg/Span/PtT=10/19/19 endSpan=29 oppSeg/Span/PtT=2/3/3 oppEndSpan=30 MissingCoin
07: coinSeg/Span/PtT=11/35/35 endSpan=22 oppSeg/Span/PtT=3/36/36 oppEndSpan=6 MissingCoin
08: coinSeg/Span/PtT=10/19/19 endSpan=29 oppSeg/Span/PtT=2/3/3 oppEndSpan=30 MissingCoin
09: coinSeg/Span/PtT=11/35/35 endSpan=22 oppSeg/Span/PtT=3/36/36 oppEndSpan=6 MissingCoin
10: coinSeg/Span/PtT=11/33/33 endSpan=6 oppSeg/Span/PtT=11/22/22 oppEndSpan=6 ExpandCoin
11: coinSeg/Span/PtT=2/30/30 endSpan=19 oppSeg/Span/PtT=2/3/3 oppEndSpan=19 ExpandCoin
12: seg/base=13/25 seg/base=5/9 MarkCoinStart
13: seg/base=13/26 seg/base=5/10 MarkCoinEnd
14: seg/base=4/7 seg/base=12/23 MarkCoinStart
15: seg/base=4/8 seg/base=12/24 MarkCoinEnd
16: seg/base=11/33 seg/base=3/34 MarkCoinStart
17: seg/base=11/35 seg/base=3/36 MarkCoinEnd
18: seg/base=2/30 seg/base=10/29 MarkCoinStart
19: seg/base=2/32 seg/base=10/31 MarkCoinEnd
20: seg/base=9/28 seg/base=1/1 MarkCoinStart
21: seg/base=9/18 seg/base=1/2 MarkCoinEnd
22: seg/base=8/15 seg/base=6/11 MarkCoinStart
23: seg/base=8/27 seg/base=6/12 MarkCoinEnd
----------------x-x--x-x-------------- expand
00: coinSeg/Span/PtT=2/3/3 endSpan=30 oppSeg/Span/PtT=10/19/19 oppEndSpan=29 MissingCoin
01: coinSeg/Span/PtT=3/36/36 endSpan=6 oppSeg/Span/PtT=11/35/35 oppEndSpan=22 MissingCoin
02: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
03: coinSeg/Span/PtT=2/3/3 endSpan=30 oppSeg/Span/PtT=10/19/19 oppEndSpan=29 MissingCoin
04: coinSeg/Span/PtT=3/36/36 endSpan=6 oppSeg/Span/PtT=11/35/35 oppEndSpan=22 MissingCoin
05: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
06: coinSeg/Span/PtT=10/19/19 endSpan=29 oppSeg/Span/PtT=2/3/3 oppEndSpan=30 MissingCoin
07: coinSeg/Span/PtT=11/35/35 endSpan=22 oppSeg/Span/PtT=3/36/36 oppEndSpan=6 MissingCoin
08: coinSeg/Span/PtT=10/19/19 endSpan=29 oppSeg/Span/PtT=2/3/3 oppEndSpan=30 MissingCoin
09: coinSeg/Span/PtT=11/35/35 endSpan=22 oppSeg/Span/PtT=3/36/36 oppEndSpan=6 MissingCoin
10: coinSeg/Span/PtT=11/33/33 endSpan=6 oppSeg/Span/PtT=11/22/22 oppEndSpan=6 ExpandCoin
11: coinSeg/Span/PtT=2/30/30 endSpan=19 oppSeg/Span/PtT=2/3/3 oppEndSpan=19 ExpandCoin
12: seg/base=13/25 seg/base=5/9 MarkCoinStart
13: seg/base=13/26 seg/base=5/10 MarkCoinEnd
14: seg/base=4/7 seg/base=12/23 MarkCoinStart
15: seg/base=4/8 seg/base=12/24 MarkCoinEnd
16: seg/base=11/33 seg/base=3/34 MarkCoinStart
17: seg/base=11/35 seg/base=3/36 MarkCoinEnd
18: seg/base=2/30 seg/base=10/29 MarkCoinStart
19: seg/base=2/32 seg/base=10/31 MarkCoinEnd
20: seg/base=9/28 seg/base=1/1 MarkCoinStart
21: seg/base=9/18 seg/base=1/2 MarkCoinEnd
22: seg/base=8/15 seg/base=6/11 MarkCoinStart
23: seg/base=8/27 seg/base=6/12 MarkCoinEnd
------------------xx-x-x-------------- addExpanded
00: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
01: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
02: seg/base=13/25 seg/base=5/9 MarkCoinStart
03: seg/base=13/26 seg/base=5/10 MarkCoinEnd
04: seg/base=4/7 seg/base=12/23 MarkCoinStart
05: seg/base=4/8 seg/base=12/24 MarkCoinEnd
06: seg/base=11/33 seg/base=3/34 MarkCoinStart
07: seg/base=11/22 seg/base=3/6 MarkCoinEnd
08: seg/base=3/36 MarkCoinInsert
09: seg/base=11/35 MarkCoinInsert
10: seg/base=2/3 seg/base=10/19 MarkCoinStart
11: seg/base=2/32 seg/base=10/31 MarkCoinEnd
12: seg/base=10/29 MarkCoinInsert
13: seg/base=2/30 MarkCoinInsert
14: seg/base=9/28 seg/base=1/1 MarkCoinStart
15: seg/base=9/18 seg/base=1/2 MarkCoinEnd
16: seg/base=8/15 seg/base=6/11 MarkCoinStart
17: seg/base=8/27 seg/base=6/12 MarkCoinEnd
------------------xx-x-x-------------- move_multiples
00: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
01: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
02: seg/base=13/25 seg/base=5/9 MarkCoinStart
03: seg/base=13/26 seg/base=5/10 MarkCoinEnd
04: seg/base=4/7 seg/base=12/23 MarkCoinStart
05: seg/base=4/8 seg/base=12/24 MarkCoinEnd
06: seg/base=11/33 seg/base=3/34 MarkCoinStart
07: seg/base=11/22 seg/base=3/6 MarkCoinEnd
08: seg/base=3/36 MarkCoinInsert
09: seg/base=11/35 MarkCoinInsert
10: seg/base=2/3 seg/base=10/19 MarkCoinStart
11: seg/base=2/32 seg/base=10/31 MarkCoinEnd
12: seg/base=10/29 MarkCoinInsert
13: seg/base=2/30 MarkCoinInsert
14: seg/base=9/28 seg/base=1/1 MarkCoinStart
15: seg/base=9/18 seg/base=1/2 MarkCoinEnd
16: seg/base=8/15 seg/base=6/11 MarkCoinStart
17: seg/base=8/27 seg/base=6/12 MarkCoinEnd
------------------xx-x-x-------------- move_nearby
00: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
01: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
02: seg/base=13/25 seg/base=5/9 MarkCoinStart
03: seg/base=13/26 seg/base=5/10 MarkCoinEnd
04: seg/base=4/7 seg/base=12/23 MarkCoinStart
05: seg/base=4/8 seg/base=12/24 MarkCoinEnd
06: seg/base=11/33 seg/base=3/34 MarkCoinStart
07: seg/base=11/22 seg/base=3/6 MarkCoinEnd
08: seg/base=3/36 MarkCoinInsert
09: seg/base=11/35 MarkCoinInsert
10: seg/base=2/3 seg/base=10/19 MarkCoinStart
11: seg/base=2/32 seg/base=10/31 MarkCoinEnd
12: seg/base=10/29 MarkCoinInsert
13: seg/base=2/30 MarkCoinInsert
14: seg/base=9/28 seg/base=1/1 MarkCoinStart
15: seg/base=9/18 seg/base=1/2 MarkCoinEnd
16: seg/base=8/15 seg/base=6/11 MarkCoinStart
17: seg/base=8/27 seg/base=6/12 MarkCoinEnd
------------------xx-x-x-------------- addExpanded
00: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
01: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
02: seg/base=13/25 seg/base=5/9 MarkCoinStart
03: seg/base=13/26 seg/base=5/10 MarkCoinEnd
04: seg/base=4/7 seg/base=12/23 MarkCoinStart
05: seg/base=4/8 seg/base=12/24 MarkCoinEnd
06: seg/base=11/33 seg/base=3/34 MarkCoinStart
07: seg/base=11/22 seg/base=3/6 MarkCoinEnd
08: seg/base=3/36 MarkCoinInsert
09: seg/base=11/35 MarkCoinInsert
10: seg/base=2/3 seg/base=10/19 MarkCoinStart
11: seg/base=2/32 seg/base=10/31 MarkCoinEnd
12: seg/base=10/29 MarkCoinInsert
13: seg/base=2/30 MarkCoinInsert
14: seg/base=9/28 seg/base=1/1 MarkCoinStart
15: seg/base=9/18 seg/base=1/2 MarkCoinEnd
16: seg/base=8/15 seg/base=6/11 MarkCoinStart
17: seg/base=8/27 seg/base=6/12 MarkCoinEnd
------------------xx-x-x-------------- mark
00: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
01: coinSeg/Span/PtT=5/9/9 endSpan=10 oppSeg/Span/PtT=13/25/25 oppEndSpan=26 MissingCoin
02: seg/base=13/25 seg/base=5/9 MarkCoinStart
03: seg/base=13/26 seg/base=5/10 MarkCoinEnd
04: seg/base=4/7 seg/base=12/23 MarkCoinStart
05: seg/base=4/8 seg/base=12/24 MarkCoinEnd
06: seg/base=11/33 seg/base=3/34 MarkCoinStart
07: seg/base=11/22 seg/base=3/6 MarkCoinEnd
08: seg/base=3/36 MarkCoinInsert
09: seg/base=11/35 MarkCoinInsert
10: seg/base=2/3 seg/base=10/19 MarkCoinStart
11: seg/base=2/32 seg/base=10/31 MarkCoinEnd
12: seg/base=10/29 MarkCoinInsert
13: seg/base=2/30 MarkCoinInsert
14: seg/base=9/28 seg/base=1/1 MarkCoinStart
15: seg/base=9/18 seg/base=1/2 MarkCoinEnd
16: seg/base=8/15 seg/base=6/11 MarkCoinStart
17: seg/base=8/27 seg/base=6/12 MarkCoinEnd
-------------------------------------- missing_coincidence
-------------------------------------- expand
-------------------------------------- expand
-------------------------------------- apply
SkOpSegment::markDone id=5 (118.119003,8.07219982 8.17210007,104.212997) t=0 [9] (118.119003,8.07219982) tEnd=1 newWindSum=? newOppSum=? oppSum=? windSum=? windValue=0 oppValue=0
SkOpSegment::markDone id=12 (123.289001,9.39620018 118.119003,8.07219982) t=0 [23] (123.289001,9.39620018) tEnd=1 newWindSum=? newOppSum=? oppSum=? windSum=? windValue=0 oppValue=0
SkOpSegment::markDone id=3 (124.603165,9.37966728 124.142731,9.41717815 123.674263,9.45534515 123.289001,9.39610004) t=0.0627286673 [34] (124.516441,9.38671017) tEnd=0.625091708 newWindSum=? newOppSum=? oppSum=? windSum=? windValue=0 oppValue=0
SkOpSegment::markDone id=3 (124.603165,9.37966728 124.142731,9.41717815 123.674263,9.45534515 123.289001,9.39610004) t=0.625091708 [36] (123.752594,9.42682648) tEnd=1 newWindSum=? newOppSum=? oppSum=? windSum=? windValue=0 oppValue=0
SkOpSegment::markDone id=10 (126,9.39620018 125.631981,9.29586983 125.12252,9.3373785 124.602829,9.37972069) t=0 [19] (126,9.39620018) tEnd=0.307128906 newWindSum=? newOppSum=? oppSum=? windSum=? windValue=0 oppValue=0
SkOpSegment::markDone id=10 (126,9.39620018 125.631981,9.29586983 125.12252,9.3373785 124.602829,9.37972069) t=0.307128906 [29] (125.624687,9.33981037) tEnd=0.9375 newWindSum=? newOppSum=? oppSum=? windSum=? windValue=0 oppValue=0
SkOpSegment::markDone id=1 (0,353.891998 126,9.39610004) t=0 [1] (0,353.891998) tEnd=1 newWindSum=? newOppSum=? oppSum=? windSum=? windValue=0 oppValue=0
SkOpSegment::markDone id=6 (8.17210007,104.212997 0,259.298737) t=0 [11] (8.17210007,104.212997) tEnd=1 newWindSum=? newOppSum=? oppSum=? windSum=? windValue=0 oppValue=0
-------------------------------------- findOverlaps
SkOpSegment::debugShowActiveSpans id=8 (8.17210007,104.212997 -2.71619996e-07,259.298737) t=0 tEnd=0.583904956 windSum=? oppSum=? windValue=1 oppValue=1
SkOpSegment::debugShowActiveSpans id=8 (-2.71619996e-07,259.298737 -5.82350016,369.813995) t=0.583904956 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=9 (-5.82350016,369.813995 7.26031715e-07,353.891998) t=0 tEnd=0.0441765002 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=9 (7.26031715e-07,353.891998 126,9.39620018) t=0.0441765002 tEnd=1 windSum=? oppSum=? windValue=1 oppValue=1
SkOpSegment::debugShowActiveSpans id=10 (124.700119,9.37182617 124.66775,9.37443162 124.63531,9.3770743 124.602829,9.37972069) t=0.9375 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=11 (124.602829,9.37972069 124.574059,9.3820647 124.545259,9.38441166 124.516449,9.38673687) t=0 tEnd=0.0625 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=11 (124.516449,9.38673687 124.257155,9.40766372 123.997126,9.42685982 123.752594,9.4268837) t=0.0625 tEnd=0.625 windSum=? oppSum=? windValue=1 oppValue=1
SkOpSegment::debugShowActiveSpans id=11 (123.752594,9.4268837 123.589573,9.42689962 123.433437,9.41839421 123.289001,9.39620018) t=0.625 tEnd=1 windSum=? oppSum=? windValue=1 oppValue=1
SkOpSegment::debugShowActiveSpans id=13 (118.119003,8.07219982 8.17210007,104.212997) t=0 tEnd=1 windSum=? oppSum=? windValue=1 oppValue=1
SkOpSegment::debugShowActiveSpans id=2 (126,9.39610004 125.886971,9.36530236 125.760605,9.34788101 125.624695,9.33975124) t=0 tEnd=0.307190555 windSum=? oppSum=? windValue=1 oppValue=1
SkOpSegment::debugShowActiveSpans id=2 (125.624695,9.33975124 125.345738,9.3230648 125.026588,9.34552196 124.700119,9.37180042) t=0.307190555 tEnd=0.937702598 windSum=? oppSum=? windValue=1 oppValue=1
SkOpSegment::debugShowActiveSpans id=2 (124.700119,9.37180042 124.667862,9.37439685 124.635532,9.37703031 124.603165,9.37966728) t=0.937702598 tEnd=1 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=3 (124.603165,9.37966728 124.574282,9.38202029 124.545364,9.3843762 124.516441,9.38671017) t=0 tEnd=0.0627286673 windSum=? windValue=1
SkOpSegment::debugShowActiveSpans id=4 (123.289001,9.39610004 118.119003,8.07219982) t=0 tEnd=1 windSum=? oppSum=? windValue=1 oppValue=1
SkOpSegment::debugShowActiveSpans id=7 (0,259.298737 0,353.891998) t=0 tEnd=1 windSum=? windValue=1
-------------------------------------- calc_angles
SkOpSegment::sortAngles [8] tStart=0 [15]
SkOpSegment::sortAngles [8] tStart=0.583904956 [27]
SkOpAngle::after [8/2] 5/5 tStart=0.583904956 tEnd=0 < [7/23] 23/23 tStart=0 tEnd=1 < [8/3] 21/21 tStart=0.583904956 tEnd=1 F 4
SkOpAngle::afterPart {{{0,259.298737}, {8.17210034,104.212997}}} id=8
SkOpAngle::afterPart {{{0,259.298737}, {0,353.891998}}} id=7
SkOpAngle::afterPart {{{0,259.298737}, {-5.82349988,369.813995}}} id=8
SkOpSegment::sortAngles [9] tStart=0.0441765002 [28]
SkOpAngle::after [9/4] 21/21 tStart=0.0441765002 tEnd=0 < [7/24] 7/7 tStart=1 tEnd=0 < [9/5] 5/5 tStart=0.0441765002 tEnd=1 F 4
SkOpAngle::afterPart {{{0,353.891998}, {-5.82350088,369.813995}}} id=9
SkOpAngle::afterPart {{{0,353.891998}, {0,259.298737}}} id=7
SkOpAngle::afterPart {{{0,353.891998}, {125.999999,9.39620018}}} id=9
SkOpSegment::sortAngles [9] tStart=1 [18]
SkOpSegment::sortAngles [10] tStart=0.9375 [31]
SkOpAngle::after [10/7] 17/17 tStart=0.9375 tEnd=1 < [2/19] 17/17 tStart=0.937702598 tEnd=1 < [2/18] 1/1 tStart=0.937702598 tEnd=0.307190555 T 12
SkOpAngle::afterPart {{{124.700119,9.37180042}, {124.66775,9.37440587}, {124.63531,9.37704855}, {124.602829,9.37969494}}} id=10
SkOpAngle::afterPart {{{124.700119,9.37180042}, {124.667862,9.37439685}, {124.635532,9.37703031}, {124.603165,9.37966728}}} id=2
SkOpAngle::afterPart {{{124.700119,9.37180042}, {125.026588,9.34552196}, {125.345738,9.3230648}, {125.624695,9.33975124}}} id=2
SkOpSegment::sortAngles [11] tStart=0.0625 [33]
SkOpAngle::after [11/8] 1/1 tStart=0.0625 tEnd=0 < [3/20] 1/1 tStart=0.0627286673 tEnd=0 < [11/9] 17/17 tStart=0.0625 tEnd=0.625 T 12
SkOpAngle::afterPart {{{124.516441,9.38671017}, {124.545252,9.38438496}, {124.574051,9.382038}, {124.602821,9.37969398}}} id=11
SkOpAngle::afterPart {{{124.516441,9.38671017}, {124.545364,9.3843762}, {124.574282,9.38202029}, {124.603165,9.37966728}}} id=3
SkOpAngle::afterPart {{{124.516441,9.38671017}, {124.257148,9.40763702}, {123.997118,9.42683311}, {123.752586,9.42685699}}} id=11
SkOpSegment::sortAngles [11] tStart=0.625 [35]
SkOpSegment::sortAngles [11] tStart=1 [22]
SkOpSegment::sortAngles [13] tStart=0 [25]
SkOpSegment::sortAngles [13] tStart=1 [26]
SkOpSegment::sortAngles [2] tStart=0 [3]
SkOpSegment::sortAngles [2] tStart=0.307190555 [30]
SkOpSegment::sortAngles [2] tStart=0.937702598 [32]
SkOpSegment::sortAngles [3] tStart=0.0627286673 [34]
SkOpSegment::sortAngles [4] tStart=0 [7]
SkOpSegment::sortAngles [4] tStart=1 [8]
SkOpSegment::sortAngles [7] tStart=0 [13]
SkOpSegment::sortAngles [7] tStart=1 [14]
coinSpan - id=13 t=0 tEnd=1
coinSpan + id=5 t=0 tEnd=1
coinSpan - id=4 t=0 tEnd=1
coinSpan + id=12 t=0 tEnd=1
coinSpan - id=11 t=0.0625 tEnd=1
coinSpan + id=3 t=0.0627286673 tEnd=1
coinSpan - id=2 t=0 tEnd=0.937702598
coinSpan + id=10 t=0 tEnd=0.9375
coinSpan - id=9 t=0.0441765002 tEnd=1
coinSpan + id=1 t=0 tEnd=1
coinSpan - id=8 t=0 tEnd=0.583904956
coinSpan + id=6 t=0 tEnd=1
SkOpSpan::sortableTop dir=kLeft seg=8 t=0.291952478 pt=(4.08605003,181.755859)
SkOpSpan::sortableTop [0] valid=1 operand=1 span=15 ccw=0 seg=8 {{{8.17210007f, 104.212997f}, {-5.82350016f, 369.813995f}}} t=0.291952478 pt=(4.08605003,181.755859) slope=(-13.9956002,265.600998)
SkOpSegment::markWinding id=8 (8.17210007,104.212997 -5.82350016,369.813995) t=0 [15] (8.17210007,104.212997) tEnd=0.583904956 newWindSum=1 newOppSum=1 oppSum=1 windSum=1 windValue=1 oppValue=1
SkOpSegment::markWinding id=8 (8.17210007,104.212997 -5.82350016,369.813995) t=0 [15] (8.17210007,104.212997) tEnd=0.583904956 newWindSum=1 newOppSum=1 oppSum=1 windSum=1 windValue=1 oppValue=1
SkOpSegment::markWinding id=13 (118.119003,8.07219982 8.17210007,104.212997) t=0 [25] (118.119003,8.07219982) tEnd=1 newWindSum=1 newOppSum=1 oppSum=? windSum=? windValue=1 oppValue=1
SkOpSegment::markWinding id=4 (123.289001,9.39610004 118.119003,8.07219982) t=0 [7] (123.289001,9.39610004) tEnd=1 newWindSum=1 newOppSum=1 oppSum=? windSum=? windValue=1 oppValue=1
SkOpSegment::markWinding id=11 (124.602829,9.37972069 124.142509,9.41722488 123.674164,9.45538425 123.289001,9.39620018) t=0.625 [35] (123.752594,9.4268837) tEnd=1 newWindSum=1 newOppSum=1 oppSum=? windSum=? windValue=1 oppValue=1
SkOpSegment::markWinding id=11 (124.602829,9.37972069 124.142509,9.41722488 123.674164,9.45538425 123.289001,9.39620018) t=0.0625 [33] (124.516449,9.38673687) tEnd=0.625 newWindSum=1 newOppSum=1 oppSum=? windSum=? windValue=1 oppValue=1
SkOpSegment::activeOp id=8 t=0.583904956 tEnd=0 op=sect miFrom=1 miTo=0 suFrom=1 suTo=0 result=1
SkOpSegment::findNextOp simple
SkOpSegment::markDone id=8 (8.17210007,104.212997 -5.82350016,369.813995) t=0 [15] (8.17210007,104.212997) tEnd=0.583904956 newWindSum=1 newOppSum=1 oppSum=1 windSum=1 windValue=1 oppValue=1
bridgeOp current id=8 from=(-2.71619996e-07,259.298737) to=(8.17210007,104.212997)
SkOpSegment::findNextOp simple
SkOpSegment::markDone id=13 (118.119003,8.07219982 8.17210007,104.212997) t=0 [25] (118.119003,8.07219982) tEnd=1 newWindSum=1 newOppSum=1 oppSum=1 windSum=1 windValue=1 oppValue=1
bridgeOp current id=13 from=(8.17210007,104.212997) to=(118.119003,8.07219982)
path.moveTo(-2.71619996e-07,259.298737);
path.lineTo(8.17210007,104.212997);
SkOpSegment::findNextOp simple
SkOpSegment::markDone id=4 (123.289001,9.39610004 118.119003,8.07219982) t=0 [7] (123.289001,9.39610004) tEnd=1 newWindSum=1 newOppSum=1 oppSum=1 windSum=1 windValue=1 oppValue=1
bridgeOp current id=4 from=(118.119003,8.07219982) to=(123.289001,9.39610004)
path.lineTo(118.119003,8.07219982);
SkOpSegment::findNextOp simple
SkOpSegment::markDone id=11 (124.602829,9.37972069 124.142509,9.41722488 123.674164,9.45538425 123.289001,9.39620018) t=0.625 [35] (123.752594,9.4268837) tEnd=1 newWindSum=1 newOppSum=1 oppSum=1 windSum=1 windValue=1 oppValue=1
bridgeOp current id=11 from=(123.289001,9.39620018) to=(123.752594,9.4268837)
path.lineTo(123.289001,9.39610004);
path.cubicTo(123.433441,9.41839409, 123.589569,9.42689991, 123.752594,9.4268837);
SkOpSegment::markWinding id=11 (124.602829,9.37972069 124.142509,9.41722488 123.674164,9.45538425 123.289001,9.39620018) t=0 [21] (124.602829,9.37972069) tEnd=0.0625 newWindSum=1 newOppSum=1 oppSum=? windSum=? windValue=1 oppValue=0
SkOpSegment::markWinding id=10 (126,9.39620018 125.631981,9.29586983 125.12252,9.3373785 124.602829,9.37972069) t=0.9375 [31] (124.700119,9.37182617) tEnd=1 newWindSum=1 newOppSum=1 oppSum=? windSum=? windValue=1 oppValue=0
SkOpSegment::markAngle last segment=10 span=31 windSum=1
SkOpSegment::markWinding id=3 (124.603165,9.37966728 124.142731,9.41717815 123.674263,9.45534515 123.289001,9.39610004) t=0 [5] (124.603165,9.37966728) tEnd=0.0627286673 newWindSum=1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
SkOpSegment::markWinding id=2 (126,9.39610004 125.632057,9.29584408 125.122734,9.33733845 124.603165,9.37966728) t=0.937702598 [32] (124.700119,9.37180042) tEnd=1 newWindSum=1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
SkOpSegment::markAngle last segment=2 span=32 windSum=1
SkOpSegment::findNextOp
SkOpAngle::dumpOne [11/9] next=11/8 sect=17/17 s=0.0625 [33] e=0.625 [35] sgn=-1 windVal=1 windSum=1 oppVal=1 oppSum=1 operand
SkOpAngle::dumpOne [11/8] next=3/20 sect=1/1 s=0.0625 [33] e=0 [21] sgn=1 windVal=1 windSum=1 oppVal=0 oppSum=1 operand
SkOpAngle::dumpOne [3/20] next=11/9 sect=1/1 s=0.0627286673 [34] e=0 [5] sgn=1 windVal=1 windSum=1 oppVal=0 oppSum=0
SkOpSegment::activeOp id=11 t=0.0625 tEnd=0 op=sect miFrom=1 miTo=1 suFrom=1 suTo=0 result=1
SkOpSegment::findNextOp chase.append segment=10 span=31 windSum=1
SkOpSegment::activeOp id=3 t=0.0627286673 tEnd=0 op=sect miFrom=1 miTo=0 suFrom=0 suTo=0 result=0
SkOpSegment::markDone id=3 (124.603165,9.37966728 124.142731,9.41717815 123.674263,9.45534515 123.289001,9.39610004) t=0 [5] (124.603165,9.37966728) tEnd=0.0627286673 newWindSum=1 newOppSum=0 oppSum=0 windSum=1 windValue=1 oppValue=0
SkOpSegment::markDone id=2 (126,9.39610004 125.632057,9.29584408 125.122734,9.33733845 124.603165,9.37966728) t=0.937702598 [32] (124.700119,9.37180042) tEnd=1 newWindSum=1 newOppSum=0 oppSum=0 windSum=1 windValue=1 oppValue=0
SkOpSegment::findNextOp chase.append segment=2 span=32 windSum=1
SkOpSegment::markDone id=11 (124.602829,9.37972069 124.142509,9.41722488 123.674164,9.45538425 123.289001,9.39620018) t=0.0625 [33] (124.516449,9.38673687) tEnd=0.625 newWindSum=1 newOppSum=1 oppSum=1 windSum=1 windValue=1 oppValue=1
SkOpSegment::findNextOp from:[11] to:[11] start=-1132576784 end=-1353716568
bridgeOp current id=11 from=(123.752594,9.4268837) to=(124.516449,9.38673687)
path.cubicTo(123.997124,9.42685986, 124.257156,9.40766335, 124.516449,9.38673687);
SkOpSegment::findNextOp simple
SkOpSegment::markDone id=11 (124.602829,9.37972069 124.142509,9.41722488 123.674164,9.45538425 123.289001,9.39620018) t=0 [21] (124.602829,9.37972069) tEnd=0.0625 newWindSum=1 newOppSum=1 oppSum=1 windSum=1 windValue=1 oppValue=0
bridgeOp current id=11 from=(124.516449,9.38673687) to=(124.602829,9.37972069)
path.cubicTo(124.545258,9.38441181, 124.574059,9.38206482, 124.602829,9.37972069);
SkOpSegment::markWinding id=2 (126,9.39610004 125.632057,9.29584408 125.122734,9.33733845 124.603165,9.37966728) t=0.307190555 [30] (125.624695,9.33975124) tEnd=0.937702598 newWindSum=1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=1
SkOpSegment::markWinding id=2 (126,9.39610004 125.632057,9.29584408 125.122734,9.33733845 124.603165,9.37966728) t=0 [3] (126,9.39610004) tEnd=0.307190555 newWindSum=1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=1
SkOpSegment::markWinding id=9 (-5.82350016,369.813995 126,9.39620018) t=0.0441765002 [28] (7.26031715e-07,353.891998) tEnd=1 newWindSum=-1 newOppSum=1 oppSum=? windSum=? windValue=1 oppValue=1
SkOpSegment::markAngle last segment=9 span=28 windSum=-1
SkOpSegment::findNextOp
SkOpAngle::dumpOne [10/7] next=2/19 sect=17/17 s=0.9375 [31] e=1 [20] sgn=-1 windVal=1 windSum=1 oppVal=0 oppSum=1 operand
SkOpAngle::dumpOne [2/19] next=2/18 sect=17/17 s=0.937702598 [32] e=1 [4] sgn=-1 windVal=1 windSum=1 oppVal=0 oppSum=0 done
SkOpAngle::dumpOne [2/18] next=10/7 sect=1/1 s=0.937702598 [32] e=0.307190555 [30] sgn=1 windVal=1 windSum=1 oppVal=1 oppSum=-1
SkOpSegment::activeOp id=2 t=0.937702598 tEnd=1 op=sect = result=1
SkOpSegment::activeOp id=2 t=0.937702598 tEnd=0.307190555 op=sect miFrom=0 miTo=1 suFrom=1 suTo=0 result=0
SkOpSegment::markDone id=2 (126,9.39610004 125.632057,9.29584408 125.122734,9.33733845 124.603165,9.37966728) t=0.307190555 [30] (125.624695,9.33975124) tEnd=0.937702598 newWindSum=1 newOppSum=-1 oppSum=-1 windSum=1 windValue=1 oppValue=1
SkOpSegment::markDone id=2 (126,9.39610004 125.632057,9.29584408 125.122734,9.33733845 124.603165,9.37966728) t=0 [3] (126,9.39610004) tEnd=0.307190555 newWindSum=1 newOppSum=-1 oppSum=-1 windSum=1 windValue=1 oppValue=1
SkOpSegment::markDone id=9 (-5.82350016,369.813995 126,9.39620018) t=0.0441765002 [28] (7.26031715e-07,353.891998) tEnd=1 newWindSum=-1 newOppSum=1 oppSum=1 windSum=-1 windValue=1 oppValue=1
SkOpSegment::findNextOp chase.append segment=9 span=28 windSum=-1
SkOpSegment::markDone id=10 (126,9.39620018 125.631981,9.29586983 125.12252,9.3373785 124.602829,9.37972069) t=0.9375 [31] (124.700119,9.37182617) tEnd=1 newWindSum=1 newOppSum=1 oppSum=1 windSum=1 windValue=1 oppValue=0
SkOpSegment::findNextOp from:[10] to:[2] start=-1132576976 end=-1353719496
bridgeOp current id=10 from=(124.602829,9.37972069) to=(124.700119,9.37182617)
path.cubicTo(124.635307,9.37707424, 124.667747,9.37443161, 124.700119,9.37182617);
SkOpSegment::markWinding id=7 (0,259.298737 0,353.891998) t=0 [13] (0,259.298737) tEnd=1 newWindSum=1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
SkOpSegment::markWinding id=9 (-5.82350016,369.813995 126,9.39620018) t=0 [17] (-5.82350016,369.813995) tEnd=0.0441765002 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
SkOpSegment::markWinding id=8 (8.17210007,104.212997 -5.82350016,369.813995) t=0.583904956 [27] (-2.71619996e-07,259.298737) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
SkOpSegment::debugShowActiveSpans id=8 (-2.71619996e-07,259.298737 -5.82350016,369.813995) t=0.583904956 tEnd=1 windSum=-1 oppSum=0 windValue=1 oppValue=0
SkOpSegment::debugShowActiveSpans id=9 (-5.82350016,369.813995 7.26031715e-07,353.891998) t=0 tEnd=0.0441765002 windSum=-1 oppSum=0 windValue=1 oppValue=0
SkOpSegment::debugShowActiveSpans id=7 (0,259.298737 0,353.891998) t=0 tEnd=1 windSum=1 oppSum=0 windValue=1 oppValue=0
SkOpSegment::activeOp id=7 t=1 tEnd=0 op=sect miFrom=1 miTo=0 suFrom=0 suTo=0 result=0
SkOpSegment::markDone id=7 (0,259.298737 0,353.891998) t=0 [13] (0,259.298737) tEnd=1 newWindSum=1 newOppSum=0 oppSum=0 windSum=1 windValue=1 oppValue=0
bridgeOp chase.append id=7 windSum=1
SkOpSegment::debugShowActiveSpans id=8 (-2.71619996e-07,259.298737 -5.82350016,369.813995) t=0.583904956 tEnd=1 windSum=-1 oppSum=0 windValue=1 oppValue=0
SkOpSegment::debugShowActiveSpans id=9 (-5.82350016,369.813995 7.26031715e-07,353.891998) t=0 tEnd=0.0441765002 windSum=-1 oppSum=0 windValue=1 oppValue=0
SkOpSegment::activeOp id=8 t=0.583904956 tEnd=1 op=sect miFrom=0 miTo=0 suFrom=1 suTo=0 result=0
SkOpSegment::markDone id=8 (8.17210007,104.212997 -5.82350016,369.813995) t=0.583904956 [27] (-2.71619996e-07,259.298737) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
SkOpSegment::markDone id=9 (-5.82350016,369.813995 126,9.39620018) t=0 [17] (-5.82350016,369.813995) tEnd=0.0441765002 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
</div>
</div>
<script type="text/javascript">
var testDivs = [
bug8380,
];
var decimal_places = 3; // make this 3 to show more precision
var tests = [];
var testLines = [];
var testTitles = [];
var testIndex = 0;
var ctx;
var xmin, xmax, focusXmin, focusXmax;
var ymin, ymax, focusYmin, focusYmax;
var scale;
var mouseX, mouseY;
var srcLeft, srcTop;
var screenWidth, screenHeight;
var drawnPts, drawnLines, drawnQuads, drawnConics, drawnCubics;
var curveT = 0;
var pt_labels = 2;
var collect_bounds = false;
var control_lines = 0;
var curve_t = false;
var debug_xy = 1;
var focus_enabled = false;
var focus_on_selection = false;
var step_limit = 0;
var draw_active = false;
var draw_add = false;
var draw_angle = 0;
var draw_coincidence = false;
var draw_deriviatives = 0;
var draw_direction = false;
var draw_hints = false;
var draw_id = false;
var draw_intersection = 0;
var draw_intersectT = false;
var draw_legend = true;
var draw_log = false;
var draw_mark = false;
var draw_midpoint = false;
var draw_op = 0;
var draw_sequence = false;
var draw_sort = 0;
var draw_top = false;
var draw_path = 3;
var draw_computed = 0;
var retina_scale = !!window.devicePixelRatio;
var activeCount = 0;
var addCount = 0;
var angleCount = 0;
var coinCount = 0;
var opCount = 0;
var sectCount = 0;
var sortCount = 0;
var topCount = 0;
var markCount = 0;
var activeMax = 0;
var addMax = 0;
var angleMax = 0;
var coinMax = 0;
var sectMax = 0;
var sectMax2 = 0;
var sortMax = 0;
var topMax = 0;
var markMax = 0;
var opMax = 0;
var stepMax = 0;
var lastIndex = 0;
var hasPath = false;
var hasAlignedPath = false;
var hasComputedPath = false;
var angleBetween = false;
var afterIndex = 0;
var firstActiveSpan = -1;
var logStart = -1;
var logRange = 0;
var SPAN_ID = 0;
var SPAN_X1 = SPAN_ID + 1;
var SPAN_Y1 = SPAN_X1 + 1;
var SPAN_X2 = SPAN_Y1 + 1;
var SPAN_Y2 = SPAN_X2 + 1;
var SPAN_L_TX = SPAN_Y2 + 1;
var SPAN_L_TY = SPAN_L_TX + 1;
var SPAN_L_OTHER = SPAN_L_TY + 1;
var SPAN_L_OTHERT = SPAN_L_OTHER + 1;
var SPAN_L_OTHERI = SPAN_L_OTHERT + 1;
var SPAN_L_SUM = SPAN_L_OTHERI + 1;
var SPAN_L_VAL = SPAN_L_SUM + 1;
var SPAN_L_OPP = SPAN_L_VAL + 1;
var SPAN_X3 = SPAN_Y2 + 1;
var SPAN_Y3 = SPAN_X3 + 1;
var SPAN_Q_TX = SPAN_Y3 + 1;
var SPAN_Q_TY = SPAN_Q_TX + 1;
var SPAN_Q_OTHER = SPAN_Q_TY + 1;
var SPAN_Q_OTHERT = SPAN_Q_OTHER + 1;
var SPAN_Q_OTHERI = SPAN_Q_OTHERT + 1;
var SPAN_Q_SUM = SPAN_Q_OTHERI + 1;
var SPAN_Q_VAL = SPAN_Q_SUM + 1;
var SPAN_Q_OPP = SPAN_Q_VAL + 1;
var SPAN_K_W = SPAN_Y3 + 1;
var SPAN_K_TX = SPAN_K_W + 1;
var SPAN_K_TY = SPAN_K_TX + 1;
var SPAN_K_OTHER = SPAN_K_TY + 1;
var SPAN_K_OTHERT = SPAN_K_OTHER + 1;
var SPAN_K_OTHERI = SPAN_K_OTHERT + 1;
var SPAN_K_SUM = SPAN_K_OTHERI + 1;
var SPAN_K_VAL = SPAN_K_SUM + 1;
var SPAN_K_OPP = SPAN_K_VAL + 1;
var SPAN_X4 = SPAN_Y3 + 1;
var SPAN_Y4 = SPAN_X4 + 1;
var SPAN_C_TX = SPAN_Y4 + 1;
var SPAN_C_TY = SPAN_C_TX + 1;
var SPAN_C_OTHER = SPAN_C_TY + 1;
var SPAN_C_OTHERT = SPAN_C_OTHER + 1;
var SPAN_C_OTHERI = SPAN_C_OTHERT + 1;
var SPAN_C_SUM = SPAN_C_OTHERI + 1;
var SPAN_C_VAL = SPAN_C_SUM + 1;
var SPAN_C_OPP = SPAN_C_VAL + 1;
var ACTIVE_LINE_SPAN = 1;
var ACTIVE_QUAD_SPAN = ACTIVE_LINE_SPAN + 1;
var ACTIVE_CONIC_SPAN = ACTIVE_QUAD_SPAN + 1;
var ACTIVE_CUBIC_SPAN = ACTIVE_CONIC_SPAN + 1;
var ADD_MOVETO = ACTIVE_CUBIC_SPAN + 1;
var ADD_LINETO = ADD_MOVETO + 1;
var ADD_QUADTO = ADD_LINETO + 1;
var ADD_CONICTO = ADD_QUADTO + 1;
var ADD_CUBICTO = ADD_CONICTO + 1;
var ADD_CLOSE = ADD_CUBICTO + 1;
var ADD_FILL = ADD_CLOSE + 1;
var PATH_LINE = ADD_FILL + 1;
var PATH_QUAD = PATH_LINE + 1;
var PATH_CONIC = PATH_QUAD + 1;
var PATH_CUBIC = PATH_CONIC + 1;
var INTERSECT_LINE = PATH_CUBIC + 1;
var INTERSECT_LINE_2 = INTERSECT_LINE + 1;
var INTERSECT_LINE_NO = INTERSECT_LINE_2 + 1;
var INTERSECT_QUAD_LINE = INTERSECT_LINE_NO + 1;
var INTERSECT_QUAD_LINE_2 = INTERSECT_QUAD_LINE + 1;
var INTERSECT_QUAD_LINE_NO = INTERSECT_QUAD_LINE_2 + 1;
var INTERSECT_QUAD = INTERSECT_QUAD_LINE_NO + 1;
var INTERSECT_QUAD_2 = INTERSECT_QUAD + 1;
var INTERSECT_QUAD_NO = INTERSECT_QUAD_2 + 1;
var INTERSECT_CONIC_LINE = INTERSECT_QUAD_NO + 1;
var INTERSECT_CONIC_LINE_2 = INTERSECT_CONIC_LINE + 1;
var INTERSECT_CONIC_LINE_NO = INTERSECT_CONIC_LINE_2 + 1;
var INTERSECT_CONIC_QUAD = INTERSECT_CONIC_LINE_NO + 1;
var INTERSECT_CONIC_QUAD_2 = INTERSECT_CONIC_QUAD + 1;
var INTERSECT_CONIC_QUAD_3 = INTERSECT_CONIC_QUAD_2 + 1;
var INTERSECT_CONIC_QUAD_4 = INTERSECT_CONIC_QUAD_3 + 1;
var INTERSECT_CONIC_QUAD_NO = INTERSECT_CONIC_QUAD_4 + 1;
var INTERSECT_CONIC = INTERSECT_CONIC_QUAD_NO + 1;
var INTERSECT_CONIC_2 = INTERSECT_CONIC + 1;
var INTERSECT_CONIC_NO = INTERSECT_CONIC_2 + 1;
var INTERSECT_SELF_CUBIC = INTERSECT_CONIC_NO + 1;
var INTERSECT_SELF_CUBIC_NO = INTERSECT_SELF_CUBIC + 1;
var INTERSECT_CUBIC_LINE = INTERSECT_SELF_CUBIC_NO + 1;
var INTERSECT_CUBIC_LINE_2 = INTERSECT_CUBIC_LINE + 1;
var INTERSECT_CUBIC_LINE_3 = INTERSECT_CUBIC_LINE_2 + 1;
var INTERSECT_CUBIC_LINE_NO = INTERSECT_CUBIC_LINE_3 + 1;
var INTERSECT_CUBIC_QUAD = INTERSECT_CUBIC_LINE_NO + 1;
var INTERSECT_CUBIC_QUAD_2 = INTERSECT_CUBIC_QUAD + 1;
var INTERSECT_CUBIC_QUAD_3 = INTERSECT_CUBIC_QUAD_2 + 1;
var INTERSECT_CUBIC_QUAD_4 = INTERSECT_CUBIC_QUAD_3 + 1;
var INTERSECT_CUBIC_QUAD_NO = INTERSECT_CUBIC_QUAD_4 + 1;
var INTERSECT_CUBIC = INTERSECT_CUBIC_QUAD_NO + 1;
var INTERSECT_CUBIC_2 = INTERSECT_CUBIC + 1;
var INTERSECT_CUBIC_3 = INTERSECT_CUBIC_2 + 1;
var INTERSECT_CUBIC_4 = INTERSECT_CUBIC_3 + 1;
// FIXME: add cubic 5- 9
var INTERSECT_CUBIC_NO = INTERSECT_CUBIC_4 + 1;
var SORT_UNARY = INTERSECT_CUBIC_NO + 1;
var SORT_BINARY = SORT_UNARY + 1;
var OP_DIFFERENCE = SORT_BINARY + 1;
var OP_INTERSECT = OP_DIFFERENCE + 1;
var OP_UNION = OP_INTERSECT + 1;
var OP_XOR = OP_UNION + 1;
var MARK_LINE = OP_XOR + 1;
var MARK_QUAD = MARK_LINE + 1;
var MARK_CONIC = MARK_QUAD + 1;
var MARK_CUBIC = MARK_CONIC + 1;
var MARK_DONE_LINE = MARK_CUBIC + 1;
var MARK_DONE_QUAD = MARK_DONE_LINE + 1;
var MARK_DONE_CONIC = MARK_DONE_QUAD + 1;
var MARK_DONE_CUBIC = MARK_DONE_CONIC + 1;
var MARK_UNSORTABLE_LINE = MARK_DONE_CUBIC + 1;
var MARK_UNSORTABLE_QUAD = MARK_UNSORTABLE_LINE + 1;
var MARK_UNSORTABLE_CONIC = MARK_UNSORTABLE_QUAD + 1;
var MARK_UNSORTABLE_CUBIC = MARK_UNSORTABLE_CONIC + 1;
var MARK_SIMPLE_LINE = MARK_UNSORTABLE_CUBIC + 1;
var MARK_SIMPLE_QUAD = MARK_SIMPLE_LINE + 1;
var MARK_SIMPLE_CONIC = MARK_SIMPLE_QUAD + 1;
var MARK_SIMPLE_CUBIC = MARK_SIMPLE_CONIC + 1;
var MARK_SIMPLE_DONE_LINE = MARK_SIMPLE_CUBIC + 1;
var MARK_SIMPLE_DONE_QUAD = MARK_SIMPLE_DONE_LINE + 1;
var MARK_SIMPLE_DONE_CONIC = MARK_SIMPLE_DONE_QUAD + 1;
var MARK_SIMPLE_DONE_CUBIC = MARK_SIMPLE_DONE_CONIC + 1;
var MARK_DONE_UNARY_LINE = MARK_SIMPLE_DONE_CUBIC + 1;
var MARK_DONE_UNARY_QUAD = MARK_DONE_UNARY_LINE + 1;
var MARK_DONE_UNARY_CONIC = MARK_DONE_UNARY_QUAD + 1;
var MARK_DONE_UNARY_CUBIC = MARK_DONE_UNARY_CONIC + 1;
var MARK_ANGLE_LAST = MARK_DONE_UNARY_CUBIC + 1;
var COMPUTED_SET_1 = MARK_ANGLE_LAST + 1;
var COMPUTED_SET_2 = COMPUTED_SET_1 + 1;
var ANGLE_AFTER = COMPUTED_SET_2 + 1;
var ANGLE_AFTERPART = ANGLE_AFTER + 1;
var ACTIVE_OP = ANGLE_AFTERPART + 1;
var COIN_MAIN_SPAN = ACTIVE_OP + 1;
var COIN_OPP_SPAN = COIN_MAIN_SPAN + 1;
var FRAG_TYPE_LAST = COIN_OPP_SPAN;
var REC_TYPE_UNKNOWN = -1;
var REC_TYPE_PATH = 0;
var REC_TYPE_PATH2 = 1;
var REC_TYPE_SECT = 2;
var REC_TYPE_ACTIVE = 3;
var REC_TYPE_ADD = 4;
var REC_TYPE_SORT = 5;
var REC_TYPE_OP = 6;
var REC_TYPE_MARK = 7;
var REC_TYPE_COMPUTED = 8;
var REC_TYPE_COIN = 9;
var REC_TYPE_ANGLE = 10;
var REC_TYPE_ACTIVE_OP = 11;
var REC_TYPE_AFTERPART = 12;
var REC_TYPE_TOP = 13;
var REC_TYPE_COINCIDENCE = 14;
var REC_TYPE_ALIGNED = 15;
var REC_TYPE_LAST = REC_TYPE_ALIGNED;
function strs_to_nums(strs) {
var result = [];
for (var idx = 1; idx < strs.length; ++idx) {
var str = strs[idx];
var num = parseFloat(str);
if (isNaN(num)) {
result.push(str);
} else {
result.push(num);
}
}
return result;
}
function filter_str_by(id, str, regex, array) {
if (regex.test(str)) {
var strs = regex.exec(str);
var result = strs_to_nums(strs);
array.push(id);
array.push(result);
return true;
}
return false;
}
function construct_regexp2(pattern) {
var escape = pattern.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
escape = escape.replace(/UNSORTABLE/g, "\\*\\*\\* UNSORTABLE \\*\\*\\*");
escape = escape.replace(/CUBIC_VAL/g, "\\(P_VAL P_VAL P_VAL P_VAL\\)");
escape = escape.replace(/CONIC_VAL/g, "\\(P_VAL P_VAL P_VAL W_VAL\\)");
escape = escape.replace(/QUAD_VAL/g, "\\(P_VAL P_VAL P_VAL\\)");
escape = escape.replace(/LINE_VAL/g, "\\(P_VAL P_VAL\\)");
escape = escape.replace(/FILL_TYPE/g, "SkPath::k[a-zA-Z]+_FillType");
escape = escape.replace(/PTR_VAL/g, "0x[0-9A-F]+");
escape = escape.replace(/PT_VAL/g, "\\(P_VAL\\)");
escape = escape.replace(/P_VAL/g, "(-?\\d+\\.?\\d*(?:e[+-]?\\d+)?)[Ff]?, ?(-?\\d+\\.?\\d*(?:e[+-]?\\d+)?)[Ff]?");
escape = escape.replace(/T_VAL/g, "(-?\\d+\\.?\\d*(?:e[+-]?\\d+)?)");
escape = escape.replace(/W_VAL/g, "(-?\\d+\\.?\\d*(?:e[+-]?\\d+)?)[Ff]?");
escape = escape.replace(/PATH/g, "pathB?");
escape = escape.replace(/IDX/g, "(-?\\d+)");
escape = escape.replace(/NUM/g, "(-?\\d+)");
escape = escape.replace(/OPT/g, "(\\?|-?\\d+)");
return new RegExp(escape, 'i');
}
function construct_regexp2c(pattern) {
var escape = pattern.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
escape = escape.replace(/UNSORTABLE/g, "\\*\\*\\* UNSORTABLE \\*\\*\\*");
escape = escape.replace(/CUBIC_VAL/g, "(?:\\$\\d = )?\\{\\{\\{P_VAL\\}, \\{P_VAL\\}, \\{P_VAL\\}, \\{P_VAL\\}\\}\\}");
escape = escape.replace(/CONIC_VAL/g, "(?:\\$\\d = )?\\{\\{\\{\\{P_VAL\\}, \\{P_VAL\\}, \\{P_VAL\\}\\}\\}, W_VAL\\}");
escape = escape.replace(/QUAD_VAL/g, "(?:\\$\\d = )?\\{\\{\\{P_VAL\\}, \\{P_VAL\\}, \\{P_VAL\\}\\}\\}");
escape = escape.replace(/LINE_VAL/g, "(?:\\$\\d = )?\\{\\{\\{P_VAL\\}, \\{P_VAL\\}\\}\\}");
escape = escape.replace(/FILL_TYPE/g, "SkPath::k[a-zA-Z]+_FillType");
escape = escape.replace(/PTR_VAL/g, "0x[0-9A-F]+");
escape = escape.replace(/PT_VAL/g, "\\{\\{P_VAL\\}\\}");
escape = escape.replace(/P_VAL/g, "(?:f?[xX] = )?(-?\\d+\\.?\\d*(?:e[+-]?\\d+)?)[Ff]?, *(?: f?[yY] = )?(-?\\d+\\.?\\d*(?:e[+-]?\\d+)?)[Ff]?");
escape = escape.replace(/T_VAL/g, "(-?\\d+\\.?\\d*(?:e[+-]?\\d+)?)");
escape = escape.replace(/W_VAL/g, "(-?\\d+\\.?\\d*(?:e[+-]?\\d+)?)[Ff]?");
escape = escape.replace(/OPER/g, "[a-z]+");
escape = escape.replace(/PATH/g, "pathB?");
escape = escape.replace(/T_F/g, "([TF])");
escape = escape.replace(/IDX/g, "(-?\\d+)");
escape = escape.replace(/NUM/g, "(-?\\d+)");
escape = escape.replace(/OPT/g, "(\\?|-?\\d+)");
return new RegExp(escape, 'i');
}
function match_regexp(str, lineNo, array, id, pattern) {
var regex = construct_regexp2(pattern);
if (filter_str_by(id, str, regex, array)) {
return true;
}
regex = construct_regexp2c(pattern);
return filter_str_by(id, str, regex, array);
}
function endsWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
function parse_all(test) {
var lines = test.match(/[^\r\n]+/g);
var records = []; // a rec can be the original paths, a set of intersections, a set of active spans, a sort, or a path add
var record = [];
var recType = REC_TYPE_UNKNOWN;
var lastLineNo;
var moveX, moveY;
for (var lineNo = 0; lineNo < lines.length; ++lineNo) {
var line = lines[lineNo];
if (line.length == 0) {
continue;
}
var opStart = "SkOpSegment::";
if (line.lastIndexOf(opStart, 0) === 0) {
line = line.substr(opStart.length);
}
var angleStart = "SkOpAngle::";
if (line.lastIndexOf(angleStart, 0) === 0) {
line = line.substr(angleStart.length);
}
var coinStart = "SkOpCoincidence::";
if (line.lastIndexOf(coinStart, 0) === 0) {
line = line.substr(coinStart.length);
}
var type = line.lastIndexOf("debugShowActiveSpans", 0) === 0 ? REC_TYPE_ACTIVE
: line.lastIndexOf("debugShowCoincidence", 0) === 0 ? REC_TYPE_COINCIDENCE
: line.lastIndexOf("((SkOpSegment*)", 0) === 0 ? REC_TYPE_PATH2
: line.lastIndexOf("debugShowTs", 0) === 0 ? REC_TYPE_COIN
: line.lastIndexOf("afterPart", 0) === 0 ? REC_TYPE_AFTERPART
: line.lastIndexOf("debugShow", 0) === 0 ? REC_TYPE_SECT
: line.lastIndexOf("activeOp", 0) === 0 ? REC_TYPE_ACTIVE_OP
: line.lastIndexOf("computed", 0) === 0 ? REC_TYPE_COMPUTED
: line.lastIndexOf("debugOne", 0) === 0 ? REC_TYPE_SORT
: line.lastIndexOf("aligned=", 0) === 0 ? REC_TYPE_ALIGNED
: line.lastIndexOf("dumpOne", 0) === 0 ? REC_TYPE_SORT
: line.lastIndexOf("findTop", 0) === 0 ? REC_TYPE_TOP
: line.lastIndexOf("pathB.", 0) === 0 ? REC_TYPE_ADD
: line.lastIndexOf("path.", 0) === 0 ? REC_TYPE_ADD
: line.lastIndexOf("after", 0) === 0 ? REC_TYPE_ANGLE
: line.lastIndexOf("mark", 0) === 0 ? REC_TYPE_MARK
: line.lastIndexOf(" {{", 0) === 0 ? REC_TYPE_COMPUTED
: line.lastIndexOf("seg=", 0) === 0 ? REC_TYPE_PATH
: line.lastIndexOf("op", 0) === 0 ? REC_TYPE_OP
: line.lastIndexOf("$", 0) === 0 ? REC_TYPE_PATH
: REC_TYPE_UNKNOWN;
if (recType != type || recType == REC_TYPE_ADD || recType == REC_TYPE_SECT
|| recType == REC_TYPE_ACTIVE_OP || recType == REC_TYPE_ANGLE) {
if (recType != REC_TYPE_UNKNOWN) {
records.push(recType);
records.push(lastLineNo);
records.push(record);
}
record = [];
recType = type;
lastLineNo = lineNo;
}
var found = false;
switch (recType) {
case REC_TYPE_ACTIVE:
found = match_regexp(line, lineNo, record, ACTIVE_LINE_SPAN, "debugShowActiveSpans" +
" id=IDX LINE_VAL t=T_VAL tEnd=T_VAL windSum=OPT windValue=IDX"
) || match_regexp(line, lineNo, record, ACTIVE_QUAD_SPAN, "debugShowActiveSpans" +
" id=IDX QUAD_VAL t=T_VAL tEnd=T_VAL windSum=OPT windValue=IDX"
) || match_regexp(line, lineNo, record, ACTIVE_CONIC_SPAN, "debugShowActiveSpans" +
" id=IDX CONIC_VAL t=T_VAL tEnd=T_VAL windSum=OPT windValue=IDX"
) || match_regexp(line, lineNo, record, ACTIVE_CUBIC_SPAN, "debugShowActiveSpans" +
" id=IDX CUBIC_VAL t=T_VAL tEnd=T_VAL windSum=OPT windValue=IDX"
) || match_regexp(line, lineNo, record, ACTIVE_LINE_SPAN, "debugShowActiveSpans" +
" id=IDX LINE_VAL t=T_VAL tEnd=T_VAL windSum=OPT oppSum=OPT windValue=IDX oppValue=NUM"
) || match_regexp(line, lineNo, record, ACTIVE_QUAD_SPAN, "debugShowActiveSpans" +
" id=IDX QUAD_VAL t=T_VAL tEnd=T_VAL windSum=OPT oppSum=OPT windValue=IDX oppValue=NUM"
) || match_regexp(line, lineNo, record, ACTIVE_CONIC_SPAN, "debugShowActiveSpans" +
" id=IDX CONIC_VAL t=T_VAL tEnd=T_VAL windSum=OPT oppSum=OPT windValue=IDX oppValue=NUM"
) || match_regexp(line, lineNo, record, ACTIVE_CUBIC_SPAN, "debugShowActiveSpans" +
" id=IDX CUBIC_VAL t=T_VAL tEnd=T_VAL windSum=OPT oppSum=OPT windValue=IDX oppValue=NUM"
);
break;
case REC_TYPE_ACTIVE_OP:
found = match_regexp(line, lineNo, record, ACTIVE_OP, "activeOp" +
" id=IDX t=T_VAL tEnd=T_VAL op=OPER miFrom=NUM miTo=NUM suFrom=NUM suTo=NUM result=IDX"
);
break;
case REC_TYPE_ADD:
if (match_regexp(line, lineNo, record, ADD_MOVETO, "PATH.moveTo(P_VAL);")) {
moveX = record[1][0];
moveY = record[1][1];
found = true;
} else if (match_regexp(line, lineNo, record, ADD_LINETO, "PATH.lineTo(P_VAL);")) {
record[1].unshift(moveY);
record[1].unshift(moveX);
moveX = record[1][2];
moveY = record[1][3];
found = true;
} else if (match_regexp(line, lineNo, record, ADD_QUADTO, "PATH.quadTo(P_VAL, P_VAL);")) {
record[1].unshift(moveY);
record[1].unshift(moveX);
moveX = record[1][4];
moveY = record[1][5];
found = true;
} else if (match_regexp(line, lineNo, record, ADD_CONICTO, "PATH.conicTo(P_VAL, P_VAL, T_VAL);")) {
record[1].unshift(moveY);
record[1].unshift(moveX);
moveX = record[1][4];
moveY = record[1][5];
found = true;
} else if (match_regexp(line, lineNo, record, ADD_CUBICTO, "PATH.cubicTo(P_VAL, P_VAL, P_VAL);")) {
record[1].unshift(moveY);
record[1].unshift(moveX);
moveX = record[1][6];
moveY = record[1][7];
found = true;
} else if (match_regexp(line, lineNo, record, ADD_FILL, "PATH.setFillType(FILL_TYPE);")) {
found = true;
} else {
found = match_regexp(line, lineNo, record, ADD_CLOSE, "PATH.close();");
}
break;
case REC_TYPE_AFTERPART:
found = match_regexp(line, lineNo, record, PATH_LINE, "afterPart LINE_VAL id=IDX")
|| match_regexp(line, lineNo, record, PATH_QUAD, "afterPart QUAD_VAL id=IDX")
|| match_regexp(line, lineNo, record, PATH_CONIC, "afterPart CONIC_VAL id=IDX")
|| match_regexp(line, lineNo, record, PATH_CUBIC, "afterPart CUBIC_VAL id=IDX")
break;
case REC_TYPE_ALIGNED:
found = match_regexp(line, lineNo, record, PATH_LINE, "aligned=IDX LINE_VAL"
) || match_regexp(line, lineNo, record, PATH_QUAD, "aligned=IDX QUAD_VAL"
) || match_regexp(line, lineNo, record, PATH_CONIC, "aligned=IDX CONIC_VAL"
) || match_regexp(line, lineNo, record, PATH_CUBIC, "aligned=IDX CUBIC_VAL"
);
break;
case REC_TYPE_ANGLE:
found = match_regexp(line, lineNo, record, ANGLE_AFTER, "after " +
"[IDX/IDX] NUM/NUM tStart=T_VAL tEnd=T_VAL < [IDX/IDX] NUM/NUM tStart=T_VAL tEnd=T_VAL < [IDX/IDX] NUM/NUM tStart=T_VAL tEnd=T_VAL T_F IDX");
break;
case REC_TYPE_COIN:
found = true;
break;
case REC_TYPE_COINCIDENCE:
found = match_regexp(line, lineNo, record, COIN_MAIN_SPAN, "debugShowCoincidence" +
" + id=IDX t=T_VAL tEnd=T_VAL"
) || match_regexp(line, lineNo, record, COIN_OPP_SPAN, "debugShowCoincidence" +
" - id=IDX t=T_VAL tEnd=T_VAL"
);
break;
case REC_TYPE_COMPUTED:
found = line == "computed quadratics given"
|| match_regexp(line, lineNo, record, COMPUTED_SET_1, "computed quadratics set 1"
) || match_regexp(line, lineNo, record, COMPUTED_SET_2, "computed quadratics set 2"
) || match_regexp(line, lineNo, record, PATH_QUAD, " QUAD_VAL,"
) || match_regexp(line, lineNo, record, PATH_CONIC, " CONIC_VAL,"
) || match_regexp(line, lineNo, record, PATH_CUBIC, " CUBIC_VAL,"
);
break;
case REC_TYPE_PATH:
found = match_regexp(line, lineNo, record, PATH_LINE, "seg=IDX LINE_VAL"
) || match_regexp(line, lineNo, record, PATH_QUAD, "seg=IDX QUAD_VAL"
) || match_regexp(line, lineNo, record, PATH_CONIC, "seg=IDX CONIC_VAL"
) || match_regexp(line, lineNo, record, PATH_CUBIC, "seg=IDX CUBIC_VAL"
);
break;
case REC_TYPE_PATH2:
found = match_regexp(line, lineNo, record, PATH_LINE, "((SkOpSegment*) PTR_VAL) [IDX] {LINE_VAL}"
) || match_regexp(line, lineNo, record, PATH_QUAD, "((SkOpSegment*) PTR_VAL) [IDX] {QUAD_VAL}"
) || match_regexp(line, lineNo, record, PATH_CONIC, "((SkOpSegment*) PTR_VAL) [IDX] {CONIC_VAL}"
) || match_regexp(line, lineNo, record, PATH_CUBIC, "((SkOpSegment*) PTR_VAL) [IDX] {CUBIC_VAL}"
);
break;
case REC_TYPE_SECT:
found = match_regexp(line, lineNo, record, INTERSECT_LINE, "debugShowLineIntersection" +
" wtTs[0]=T_VAL LINE_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_LINE_2, "debugShowLineIntersection" +
" wtTs[0]=T_VAL LINE_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL wnTs[1]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_LINE_NO, "debugShowLineIntersection" +
" no intersect LINE_VAL LINE_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_QUAD_LINE, "debugShowQuadLineIntersection" +
" wtTs[0]=T_VAL QUAD_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_QUAD_LINE_2, "debugShowQuadLineIntersection" +
" wtTs[0]=T_VAL QUAD_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL wnTs[1]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_QUAD_LINE_NO, "debugShowQuadLineIntersection" +
" no intersect QUAD_VAL LINE_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_QUAD, "debugShowQuadIntersection" +
" wtTs[0]=T_VAL QUAD_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_QUAD_2, "debugShowQuadIntersection" +
" wtTs[0]=T_VAL QUAD_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL wnTs[1]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_QUAD_NO, "debugShowQuadIntersection" +
" no intersect QUAD_VAL QUAD_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CONIC_LINE, "debugShowConicLineIntersection" +
" wtTs[0]=T_VAL CONIC_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CONIC_LINE_2, "debugShowConicLineIntersection" +
" wtTs[0]=T_VAL CONIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL wnTs[1]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CONIC_LINE_NO, "debugShowConicLineIntersection" +
" no intersect CONIC_VAL LINE_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CONIC_QUAD, "debugShowConicQuadIntersection" +
" wtTs[0]=T_VAL CONIC_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CONIC_QUAD_2, "debugShowConicQuadIntersection" +
" wtTs[0]=T_VAL CONIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL wnTs[1]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CONIC_QUAD_3, "debugShowConicQuadIntersection" +
" wtTs[0]=T_VAL CONIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wtTs[2]=T_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL wnTs[1]=T_VAL wnTs[2]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CONIC_QUAD_4, "debugShowConicQuadIntersection" +
" wtTs[0]=T_VAL CONIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wtTs[2]=T_VAL PT_VAL wtTs[3]=T_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL wnTs[1]=T_VAL wnTs[2]=T_VAL wnTs[3]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CONIC_QUAD_NO, "debugShowConicQuadIntersection" +
" no intersect CONIC_VAL QUAD_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CONIC, "debugShowConicIntersection" +
" wtTs[0]=T_VAL CONIC_VAL PT_VAL wnTs[0]=T_VAL CONIC_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CONIC_2, "debugShowConicIntersection" +
" wtTs[0]=T_VAL CONIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL CONIC_VAL wnTs[1]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CONIC_NO, "debugShowConicIntersection" +
" no intersect CONIC_VAL CONIC_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_LINE, "debugShowCubicLineIntersection" +
" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_LINE_2, "debugShowCubicLineIntersection" +
" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL wnTs[1]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_LINE_3, "debugShowCubicLineIntersection" +
" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wtTs[2]=T_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL wnTs[1]=T_VAL wnTs[2]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_LINE_NO, "debugShowCubicLineIntersection" +
" no intersect CUBIC_VAL LINE_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD, "debugShowCubicQuadIntersection" +
" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD_2, "debugShowCubicQuadIntersection" +
" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL wnTs[1]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD_3, "debugShowCubicQuadIntersection" +
" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wtTs[2]=T_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL wnTs[1]=T_VAL wnTs[2]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD_4, "debugShowCubicQuadIntersection" +
" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wtTs[2]=T_VAL wtTs[3]=T_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL wnTs[1]=T_VAL wnTs[2]=T_VAL wnTs[3]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD_NO, "debugShowCubicQuadIntersection" +
" no intersect CUBIC_VAL QUAD_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CUBIC, "debugShowCubicIntersection" +
" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wnTs[0]=T_VAL CUBIC_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_2, "debugShowCubicIntersection" +
" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL CUBIC_VAL wnTs[1]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_3, "debugShowCubicIntersection" +
" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wtTs[2]=T_VAL PT_VAL wnTs[0]=T_VAL CUBIC_VAL wnTs[1]=T_VAL wnTs[2]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_4, "debugShowCubicIntersection" +
" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wtTs[2]=T_VAL PT_VAL wtTs[3]=T_VAL PT_VAL wnTs[0]=T_VAL CUBIC_VAL wnTs[1]=T_VAL wnTs[2]=T_VAL wnTs[3]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_NO, "debugShowCubicIntersection" +
" no intersect CUBIC_VAL CUBIC_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_SELF_CUBIC, "debugShowCubicIntersection" +
" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL"
) || match_regexp(line, lineNo, record, INTERSECT_SELF_CUBIC_NO, "debugShowCubicIntersection" +
" no self intersect CUBIC_VAL"
);
break;
case REC_TYPE_SORT:
var hasDone = / done/.test(line);
var hasUnorderable = / unorderable/.test(line);
var hasSmall = / small/.test(line);
var hasTiny = / tiny/.test(line);
var hasOperand = / operand/.test(line);
var hasStop = / stop/.test(line);
line.replace(/[ a-z]+$/, "");
found = match_regexp(line, lineNo, record, SORT_UNARY, "debugOne" +
" [IDX/IDX] next=IDX/IDX sect=IDX/IDX s=T_VAL [IDX] e=T_VAL [IDX] sgn=NUM windVal=IDX windSum=OPT"
) || match_regexp(line, lineNo, record, SORT_BINARY, "debugOne" +
" [IDX/IDX] next=IDX/IDX sect=IDX/IDX s=T_VAL [IDX] e=T_VAL [IDX] sgn=NUM windVal=IDX windSum=OPT oppVal=IDX oppSum=OPT"
) || match_regexp(line, lineNo, record, SORT_UNARY, "dumpOne" +
" [IDX/IDX] next=IDX/IDX sect=NUM/NUM s=T_VAL [IDX] e=T_VAL [IDX] sgn=NUM windVal=IDX windSum=OPT"
) || match_regexp(line, lineNo, record, SORT_BINARY, "dumpOne" +
" [IDX/IDX] next=IDX/IDX sect=NUM/NUM s=T_VAL [IDX] e=T_VAL [IDX] sgn=NUM windVal=IDX windSum=OPT oppVal=IDX oppSum=OPT"
);
if (found) {
record[1].push(hasDone);
record[1].push(hasUnorderable);
record[1].push(hasSmall);
record[1].push(hasTiny);
record[1].push(hasOperand);
record[1].push(hasStop);
}
break;
case REC_TYPE_TOP:
found = match_regexp(line, lineNo, record, ACTIVE_OP, "findTop" +
" id=IDX s=T_VAL e=T_VAL cw=NUM swap=NUM inflections=NUM monotonic=NUM"
) || match_regexp(line, lineNo, record, ACTIVE_OP, "findTop" +
" id=IDX s=T_VAL e=T_VAL (-) cw=NUM swap=NUM inflections=NUM monotonic=NUM"
) || match_regexp(line, lineNo, record, ACTIVE_OP, "findTop" +
" id=IDX s=T_VAL e=T_VAL (+) cw=NUM swap=NUM inflections=NUM monotonic=NUM"
);
break;
case REC_TYPE_MARK:
found = match_regexp(line, lineNo, record, MARK_LINE, "markWinding" +
" id=IDX LINE_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM newOppSum=OPT oppSum=OPT windSum=OPT windValue=IDX"
) || match_regexp(line, lineNo, record, MARK_QUAD, "markWinding" +
" id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM newOppSum=OPT oppSum=OPT windSum=OPT windValue=IDX"
) || match_regexp(line, lineNo, record, MARK_CONIC, "markWinding" +
" id=IDX CONIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM newOppSum=OPT oppSum=OPT windSum=OPT windValue=IDX"
) || match_regexp(line, lineNo, record, MARK_CUBIC, "markWinding" +
" id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM newOppSum=OPT oppSum=OPT windSum=OPT windValue=IDX"
) || match_regexp(line, lineNo, record, MARK_DONE_LINE, "markDone" +
" id=IDX LINE_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=OPT newOppSum=OPT oppSum=OPT windSum=OPT windValue=IDX oppValue=OPT"
) || match_regexp(line, lineNo, record, MARK_DONE_QUAD, "markDone" +
" id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=OPT newOppSum=OPT oppSum=OPT windSum=OPT windValue=IDX oppValue=OPT"
) || match_regexp(line, lineNo, record, MARK_DONE_CONIC, "markDone" +
" id=IDX CONIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=OPT newOppSum=OPT oppSum=OPT windSum=OPT windValue=IDX oppValue=OPT"
) || match_regexp(line, lineNo, record, MARK_DONE_CUBIC, "markDone" +
" id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=OPT newOppSum=OPT oppSum=OPT windSum=OPT windValue=IDX oppValue=OPT"
) || match_regexp(line, lineNo, record, MARK_SIMPLE_LINE, "markWinding" +
" id=IDX LINE_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX"
) || match_regexp(line, lineNo, record, MARK_SIMPLE_QUAD, "markWinding" +
" id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX"
) || match_regexp(line, lineNo, record, MARK_SIMPLE_CONIC, "markWinding" +
" id=IDX CONIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX"
) || match_regexp(line, lineNo, record, MARK_SIMPLE_CUBIC, "markWinding" +
" id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX"
) || match_regexp(line, lineNo, record, MARK_ANGLE_LAST, "markAngle" +
" last segment=IDX span=IDX"
) || match_regexp(line, lineNo, record, MARK_ANGLE_LAST, "markAngle" +
" last seg=IDX span=IDX"
) || match_regexp(line, lineNo, record, MARK_ANGLE_LAST, "markAngle" +
" last segment=IDX span=IDX windSum=OPT"
) || match_regexp(line, lineNo, record, MARK_ANGLE_LAST, "markAngle" +
" last seg=IDX span=IDX windSum=OPT"
);
break;
case REC_TYPE_OP:
if (line.lastIndexOf("oppSign oppSign=", 0) === 0
|| line.lastIndexOf("operator<", 0) === 0) {
found = true;
break;
}
found = match_regexp(line, lineNo, record, OP_DIFFERENCE, "op diff"
) || match_regexp(line, lineNo, record, OP_INTERSECT, "op intersect"
) || match_regexp(line, lineNo, record, OP_INTERSECT, "op sect"
) || match_regexp(line, lineNo, record, OP_UNION, "op union"
) || match_regexp(line, lineNo, record, OP_XOR, "op xor"
);
break;
case REC_TYPE_UNKNOWN:
found = true;
break;
}
if (!found) {
console.log(line + " [" + lineNo + "] of type " + type + " not found");
}
}
if (recType != REC_TYPE_UNKNOWN) {
records.push(recType);
records.push(lastLineNo);
records.push(record);
}
if (records.length >= 1) {
tests[testIndex] = records;
testLines[testIndex] = lines;
}
}
function init(test) {
var canvas = document.getElementById('canvas');
if (!canvas.getContext) return;
ctx = canvas.getContext('2d');
var resScale = retina_scale && window.devicePixelRatio ? window.devicePixelRatio : 1;
var unscaledWidth = window.innerWidth - 20;
var unscaledHeight = window.innerHeight - 20;
screenWidth = unscaledWidth;
screenHeight = unscaledHeight;
canvas.width = unscaledWidth * resScale;
canvas.height = unscaledHeight * resScale;
canvas.style.width = unscaledWidth + 'px';
canvas.style.height = unscaledHeight + 'px';
if (resScale != 1) {
ctx.scale(resScale, resScale);
}
xmin = Infinity;
xmax = -Infinity;
ymin = Infinity;
ymax = -Infinity;
hasPath = hasAlignedPath = hasComputedPath = false;
firstActiveSpan = -1;
for (var tIndex = 0; tIndex < test.length; tIndex += 3) {
var recType = test[tIndex];
if (!typeof recType == 'number' || recType < REC_TYPE_UNKNOWN || recType > REC_TYPE_LAST) {
console.log("unknown rec type: " + recType);
throw "stop execution";
}
var records = test[tIndex + 2];
for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2) {
var fragType = records[recordIndex];
if (!typeof fragType == 'number' || fragType < 1 || fragType > FRAG_TYPE_LAST) {
console.log("unknown in range frag type: " + fragType);
throw "stop execution";
}
var frags = records[recordIndex + 1];
var first = 0;
var last = -1;
var first2 = 0;
var last2 = 0;
switch (recType) {
case REC_TYPE_ALIGNED:
hasAlignedPath = true;
case REC_TYPE_COMPUTED:
if (fragType == COMPUTED_SET_1 || fragType == COMPUTED_SET_2) {
break;
}
if (REC_TYPE_COMPUTED == recType) {
hasComputedPath = true;
}
case REC_TYPE_PATH:
first = 1;
switch (fragType) {
case PATH_LINE:
last = 5;
break;
case PATH_CONIC:
case PATH_QUAD:
last = 7;
break;
case PATH_CUBIC:
last = 9;
break;
default:
console.log("unknown " + (recType == REC_TYPE_PATH ? "REC_TYPE_PATH"
: "REC_TYPE_COMPUTED") + " frag type:" + fragType);
throw "stop execution";
}
if (recType == REC_TYPE_PATH) {
hasPath = true;
}
break;
case REC_TYPE_PATH2:
first = 1;
switch (fragType) {
case PATH_LINE:
last = 5;
break;
case PATH_CONIC:
case PATH_QUAD:
last = 7;
break;
case PATH_CUBIC:
last = 9;
break;
default:
console.log("unknown " + (recType == REC_TYPE_PATH2 ? "REC_TYPE_PATH2"
: "REC_TYPE_COMPUTED") + " frag type:" + fragType);
throw "stop execution";
}
if (recType == REC_TYPE_PATH2) {
hasPath = true;
}
break;
case REC_TYPE_ACTIVE:
if (firstActiveSpan < 0) {
firstActiveSpan = tIndex;
}
first = 1;
switch (fragType) {
case ACTIVE_LINE_SPAN:
last = 5;
break;
case ACTIVE_CONIC_SPAN:
case ACTIVE_QUAD_SPAN:
last = 7;
break;
case ACTIVE_CUBIC_SPAN:
last = 9;
break;
default:
console.log("unknown REC_TYPE_ACTIVE frag type: " + fragType);
throw "stop execution";
}
break;
case REC_TYPE_ADD:
switch (fragType) {
case ADD_MOVETO:
break;
case ADD_LINETO:
last = 4;
break;
case ADD_CONICTO:
case ADD_QUADTO:
last = 6;
break;
case ADD_CUBICTO:
last = 8;
break;
case ADD_CLOSE:
case ADD_FILL:
break;
default:
console.log("unknown REC_TYPE_ADD frag type: " + fragType);
throw "stop execution";
}
break;
case REC_TYPE_AFTERPART:
switch (fragType) {
case PATH_LINE:
last = 4;
break;
case PATH_CONIC:
case PATH_QUAD:
last = 6;
break;
case PATH_CUBIC:
last = 8;
break;
default:
console.log("unknown REC_TYPE_ACTIVEPART frag type: " + fragType);
throw "stop execution";
}
break;
case REC_TYPE_SECT:
switch (fragType) {
case INTERSECT_LINE:
first = 1; last = 5; first2 = 8; last2 = 12;
break;
case INTERSECT_LINE_2:
first = 1; last = 5; first2 = 11; last2 = 15;
break;
case INTERSECT_LINE_NO:
first = 0; last = 4; first2 = 4; last2 = 8;
break;
case INTERSECT_CONIC_LINE:
first = 1; last = 7; first2 = 11; last2 = 15;
break;
case INTERSECT_QUAD_LINE:
first = 1; last = 7; first2 = 10; last2 = 14;
break;
case INTERSECT_CONIC_LINE_2:
first = 1; last = 7; first2 = 14; last2 = 18;
break;
case INTERSECT_QUAD_LINE_2:
first = 1; last = 7; first2 = 13; last2 = 17;
break;
case INTERSECT_CONIC_LINE_NO:
first = 0; last = 6; first2 = 7; last2 = 11;
break;
case INTERSECT_QUAD_LINE_NO:
first = 0; last = 6; first2 = 6; last2 = 10;
break;
case INTERSECT_CONIC:
first = 1; last = 7; first2 = 11; last2 = 17;
break;
case INTERSECT_QUAD:
first = 1; last = 7; first2 = 10; last2 = 16;
break;
case INTERSECT_CONIC_2:
first = 1; last = 7; first2 = 14; last2 = 20;
break;
case INTERSECT_QUAD_2:
first = 1; last = 7; first2 = 13; last2 = 19;
break;
case INTERSECT_CONIC_NO:
first = 0; last = 6; first2 = 7; last2 = 13;
break;
case INTERSECT_QUAD_NO:
first = 0; last = 6; first2 = 6; last2 = 12;
break;
case INTERSECT_SELF_CUBIC:
first = 1; last = 9;
break;
case INTERSECT_SELF_CUBIC_NO:
first = 0; last = 8;
break;
case INTERSECT_CUBIC_LINE:
first = 1; last = 9; first2 = 12; last2 = 16;
break;
case INTERSECT_CUBIC_LINE_2:
first = 1; last = 9; first2 = 15; last2 = 19;
break;
case INTERSECT_CUBIC_LINE_3:
first = 1; last = 9; first2 = 18; last2 = 22;
break;
case INTERSECT_CUBIC_LINE_NO:
first = 0; last = 8; first2 = 8; last2 = 12;
break;
case INTERSECT_CONIC_QUAD:
first = 1; last = 7; first2 = 11; last2 = 17;
break;
case INTERSECT_CONIC_QUAD_2:
first = 1; last = 7; first2 = 14; last2 = 20;
break;
case INTERSECT_CONIC_QUAD_3:
first = 1; last = 7; first2 = 17; last2 = 23;
break;
case INTERSECT_CONIC_QUAD_4:
first = 1; last = 7; first2 = 20; last2 = 26;
break;
case INTERSECT_CONIC_QUAD_NO:
first = 0; last = 6; first2 = 7; last2 = 13;
break;
case INTERSECT_CUBIC_QUAD:
first = 1; last = 9; first2 = 12; last2 = 18;
break;
case INTERSECT_CUBIC_QUAD_2:
first = 1; last = 9; first2 = 15; last2 = 21;
break;
case INTERSECT_CUBIC_QUAD_3:
first = 1; last = 9; first2 = 18; last2 = 24;
break;
case INTERSECT_CUBIC_QUAD_4:
first = 1; last = 9; first2 = 21; last2 = 27;
break;
case INTERSECT_CUBIC_QUAD_NO:
first = 0; last = 8; first2 = 8; last2 = 14;
break;
case INTERSECT_CUBIC:
first = 1; last = 9; first2 = 12; last2 = 20;
break;
case INTERSECT_CUBIC_2:
first = 1; last = 9; first2 = 15; last2 = 23;
break;
case INTERSECT_CUBIC_3:
first = 1; last = 9; first2 = 18; last2 = 26;
break;
case INTERSECT_CUBIC_4:
first = 1; last = 9; first2 = 21; last2 = 29;
break;
case INTERSECT_CUBIC_NO:
first = 0; last = 8; first2 = 8; last2 = 16;
break;
default:
console.log("unknown REC_TYPE_SECT frag type: " + fragType);
throw "stop execution";
}
break;
default:
continue;
}
for (var idx = first; idx < last; idx += 2) {
xmin = Math.min(xmin, frags[idx]);
xmax = Math.max(xmax, frags[idx]);
ymin = Math.min(ymin, frags[idx + 1]);
ymax = Math.max(ymax, frags[idx + 1]);
}
for (var idx = first2; idx < last2; idx += 2) {
xmin = Math.min(xmin, frags[idx]);
xmax = Math.max(xmax, frags[idx]);
ymin = Math.min(ymin, frags[idx + 1]);
ymax = Math.max(ymax, frags[idx + 1]);
}
}
}
var angleBounds = [Infinity, Infinity, -Infinity, -Infinity];
for (var tIndex = 0; tIndex < test.length; tIndex += 3) {
var recType = test[tIndex];
var records = test[tIndex + 2];
for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2) {
var fragType = records[recordIndex];
var frags = records[recordIndex + 1];
switch (recType) {
case REC_TYPE_ACTIVE_OP:
if (!draw_op) {
break;
}
{
var curve = curvePartialByID(test, frags[0], frags[1], frags[2]);
curve_extremes(curve, angleBounds);
}
break;
case REC_TYPE_ANGLE:
if (!draw_angle) {
break;
}
{
var curve = curvePartialByID(test, frags[0], frags[4], frags[5]);
curve_extremes(curve, angleBounds);
curve = curvePartialByID(test, frags[6], frags[10], frags[11]);
curve_extremes(curve, angleBounds);
curve = curvePartialByID(test, frags[12], frags[16], frags[17]);
}
break;
case REC_TYPE_COINCIDENCE:
if (!draw_coincidence) {
break;
}
{
var curve = curvePartialByID(test, frags[0], frags[1], frags[2]);
curve_extremes(curve, angleBounds);
}
break;
case REC_TYPE_SORT:
if (!draw_sort) {
break;
}
if (fragType == SORT_UNARY || fragType == SORT_BINARY) {
var curve = curvePartialByID(test, frags[0], frags[6], frags[8]);
curve_extremes(curve, angleBounds);
}
break;
case REC_TYPE_TOP:
if (!draw_top) {
break;
}
{
var curve = curvePartialByID(test, frags[0], frags[1], frags[2]);
curve_extremes(curve, angleBounds);
}
break;
}
}
}
xmin = Math.min(xmin, angleBounds[0]);
ymin = Math.min(ymin, angleBounds[1]);
xmax = Math.max(xmax, angleBounds[2]);
ymax = Math.max(ymax, angleBounds[3]);
setScale(xmin, xmax, ymin, ymax);
if (hasPath == false && hasComputedPath == true && !draw_computed) {
draw_computed = 7; // show quadratics, conics, and cubics
}
if (hasPath == true && hasComputedPath == false && draw_computed) {
draw_computed = 0;
}
}
function curveByIDMatch(test, id, recMatch) {
var tIndex = -3;
while ((tIndex += 3) < test.length) {
var recType = test[tIndex];
if (recType == REC_TYPE_OP) {
continue;
}
if (recType != recMatch) {
return [];
}
var records = test[tIndex + 2];
for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2) {
var fragType = records[recordIndex];
var frags = records[recordIndex + 1];
if (frags[0] == id) {
switch (fragType) {
case PATH_LINE:
return [frags[1], frags[2], frags[3], frags[4]];
case PATH_QUAD:
return [frags[1], frags[2], frags[3], frags[4],
frags[5], frags[6]];
case PATH_CONIC:
return [frags[1], frags[2], frags[3], frags[4],
frags[5], frags[6], frags[7]];
case PATH_CUBIC:
return [frags[1], frags[2], frags[3], frags[4],
frags[5], frags[6], frags[7], frags[8]];
}
}
}
}
return [];
}
function curveByID(test, id) {
var result = draw_path >= 4 ? curveByIDMatch(test, id, REC_TYPE_ALIGNED) : [];
if (!result.length) {
result = curveByIDMatch(test, id, REC_TYPE_PATH);
}
return result;
}
function curvePartialByIDMatch(test, id, t0, t1, recMatch) {
var tIndex = -3;
while ((tIndex += 3) < test.length) {
var recType = test[tIndex];
if (recType == REC_TYPE_OP) {
continue;
}
if (recType != recMatch) {
return [];
}
var records = test[tIndex + 2];
for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2) {
var fragType = records[recordIndex];
var frags = records[recordIndex + 1];
if (frags[0] == id) {
switch (fragType) {
case PATH_LINE:
return linePartial(frags[1], frags[2], frags[3], frags[4], t0, t1);
case PATH_QUAD:
return quadPartial(frags[1], frags[2], frags[3], frags[4],
frags[5], frags[6], t0, t1);
case PATH_CONIC:
return conicPartial(frags[1], frags[2], frags[3], frags[4],
frags[5], frags[6], frags[7], t0, t1);
case PATH_CUBIC:
return cubicPartial(frags[1], frags[2], frags[3], frags[4],
frags[5], frags[6], frags[7], frags[8], t0, t1);
}
}
}
}
return [];
}
function curvePartialByID(test, id, t0, t1) {
var result = draw_path >= 4 ? curvePartialByIDMatch(test, id, t0, t1, REC_TYPE_ALIGNED) : [];
if (!result.length) {
result = curvePartialByIDMatch(test, id, t0, t1, REC_TYPE_PATH);
}
return result;
}
function idByCurveIDMatch(test, frag, type, recMatch) {
var tIndex = 0;
while (tIndex < test.length) {
var recType = test[tIndex];
if (recType != recMatch) {
++tIndex;
continue;
}
var records = test[tIndex + 2];
for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2) {
var fragType = records[recordIndex];
var frags = records[recordIndex + 1];
if (frag.length != frags.length - 1) {
continue;
}
switch (fragType) {
case PATH_LINE:
if (frag[0] != frags[1] || frag[1] != frags[2]
|| frag[2] != frags[3] || frag[3] != frags[4]) {
continue;
}
return frags[0];
case PATH_QUAD:
if (frag[0] != frags[1] || frag[1] != frags[2]
|| frag[2] != frags[3] || frag[3] != frags[4]
|| frag[4] != frags[5] || frag[5] != frags[6]) {
continue;
}
return frags[0];
case PATH_CONIC:
if (frag[0] != frags[1] || frag[1] != frags[2]
|| frag[2] != frags[3] || frag[3] != frags[4]
|| frag[4] != frags[5] || frag[5] != frags[6]
|| frag[6] != frags[7]) {
continue;
}
return frags[0];
case PATH_CUBIC:
if (frag[0] != frags[1] || frag[1] != frags[2]
|| frag[2] != frags[3] || frag[3] != frags[4]
|| frag[4] != frags[5] || frag[5] != frags[6]
|| frag[6] != frags[7] || frag[7] != frags[8]) {
continue;
}
return frags[0];
}
}
++tIndex;
}
return -1;
}
function idByCurve(test, frag, type) {
var result = draw_path >= 4 ? idByCurveIDMatch(test, frag, type, REC_TYPE_ALIGNED) : [];
if (!result.length) {
result = idByCurveIDMatch(test, frag, type, REC_TYPE_PATH);
}
return result;
}
function curve_extremes(curve, bounds) {
var length = curve.length == 7 ? 6 : curve.length;
for (var index = 0; index < length; index += 2) {
var x = curve[index];
var y = curve[index + 1];
bounds[0] = Math.min(bounds[0], x);
bounds[1] = Math.min(bounds[1], y);
bounds[2] = Math.max(bounds[2], x);
bounds[3] = Math.max(bounds[3], y);
}
}
function setScale(x0, x1, y0, y1) {
var srcWidth = x1 - x0;
var srcHeight = y1 - y0;
var usableWidth = screenWidth;
var xDigits = Math.ceil(Math.log(Math.abs(xmax)) / Math.log(10));
var yDigits = Math.ceil(Math.log(Math.abs(ymax)) / Math.log(10));
usableWidth -= (xDigits + yDigits) * 10;
usableWidth -= decimal_places * 10;
if (draw_legend) {
usableWidth -= 40;
}
var hscale = usableWidth / srcWidth;
var vscale = screenHeight / srcHeight;
scale = Math.min(hscale, vscale);
var invScale = 1 / scale;
var sxmin = x0 - invScale * 5;
var symin = y0 - invScale * 10;
var sxmax = x1 + invScale * (6 * decimal_places + 10);
var symax = y1 + invScale * 10;
srcWidth = sxmax - sxmin;
srcHeight = symax - symin;
hscale = usableWidth / srcWidth;
vscale = screenHeight / srcHeight;
scale = Math.min(hscale, vscale);
srcLeft = sxmin;
srcTop = symin;
}
function drawArc(curve, op, from, to) {
var type = PATH_LINE + (curve.length / 2 - 2);
var pt = pointAtT(curve, type, op ? 0.4 : 0.6);
var dy = pt.y - curve[1];
var dx = pt.x - curve[0];
var dist = Math.sqrt(dy * dy + dx * dx);
var _dist = dist * scale;
var angle = Math.atan2(dy, dx);
var _px = (curve[0] - srcLeft) * scale;
var _py = (curve[1] - srcTop) * scale;
var divisor = 4;
var endDist;
do {
var ends = [];
for (var index = -1; index <= 1; index += 2) {
var px = Math.cos(index * Math.PI / divisor);
var py = Math.sin(index * Math.PI / divisor);
ends.push(px);
ends.push(py);
}
var endDx = (ends[2] - ends[0]) * scale * dist;
var endDy = (ends[3] - ends[1]) * scale * dist;
endDist = Math.sqrt(endDx * endDx + endDy * endDy);
if (endDist < 100) {
break;
}
divisor *= 2;
} while (true);
if (endDist < 30) {
return;
}
if (op) {
divisor *= 2;
}
ctx.strokeStyle = op ? "rgba(210,0,45, 0.4)" : "rgba(90,90,90, 0.5)";
ctx.beginPath();
ctx.arc(_px, _py, _dist, angle - Math.PI / divisor, angle + Math.PI / divisor, false);
ctx.stroke();
var saveAlign = ctx.textAlign;
var saveStyle = ctx.fillStyle;
var saveFont = ctx.font;
ctx.textAlign = "center";
ctx.fillStyle = "black";
ctx.font = "normal 24px Arial";
divisor *= 0.8;
for (var index = -1; index <= 1; index += 2) {
var px = curve[0] + Math.cos(angle + index * Math.PI / divisor) * dist;
var py = curve[1] + Math.sin(angle + index * Math.PI / divisor) * dist;
var _px = (px - srcLeft) * scale;
var _py = (py - srcTop) * scale;
ctx.fillText(index < 0 ? to.toString() : from.toString(), _px, _py + 8);
}
ctx.textAlign = saveAlign;
ctx.fillStyle = saveStyle;
ctx.font = saveFont;
}
function drawPoint(px, py, end) {
var length = drawnPts.length == 7 ? 6 : drawnPts.length;
for (var pts = 0; pts < length; pts += 2) {
var x = drawnPts[pts];
var y = drawnPts[pts + 1];
if (px == x && py == y) {
return;
}
}
drawnPts.push(px);
drawnPts.push(py);
var label = px.toFixed(decimal_places) + ", " + py.toFixed(decimal_places);
var _px = (px - srcLeft) * scale;
var _py = (py - srcTop) * scale;
ctx.beginPath();
ctx.arc(_px, _py, 3, 0, Math.PI*2, true);
ctx.closePath();
if (end) {
ctx.fill();
} else {
ctx.stroke();
}
if (debug_xy) {
ctx.textAlign = "left";
ctx.fillText(label, _px + 5, _py);
}
}
function coordCount(curveType) {
switch (curveType) {
case PATH_LINE:
return 4;
case PATH_QUAD:
return 6;
case PATH_CONIC:
return 6;
case PATH_CUBIC:
return 8;
}
return -1;
}
function drawPoints(ptArray, curveType, drawControls) {
var count = coordCount(curveType);
for (var idx = 0; idx < count; idx += 2) {
if (!drawControls && idx != 0 && idx != count - 2) {
continue;
}
drawPoint(ptArray[idx], ptArray[idx + 1], idx == 0 || idx == count - 2);
}
}
function drawControlLines(curve, curveType, drawEnd) {
if (curveType == PATH_LINE) {
return;
}
ctx.strokeStyle = "rgba(0,0,0, 0.3)";
drawLine(curve[0], curve[1], curve[2], curve[3]);
drawLine(curve[2], curve[3], curve[4], curve[5]);
if (curveType == PATH_CUBIC) {
drawLine(curve[4], curve[5], curve[6], curve[7]);
if (drawEnd > 1) {
drawLine(curve[6], curve[7], curve[0], curve[1]);
if (drawEnd > 2) {
drawLine(curve[0], curve[1], curve[4], curve[5]);
drawLine(curve[6], curve[7], curve[2], curve[3]);
}
}
} else if (drawEnd > 1) {
drawLine(curve[4], curve[5], curve[0], curve[1]);
}
}
function pointAtT(curve, curveType, t) {
var xy = {};
switch (curveType) {
case PATH_LINE:
var a = 1 - t;
var b = t;
xy.x = a * curve[0] + b * curve[2];
xy.y = a * curve[1] + b * curve[3];
break;
case PATH_QUAD:
var one_t = 1 - t;
var a = one_t * one_t;
var b = 2 * one_t * t;
var c = t * t;
xy.x = a * curve[0] + b * curve[2] + c * curve[4];
xy.y = a * curve[1] + b * curve[3] + c * curve[5];
break;
case PATH_CONIC:
var one_t = 1 - t;
var a = one_t * one_t;
var b = 2 * one_t * t;
var c = t * t;
xy.x = a * curve[0] + b * curve[2] * curve[6] + c * curve[4];
xy.y = a * curve[1] + b * curve[3] * curve[6] + c * curve[5];
var d = a + b * curve[6] + c;
xy.x /= d;
xy.y /= d;
break;
case PATH_CUBIC:
var one_t = 1 - t;
var one_t2 = one_t * one_t;
var a = one_t2 * one_t;
var b = 3 * one_t2 * t;
var t2 = t * t;
var c = 3 * one_t * t2;
var d = t2 * t;
xy.x = a * curve[0] + b * curve[2] + c * curve[4] + d * curve[6];
xy.y = a * curve[1] + b * curve[3] + c * curve[5] + d * curve[7];
break;
}
return xy;
}
function drawPointAtT(curve, curveType) {
var x, y;
var xy = pointAtT(curve, curveType, curveT);
drawPoint(xy.x, xy.y, true);
if (!draw_intersectT) {
return;
}
ctx.fillStyle = "red";
drawTAtPointUp(xy.x, xy.y, curveT);
}
function drawTAtPointUp(px, py, t) {
var label = t.toFixed(decimal_places);
var _px = (px - srcLeft)* scale;
var _py = (py - srcTop) * scale;
ctx.fillText(label, _px + 5, _py - 10);
}
function drawTAtPointDown(px, py, t) {
var label = t.toFixed(decimal_places);
var _px = (px - srcLeft)* scale;
var _py = (py - srcTop) * scale;
ctx.fillText(label, _px + 5, _py + 10);
}
function alreadyDrawnLine(x1, y1, x2, y2) {
if (collect_bounds) {
if (focus_enabled) {
focusXmin = Math.min(focusXmin, x1, x2);
focusYmin = Math.min(focusYmin, y1, y2);
focusXmax = Math.max(focusXmax, x1, x2);
focusYmax = Math.max(focusYmax, y1, y2);
}
return true;
}
for (var pts = 0; pts < drawnLines.length; pts += 4) {
if (x1 == drawnLines[pts] && y1 == drawnLines[pts + 1]
&& x2 == drawnLines[pts + 2] && y2 == drawnLines[pts + 3]) {
return true;
}
}
drawnLines.push(x1);
drawnLines.push(y1);
drawnLines.push(x2);
drawnLines.push(y2);
return false;
}
function drawLine(x1, y1, x2, y2) {
if (alreadyDrawnLine(x1, y1, x2, y2)) {
return;
}
ctx.beginPath();
ctx.moveTo((x1 - srcLeft) * scale,
(y1 - srcTop) * scale);
ctx.lineTo((x2 - srcLeft) * scale,
(y2 - srcTop) * scale);
ctx.stroke();
}
function linePartial(x1, y1, x2, y2, t1, t2) {
var dx = x1 - x2;
var dy = y1 - y2;
var array = [
x1 - t1 * dx,
y1 - t1 * dy,
x1 - t2 * dx,
y1 - t2 * dy
];
return array;
}
function drawLinePartial(x1, y1, x2, y2, t1, t2) {
var a = linePartial(x1, y1, x2, y2, t1, t2);
var ax = a[0];
var ay = a[1];
var bx = a[2];
var by = a[3];
if (alreadyDrawnLine(ax, ay, bx, by)) {
return;
}
ctx.beginPath();
ctx.moveTo((ax - srcLeft) * scale,
(ay - srcTop) * scale);
ctx.lineTo((bx - srcLeft) * scale,
(by - srcTop) * scale);
ctx.stroke();
}
function alreadyDrawnQuad(x1, y1, x2, y2, x3, y3) {
if (collect_bounds) {
if (focus_enabled) {
focusXmin = Math.min(focusXmin, x1, x2, x3);
focusYmin = Math.min(focusYmin, y1, y2, y3);
focusXmax = Math.max(focusXmax, x1, x2, x3);
focusYmax = Math.max(focusYmax, y1, y2, y3);
}
return true;
}
for (var pts = 0; pts < drawnQuads.length; pts += 6) {
if (x1 == drawnQuads[pts] && y1 == drawnQuads[pts + 1]
&& x2 == drawnQuads[pts + 2] && y2 == drawnQuads[pts + 3]
&& x3 == drawnQuads[pts + 4] && y3 == drawnQuads[pts + 5]) {
return true;
}
}
drawnQuads.push(x1);
drawnQuads.push(y1);
drawnQuads.push(x2);
drawnQuads.push(y2);
drawnQuads.push(x3);
drawnQuads.push(y3);
return false;
}
function drawQuad(x1, y1, x2, y2, x3, y3) {
if (alreadyDrawnQuad(x1, y1, x2, y2, x3, y3)) {
return;
}
ctx.beginPath();
ctx.moveTo((x1 - srcLeft) * scale,
(y1 - srcTop) * scale);
ctx.quadraticCurveTo((x2 - srcLeft) * scale,
(y2 - srcTop) * scale,
(x3 - srcLeft) * scale,
(y3 - srcTop) * scale);
ctx.stroke();
}
function interp(A, B, t) {
return A + (B - A) * t;
}
function interp_quad_coords(x1, x2, x3, t)
{
var ab = interp(x1, x2, t);
var bc = interp(x2, x3, t);
var abc = interp(ab, bc, t);
return abc;
}
function quadPartial(x1, y1, x2, y2, x3, y3, t1, t2) {
var ax = interp_quad_coords(x1, x2, x3, t1);
var ay = interp_quad_coords(y1, y2, y3, t1);
var dx = interp_quad_coords(x1, x2, x3, (t1 + t2) / 2);
var dy = interp_quad_coords(y1, y2, y3, (t1 + t2) / 2);
var cx = interp_quad_coords(x1, x2, x3, t2);
var cy = interp_quad_coords(y1, y2, y3, t2);
var bx = 2*dx - (ax + cx)/2;
var by = 2*dy - (ay + cy)/2;
var array = [
ax, ay, bx, by, cx, cy
];
return array;
}
function drawQuadPartial(x1, y1, x2, y2, x3, y3, t1, t2) {
var a = quadPartial(x1, y1, x2, y2, x3, y3, t1, t2);
var ax = a[0];
var ay = a[1];
var bx = a[2];
var by = a[3];
var cx = a[4];
var cy = a[5];
if (alreadyDrawnQuad(ax, ay, bx, by, cx, cy)) {
return;
}
ctx.beginPath();
ctx.moveTo((ax - srcLeft) * scale,
(ay - srcTop) * scale);
ctx.quadraticCurveTo((bx - srcLeft) * scale,
(by - srcTop) * scale,
(cx - srcLeft) * scale,
(cy - srcTop) * scale);
ctx.stroke();
}
function alreadyDrawnConic(x1, y1, x2, y2, x3, y3, w) {
if (collect_bounds) {
if (focus_enabled) {
focusXmin = Math.min(focusXmin, x1, x2, x3);
focusYmin = Math.min(focusYmin, y1, y2, y3);
focusXmax = Math.max(focusXmax, x1, x2, x3);
focusYmax = Math.max(focusYmax, y1, y2, y3);
}
return true;
}
for (var pts = 0; pts < drawnConics.length; pts += 8) {
if (x1 == drawnConics[pts] && y1 == drawnCubics[pts + 1]
&& x2 == drawnCubics[pts + 2] && y2 == drawnCubics[pts + 3]
&& x3 == drawnCubics[pts + 4] && y3 == drawnCubics[pts + 5]
&& w == drawnCubics[pts + 6]) {
return true;
}
}
drawnConics.push(x1);
drawnConics.push(y1);
drawnConics.push(x2);
drawnConics.push(y2);
drawnConics.push(x3);
drawnConics.push(y3);
drawnCubics.push(w);
return false;
}
var kMaxConicToQuadPOW2 = 5;
function computeQuadPOW2(curve, tol) {
var a = curve[6] - 1;
var k = a / (4 * (2 + a));
var x = k * (curve[0] - 2 * curve[2] + curve[4]);
var y = k * (curve[1] - 2 * curve[3] + curve[5]);
var error = Math.sqrt(x * x + y * y);
var pow2;
for (pow2 = 0; pow2 < kMaxConicToQuadPOW2; ++pow2) {
if (error <= tol) {
break;
}
error *= 0.25;
}
return pow2;
}
function subdivide_w_value(w) {
return Math.sqrt(0.5 + w * 0.5);
}
function chop(curve, part1, part2) {
var w = curve[6];
var scale = 1 / (1 + w);
part1[0] = curve[0];
part1[1] = curve[1];
part1[2] = (curve[0] + curve[2] * w) * scale;
part1[3] = (curve[1] + curve[3] * w) * scale;
part1[4] = part2[0] = (curve[0] + (curve[2] * w) * 2 + curve[4]) * scale * 0.5;
part1[5] = part2[1] = (curve[1] + (curve[3] * w) * 2 + curve[5]) * scale * 0.5;
part2[2] = (curve[2] * w + curve[4]) * scale;
part2[3] = (curve[3] * w + curve[5]) * scale;
part2[4] = curve[4];
part2[5] = curve[5];
part1[6] = part2[6] = subdivide_w_value(w);
}
function subdivide(curve, level, pts) {
if (0 == level) {
pts.push(curve[2]);
pts.push(curve[3]);
pts.push(curve[4]);
pts.push(curve[5]);
} else {
var part1 = [], part2 = [];
chop(curve, part1, part2);
--level;
subdivide(part1, level, pts);
subdivide(part2, level, pts);
}
}
function chopIntoQuadsPOW2(curve, pow2, pts) {
subdivide(curve, pow2, pts);
return 1 << pow2;
}
function drawConicWithQuads(x1, y1, x2, y2, x3, y3, w) {
if (alreadyDrawnConic(x1, y1, x2, y2, x3, y3, w)) {
return;
}
ctx.beginPath();
ctx.moveTo((x1 - srcLeft) * scale,
(y1 - srcTop) * scale);
var tol = 1 / scale;
var curve = [x1, y1, x2, y2, x3, y3, w];
var pow2 = computeQuadPOW2(curve, tol);
var pts = [];
chopIntoQuadsPOW2(curve, pow2, pts);
for (var i = 0; i < pts.length; i += 4) {
ctx.quadraticCurveTo(
(pts[i + 0] - srcLeft) * scale, (pts[i + 1] - srcTop) * scale,
(pts[i + 2] - srcLeft) * scale, (pts[i + 3] - srcTop) * scale);
}
ctx.stroke();
}
function conic_eval_numerator(x1, x2, x3, w, t) {
var src2w = x2 * w;
var C = x1;
var A = x3 - 2 * src2w + C;
var B = 2 * (src2w - C);
return (A * t + B) * t + C;
}
function conic_eval_denominator(w, t) {
var B = 2 * (w - 1);
var C = 1;
var A = -B;
return (A * t + B) * t + C;
}
function conicPartial(x1, y1, x2, y2, x3, y3, w, t1, t2) {
var ax = conic_eval_numerator(x1, x2, x3, w, t1);
var ay = conic_eval_numerator(y1, y2, y3, w, t1);
var az = conic_eval_denominator(w, t1);
var midT = (t1 + t2) / 2;
var dx = conic_eval_numerator(x1, x2, x3, w, midT);
var dy = conic_eval_numerator(y1, y2, y3, w, midT);
var dz = conic_eval_denominator(w, midT);
var cx = conic_eval_numerator(x1, x2, x3, w, t2);
var cy = conic_eval_numerator(y1, y2, y3, w, t2);
var cz = conic_eval_denominator(w, t2);
var bx = 2 * dx - (ax + cx) / 2;
var by = 2 * dy - (ay + cy) / 2;
var bz = 2 * dz - (az + cz) / 2;
var dt = t2 - t1;
var dt_1 = 1 - dt;
var array = [
ax / az, ay / az, bx / bz, by / bz, cx / cz, cy / cz, 0
];
var dMidAC = { x:(array[0] + array[4]) / 2, y:(array[1] + array[5]) / 2 };
var dMid = { x:dx / dz, y:dy / dz };
var dWNumer = { x:dMidAC.x - dMid.x, y:dMidAC.y - dMid.y };
var dWDenom = { x:dMid.x - array[2], y:dMid.y - array[3] };
var partW = Math.sqrt(dWNumer.x * dWNumer.x + dWNumer.y * dWNumer.y)
/ Math.sqrt(dWDenom.x * dWDenom.x + dWDenom.y * dWDenom.y);
array[6] = partW;
return array;
}
function drawConicPartial(x1, y1, x2, y2, x3, y3, w, t1, t2) {
var a = conicPartial(x1, y1, x2, y2, x3, y3, w, t1, t2);
var ax = a[0];
var ay = a[1];
var bx = a[2];
var by = a[3];
var cx = a[4];
var cy = a[5];
var w_ = a[6];
drawConicWithQuads(ax, ay, bx, by, cx, cy, w_);
}
function alreadyDrawnCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
if (collect_bounds) {
if (focus_enabled) {
focusXmin = Math.min(focusXmin, x1, x2, x3, x4);
focusYmin = Math.min(focusYmin, y1, y2, y3, y4);
focusXmax = Math.max(focusXmax, x1, x2, x3, x4);
focusYmax = Math.max(focusYmax, y1, y2, y3, y4);
}
return true;
}
for (var pts = 0; pts < drawnCubics.length; pts += 8) {
if (x1 == drawnCubics[pts] && y1 == drawnCubics[pts + 1]
&& x2 == drawnCubics[pts + 2] && y2 == drawnCubics[pts + 3]
&& x3 == drawnCubics[pts + 4] && y3 == drawnCubics[pts + 5]
&& x4 == drawnCubics[pts + 6] && y4 == drawnCubics[pts + 7]) {
return true;
}
}
drawnCubics.push(x1);
drawnCubics.push(y1);
drawnCubics.push(x2);
drawnCubics.push(y2);
drawnCubics.push(x3);
drawnCubics.push(y3);
drawnCubics.push(x4);
drawnCubics.push(y4);
return false;
}
function drawCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
if (alreadyDrawnCubic(x1, y1, x2, y2, x3, y3, x4, y4)) {
return;
}
ctx.beginPath();
ctx.moveTo((x1 - srcLeft) * scale,
(y1 - srcTop) * scale);
ctx.bezierCurveTo((x2 - srcLeft) * scale,
(y2 - srcTop) * scale,
(x3 - srcLeft) * scale,
(y3 - srcTop) * scale,
(x4 - srcLeft) * scale,
(y4 - srcTop) * scale);
ctx.stroke();
}
function interp_cubic_coords(x1, x2, x3, x4, t)
{
var ab = interp(x1, x2, t);
var bc = interp(x2, x3, t);
var cd = interp(x3, x4, t);
var abc = interp(ab, bc, t);
var bcd = interp(bc, cd, t);
var abcd = interp(abc, bcd, t);
return abcd;
}
function cubicPartial(x1, y1, x2, y2, x3, y3, x4, y4, t1, t2) {
var ax = interp_cubic_coords(x1, x2, x3, x4, t1);
var ay = interp_cubic_coords(y1, y2, y3, y4, t1);
var ex = interp_cubic_coords(x1, x2, x3, x4, (t1*2+t2)/3);
var ey = interp_cubic_coords(y1, y2, y3, y4, (t1*2+t2)/3);
var fx = interp_cubic_coords(x1, x2, x3, x4, (t1+t2*2)/3);
var fy = interp_cubic_coords(y1, y2, y3, y4, (t1+t2*2)/3);
var dx = interp_cubic_coords(x1, x2, x3, x4, t2);
var dy = interp_cubic_coords(y1, y2, y3, y4, t2);
var mx = ex * 27 - ax * 8 - dx;
var my = ey * 27 - ay * 8 - dy;
var nx = fx * 27 - ax - dx * 8;
var ny = fy * 27 - ay - dy * 8;
var bx = (mx * 2 - nx) / 18;
var by = (my * 2 - ny) / 18;
var cx = (nx * 2 - mx) / 18;
var cy = (ny * 2 - my) / 18;
var array = [
ax, ay, bx, by, cx, cy, dx, dy
];
return array;
}
function drawCubicPartial(x1, y1, x2, y2, x3, y3, x4, y4, t1, t2) {
var a = cubicPartial(x1, y1, x2, y2, x3, y3, x4, y4, t1, t2);
var ax = a[0];
var ay = a[1];
var bx = a[2];
var by = a[3];
var cx = a[4];
var cy = a[5];
var dx = a[6];
var dy = a[7];
if (alreadyDrawnCubic(ax, ay, bx, by, cx, cy, dx, dy)) {
return;
}
ctx.beginPath();
ctx.moveTo((ax - srcLeft) * scale,
(ay - srcTop) * scale);
ctx.bezierCurveTo((bx - srcLeft) * scale,
(by - srcTop) * scale,
(cx - srcLeft) * scale,
(cy - srcTop) * scale,
(dx - srcLeft) * scale,
(dy - srcTop) * scale);
ctx.stroke();
}
function drawCurve(c) {
switch (c.length) {
case 4:
drawLine(c[0], c[1], c[2], c[3]);
break;
case 6:
drawQuad(c[0], c[1], c[2], c[3], c[4], c[5]);
break;
case 7:
drawConicWithQuads(c[0], c[1], c[2], c[3], c[4], c[5], c[6]);
break;
case 8:
drawCubic(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]);
break;
}
}
function boundsWidth(pts) {
var min = pts[0];
var max = pts[0];
var length = pts.length == 7 ? 6 : pts.length;
for (var idx = 2; idx < length; idx += 2) {
min = Math.min(min, pts[idx]);
max = Math.max(max, pts[idx]);
}
return max - min;
}
function boundsHeight(pts) {
var min = pts[1];
var max = pts[1];
var length = pts.length == 7 ? 6 : pts.length;
for (var idx = 3; idx < length; idx += 2) {
min = Math.min(min, pts[idx]);
max = Math.max(max, pts[idx]);
}
return max - min;
}
function tangent(pts) {
var dx = pts[2] - pts[0];
var dy = pts[3] - pts[1];
if (dx == 0 && dy == 0 && pts.length > 4) {
dx = pts[4] - pts[0];
dy = pts[5] - pts[1];
if (dx == 0 && dy == 0 && pts.length == 8) {
dx = pts[6] - pts[0];
dy = pts[7] - pts[1];
}
}
return Math.atan2(-dy, dx);
}
function hodograph(cubic) {
var hodo = [];
hodo[0] = 3 * (cubic[2] - cubic[0]);
hodo[1] = 3 * (cubic[3] - cubic[1]);
hodo[2] = 3 * (cubic[4] - cubic[2]);
hodo[3] = 3 * (cubic[5] - cubic[3]);
hodo[4] = 3 * (cubic[6] - cubic[4]);
hodo[5] = 3 * (cubic[7] - cubic[5]);
return hodo;
}
function hodograph2(cubic) {
var quad = hodograph(cubic);
var hodo = [];
hodo[0] = 2 * (quad[2] - quad[0]);
hodo[1] = 2 * (quad[3] - quad[1]);
hodo[2] = 2 * (quad[4] - quad[2]);
hodo[3] = 2 * (quad[5] - quad[3]);
return hodo;
}
function quadraticRootsReal(A, B, C, s) {
if (A == 0) {
if (B == 0) {
s[0] = 0;
return C == 0;
}
s[0] = -C / B;
return 1;
}
/* normal form: x^2 + px + q = 0 */
var p = B / (2 * A);
var q = C / A;
var p2 = p * p;
if (p2 < q) {
return 0;
}
var sqrt_D = 0;
if (p2 > q) {
sqrt_D = sqrt(p2 - q);
}
s[0] = sqrt_D - p;
s[1] = -sqrt_D - p;
return 1 + s[0] != s[1];
}
function add_valid_ts(s, realRoots, t) {
var foundRoots = 0;
for (var index = 0; index < realRoots; ++index) {
var tValue = s[index];
if (tValue >= 0 && tValue <= 1) {
for (var idx2 = 0; idx2 < foundRoots; ++idx2) {
if (t[idx2] != tValue) {
t[foundRoots++] = tValue;
}
}
}
}
return foundRoots;
}
function quadraticRootsValidT(a, b, c, t) {
var s = [];
var realRoots = quadraticRootsReal(A, B, C, s);
var foundRoots = add_valid_ts(s, realRoots, t);
return foundRoots != 0;
}
function find_cubic_inflections(cubic, tValues) {
var Ax = src[2] - src[0];
var Ay = src[3] - src[1];
var Bx = src[4] - 2 * src[2] + src[0];
var By = src[5] - 2 * src[3] + src[1];
var Cx = src[6] + 3 * (src[2] - src[4]) - src[0];
var Cy = src[7] + 3 * (src[3] - src[5]) - src[1];
return quadraticRootsValid