blob: 30140ad4b6bd72063d289fb0dffcbbc5589a9ff4 [file] [log] [blame]
caryclarkdac1d172014-06-17 05:15:38 -07001<html>
2<head>
3<div height="0" hidden="true">
caryclarkdac1d172014-06-17 05:15:38 -07004
caryclark55888e42016-07-18 10:01:36 -07005<div id="cubics_d3">
6seg=1 {{{3, 4}, {1.5f, 5}, {2.25f, 4.25f}, {3.125f, 3.375f}}}
7seg=2 {{{3.125f, 3.375f}, {4, 2.5f}, {5, 1.5f}, {4, 2}}}
8seg=3 {{{4, 2}, {3, 4}}}
9op diff
10seg=4 {{{1, 6}, {1.5f, 5}, {2.25f, 4.25f}, {3.125f, 3.375f}}}
11seg=5 {{{3.125f, 3.375f}, {4, 2.5f}, {5, 1.5f}, {6, 0}}}
12seg=6 {{{6, 0}, {1, 6}}}
13debugShowCubicIntersection wtTs[0]=1 {{{1,6}, {1.5,5}, {2.25,4.25}, {3.125,3.375}}} {{3.125,3.375}} wnTs[0]=0 {{{3.125,3.375}, {4,2.5}, {5,1.5}, {6,0}}}
14debugShowCubicLineIntersection wtTs[0]=0 {{{1,6}, {1.5,5}, {2.25,4.25}, {3.125,3.375}}} {{1,6}} wnTs[0]=1 {{{6,0}, {1,6}}}
15debugShowCubicLineIntersection wtTs[0]=0.142857143 {{{3.125,3.375}, {4,2.5}, {5,1.5}, {6,0}}} {{3.50728869,2.99125361}} wtTs[1]=1 {{6,0}} wnTs[0]=0.498542 {{{6,0}, {1,6}}} wnTs[1]=0
16SkOpSegment::addT insert t=0.142857143 segID=5 spanID=13
17SkOpSegment::addT insert t=0.498542274 segID=6 spanID=14
18debugShowCubicIntersection wtTs[0]=1 {{{1,6}, {1.5,5}, {2.25,4.25}, {3.125,3.375}}} {{3.125,3.375}} wnTs[0]=1 {{{3,4}, {1.5,5}, {2.25,4.25}, {3.125,3.375}}}
19debugShowCubicIntersection wtTs[0]=1 {{{1,6}, {1.5,5}, {2.25,4.25}, {3.125,3.375}}} {{3.125,3.375}} wnTs[0]=0 {{{3.125,3.375}, {4,2.5}, {5,1.5}, {4,2}}}
20debugShowCubicLineIntersection no intersect {{{1,6}, {1.5,5}, {2.25,4.25}, {3.125,3.375}}} {{{4,2}, {3,4}}}
21debugShowCubicIntersection wtTs[0]=0 {{{3.125,3.375}, {4,2.5}, {5,1.5}, {6,0}}} {{3.125,3.375}} wnTs[0]=1 {{{3,4}, {1.5,5}, {2.25,4.25}, {3.125,3.375}}}
22debugShowCubicIntersection wtTs[0]=0 {{{3.125,3.375}, {4,2.5}, {5,1.5}, {6,0}}} {{3.125,3.375}} wnTs[0]=0 {{{3.125,3.375}, {4,2.5}, {5,1.5}, {4,2}}}
23debugShowCubicLineIntersection wtTs[0]=0.140692452 {{{3.125,3.375}, {4,2.5}, {5,1.5}, {6,0}}} {{3.50139236,2.99721503}} wnTs[0]=0.498608 {{{4,2}, {3,4}}}
24SkOpSegment::addT insert t=0.140692452 segID=5 spanID=15
25SkOpSegment::addT insert t=0.498607541 segID=3 spanID=16
26debugShowCubicLineIntersection wtTs[0]=0.220070773 {{{3,4}, {1.5,5}, {2.25,4.25}, {3.125,3.375}}} {{2.31394291,4.42326832}} wnTs[0]=0.737211 {{{6,0}, {1,6}}}
27SkOpSegment::addT insert t=0.737211419 segID=6 spanID=17
28SkOpSegment::addT insert t=0.220070773 segID=1 spanID=18
29debugShowCubicLineIntersection wtTs[0]=0.145241853 {{{3.125,3.375}, {4,2.5}, {5,1.5}, {4,2}}} {{3.50765967,2.99080825}} wtTs[1]=0.715768455 {{4.41676426,1.89988291}} wnTs[0]=0.498468 {{{6,0}, {1,6}}} wnTs[1]=0.316647149
30SkOpSegment::addT insert t=0.498468047 segID=6 spanID=19
31SkOpSegment::addT insert t=0.145241853 segID=2 spanID=20
32SkOpSegment::addT insert t=0.316647149 segID=6 spanID=21
33SkOpSegment::addT insert t=0.715768455 segID=2 spanID=22
34debugShowLineIntersection wtTs[0]=0.5 {{{6,0}, {1,6}}} {{3.5,3}} wnTs[0]=0.5 {{{4,2}, {3,4}}}
35SkOpSegment::addT insert t=0.5 segID=6 spanID=23
36SkOpSegment::addT insert t=0.5 segID=3 spanID=24
37debugShowCubicIntersection wtTs[0]=1 {{{3,4}, {1.5,5}, {2.25,4.25}, {3.125,3.375}}} {{3.125,3.375}} wnTs[0]=0 {{{3.125,3.375}, {4,2.5}, {5,1.5}, {4,2}}}
38debugShowCubicLineIntersection wtTs[0]=0 {{{3,4}, {1.5,5}, {2.25,4.25}, {3.125,3.375}}} {{3,4}} wnTs[0]=1 {{{4,2}, {3,4}}}
39debugShowCubicLineIntersection wtTs[0]=0.142857143 {{{3.125,3.375}, {4,2.5}, {5,1.5}, {4,2}}} {{3.50145769,2.99708462}} wtTs[1]=1 {{4,2}} wnTs[0]=0.498542 {{{4,2}, {3,4}}} wnTs[1]=0
40SkOpSegment::addT insert t=0.142857143 segID=2 spanID=25
41SkOpSegment::addT insert t=0.498542274 segID=3 spanID=26
42--------------------------------- start
43active after start:
44SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
45SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
46SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
47SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
48SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
49SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
50SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
51SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
52SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
53SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
54SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
55SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
56SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
57SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
58SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
59SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
60SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
61SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
62SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
63SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
64--------------------------------- addExpanded
65active after addExpanded:
66SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
67SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
68SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
69SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
70SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
71SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
72SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
73SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
74SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
75SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
76SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
77SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
78SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
79SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
80SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
81SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
82SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
83SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
84SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
85SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
86--------------------------------- moveMultiples
87active after moveMultiples:
88SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
89SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
90SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
91SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
92SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
93SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
94SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
95SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
96SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
97SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
98SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
99SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
100SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
101SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
102SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
103SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
104SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
105SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
106SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
107SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
108--------------------------------- moveNearby
109active after moveNearby:
110SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
111SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
112SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
113SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
114SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
115SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
116SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
117SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
118SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
119SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
120SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
121SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
122SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
123SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
124SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
125SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
126SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
127SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
128SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
129SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
130--------------------------------- addEndMovedSpans
131active after addEndMovedSpans:
132SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
133SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
134SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
135SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
136SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
137SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
138SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
139SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
140SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
141SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
142SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
143SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
144SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
145SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
146SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
147SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
148SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
149SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
150SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
151SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
152--------------------------------- addMissing2
153active after addMissing2:
154SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
155SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
156SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
157SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
158SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
159SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
160SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
161SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
162SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
163SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
164SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
165SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
166SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
167SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
168SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
169SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
170SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
171SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
172SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
173SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
174--------------------------------- moveNearby2
175active after moveNearby2:
176SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
177SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
178SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
179SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
180SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
181SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
182SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
183SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
184SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
185SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
186SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
187SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
188SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
189SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
190SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
191SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
192SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
193SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
194SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
195SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
196--------------------------------- expand2
197active after expand2:
198SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
199SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
200SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
201SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
202SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
203SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
204SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
205SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
206SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
207SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
208SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
209SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
210SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
211SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
212SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
213SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
214SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
215SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
216SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
217SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
218--------------------------------- addExpanded3
219active after addExpanded3:
220SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
221SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
222SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
223SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
224SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
225SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
226SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
227SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
228SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
229SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
230SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
231SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
232SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
233SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
234SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
235SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
236SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
237SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
238SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
239SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
240--------------------------------- mark1
241active after mark1:
242SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
243SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
244SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
245SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
246SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
247SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
248SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
249SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
250SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
251SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
252SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
253SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
254SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
255SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
256SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
257SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
258SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
259SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
260SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
261SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
262--------------------------------- missingCoincidence2
263active after missingCoincidence2:
264SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
265SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
266SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
267SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
268SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
269SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
270SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
271SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
272SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
273SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
274SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
275SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
276SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
277SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
278SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
279SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
280SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
281SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
282SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
283SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
284--------------------------------- missingCoincidence3
285active after missingCoincidence3:
286SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
287SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
288SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
289SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
290SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
291SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
292SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
293SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
294SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
295SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
296SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
297SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
298SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
299SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
300SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
301SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
302SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
303SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
304SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
305SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
306--------------------------------- coincidence.reorder
307active after coincidence.reorder:
308SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
309SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
310SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
311SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
312SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
313SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
314SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
315SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
316SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
317SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
318SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
319SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
320SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
321SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
322SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
323SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
324SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
325SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
326SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
327SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
328--------------------------------- pairs->apply
329active after pairs->apply:
330SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
331SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
332SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
333SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
334SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
335SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
336SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
337SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
338SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
339SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
340SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
341SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
342SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
343SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
344SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
345SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
346SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
347SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
348SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
349SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
350--------------------------------- pairs->findOverlaps
351active after pairs->findOverlaps:
352SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
353SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
354SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
355SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
356SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
357SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
358SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
359SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
360SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
361SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
362SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
363SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
364SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
365SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
366SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
367SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
368SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
369SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
370SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
371SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
372SkOpSegment::sortAngles [4] tStart=1 [8]
373SkOpAngle::after [4/1] 20/21 tStart=1 tEnd=0 < [1/19] 20/21 tStart=1 tEnd=0.220070773 < [2/20] 4/5 tStart=0 tEnd=0.142857143 T 12
374SkOpAngle::afterPart {{{3.125,3.375}, {2.25,4.25}, {1.5,5}, {1,6}}} id=4
375SkOpAngle::afterPart {{{3.125,3.375}, {2.44256193,4.05743807}, {1.83616005,4.66383975}, {2.31394291,4.42326832}}} id=1
376SkOpAngle::afterPart {{{3.125,3.375}, {3.25,3.25}, {3.37755099,3.12244905}, {3.50145769,2.99708462}}} id=2
377SkOpAngle::after [4/1] 20/21 tStart=1 tEnd=0 < [5/2] 4/5 tStart=0 tEnd=0.140692452 < [1/19] 20/21 tStart=1 tEnd=0.220070773 F 5
378SkOpAngle::afterPart {{{3.125,3.375}, {2.25,4.25}, {1.5,5}, {1,6}}} id=4
379SkOpAngle::afterPart {{{3.125,3.375}, {3.2481059,3.2518941}, {3.37368599,3.12631386}, {3.50139236,2.99721503}}} id=5
380SkOpAngle::afterPart {{{3.125,3.375}, {2.44256193,4.05743807}, {1.83616005,4.66383975}, {2.31394291,4.42326832}}} id=1
381SkOpAngle::after [1/19] 20/21 tStart=1 tEnd=0.220070773 < [5/2] 4/5 tStart=0 tEnd=0.140692452 < [2/20] 4/5 tStart=0 tEnd=0.142857143 T 11
382SkOpAngle::afterPart {{{3.125,3.375}, {2.44256193,4.05743807}, {1.83616005,4.66383975}, {2.31394291,4.42326832}}} id=1
383SkOpAngle::afterPart {{{3.125,3.375}, {3.2481059,3.2518941}, {3.37368599,3.12631386}, {3.50139236,2.99721503}}} id=5
384SkOpAngle::afterPart {{{3.125,3.375}, {3.25,3.25}, {3.37755099,3.12244905}, {3.50145769,2.99708462}}} id=2
385SkOpSegment::sortAngles [5] tStart=0 [9]
386SkOpSegment::sortAngles [5] tStart=0.140692452 [15]
387SkOpAngle::after [5/3] 21/21 tStart=0.140692452 tEnd=0 < [3/29] 5/5 tStart=0.498607541 tEnd=0.498542274 < [5/4] 5/5 tStart=0.140692452 tEnd=0.142857143 T 11
388SkOpAngle::afterPart {{{3.50139236,2.99721503}, {3.37368599,3.12631386}, {3.2481059,3.2518941}, {3.125,3.375}}} id=5
389SkOpAngle::afterPart {{{3.50139236,2.99721503}, {3.50145769,2.99708462}}} id=3
390SkOpAngle::afterPart {{{3.50139236,2.99721503}, {3.50335725,2.99522872}, {3.5053228,2.9932416}, {3.50728869,2.99125361}}} id=5
391SkOpAngle::after [5/3] 21/21 tStart=0.140692452 tEnd=0 < [3/30] 21/21 tStart=0.498607541 tEnd=0.5 < [3/29] 5/5 tStart=0.498607541 tEnd=0.498542274 T 12
392SkOpAngle::afterPart {{{3.50139236,2.99721503}, {3.37368599,3.12631386}, {3.2481059,3.2518941}, {3.125,3.375}}} id=5
393SkOpAngle::afterPart {{{3.50139236,2.99721503}, {3.5,3}}} id=3
394SkOpAngle::afterPart {{{3.50139236,2.99721503}, {3.50145769,2.99708462}}} id=3
395SkOpSegment::sortAngles [5] tStart=0.142857143 [13]
396SkOpAngle::after [5/5] 21/21 tStart=0.142857143 tEnd=0.140692452 < [6/11] 5/5 tStart=0.498542274 tEnd=0.498468047 < [5/6] 5/5 tStart=0.142857143 tEnd=1 F 11
397SkOpAngle::afterPart {{{3.50728869,2.99125361}, {3.5053228,2.9932416}, {3.50335725,2.99522872}, {3.50139236,2.99721503}}} id=5
398SkOpAngle::afterPart {{{3.50728869,2.99125361}, {3.50765967,2.99080825}}} id=6
399SkOpAngle::afterPart {{{3.50728869,2.99125361}, {4.28571435,2.2040816}, {5.14285714,1.28571429}, {6,0}}} id=5
400SkOpAngle::after [5/5] 21/21 tStart=0.142857143 tEnd=0.140692452 < [6/12] 21/21 tStart=0.498542274 tEnd=0.5 < [5/6] 5/5 tStart=0.142857143 tEnd=1 T 12
401SkOpAngle::afterPart {{{3.50728869,2.99125361}, {3.5053228,2.9932416}, {3.50335725,2.99522872}, {3.50139236,2.99721503}}} id=5
402SkOpAngle::afterPart {{{3.50728869,2.99125361}, {3.5,3}}} id=6
403SkOpAngle::afterPart {{{3.50728869,2.99125361}, {4.28571435,2.2040816}, {5.14285714,1.28571429}, {6,0}}} id=5
404SkOpSegment::sortAngles [6] tStart=0.316647149 [21]
405SkOpAngle::after [6/7] 5/5 tStart=0.316647149 tEnd=0 < [2/25] 25/21 tStart=0.715768455 tEnd=0.145241853 < [6/8] 21/21 tStart=0.316647149 tEnd=0.498468047 F 11
406SkOpAngle::afterPart {{{4.41676426,1.89988291}, {6,0}}} id=6
407SkOpAngle::afterPart {{{4.41676426,1.89988291}, {4.43658858,2.02620596}, {4.00201137,2.49043886}, {3.50765967,2.99080825}}} id=2
408SkOpAngle::afterPart {{{4.41676426,1.89988291}, {3.50765967,2.99080825}}} id=6
409SkOpAngle::after [6/7] 5/5 tStart=0.316647149 tEnd=0 < [2/26] 9/17 tStart=0.715768455 tEnd=1 < [6/8] 21/21 tStart=0.316647149 tEnd=0.498468047 T 4
410SkOpAngle::afterPart {{{4.41676426,1.89988291}, {6,0}}} id=6
411SkOpAngle::afterPart {{{4.41676426,1.89988291}, {4.40688795,1.83694983}, {4.28423154,1.85788423}, {4,2}}} id=2
412SkOpAngle::afterPart {{{4.41676426,1.89988291}, {3.50765967,2.99080825}}} id=6
413SkOpSegment::sortAngles [6] tStart=0.498468047 [19]
414SkOpAngle::after [6/9] 5/5 tStart=0.498468047 tEnd=0.316647149 < [2/23] 21/21 tStart=0.145241853 tEnd=0.142857143 < [6/10] 21/21 tStart=0.498468047 tEnd=0.498542274 T 11
415SkOpAngle::afterPart {{{3.50765967,2.99080825}, {4.41676426,1.89988291}}} id=6
416SkOpAngle::afterPart {{{3.50765967,2.99080825}, {3.50559336,2.99289971}, {3.50352606,2.99499191}, {3.50145769,2.99708462}}} id=2
417SkOpAngle::afterPart {{{3.50765967,2.99080825}, {3.50728869,2.99125361}}} id=6
418SkOpAngle::after [6/9] 5/5 tStart=0.498468047 tEnd=0.316647149 < [2/24] 5/5 tStart=0.145241853 tEnd=0.715768455 < [2/23] 21/21 tStart=0.145241853 tEnd=0.142857143 F 12
419SkOpAngle::afterPart {{{3.50765967,2.99080825}, {4.41676426,1.89988291}}} id=6
420SkOpAngle::afterPart {{{3.50765967,2.99080825}, {4.00201137,2.49043886}, {4.43658858,2.02620596}, {4.41676426,1.89988291}}} id=2
421SkOpAngle::afterPart {{{3.50765967,2.99080825}, {3.50559336,2.99289971}, {3.50352606,2.99499191}, {3.50145769,2.99708462}}} id=2
422SkOpAngle::after [2/23] 21/21 tStart=0.145241853 tEnd=0.142857143 < [2/24] 5/5 tStart=0.145241853 tEnd=0.715768455 < [6/10] 21/21 tStart=0.498468047 tEnd=0.498542274 F 5
423SkOpAngle::afterPart {{{3.50765967,2.99080825}, {3.50559336,2.99289971}, {3.50352606,2.99499191}, {3.50145769,2.99708462}}} id=2
424SkOpAngle::afterPart {{{3.50765967,2.99080825}, {4.00201137,2.49043886}, {4.43658858,2.02620596}, {4.41676426,1.89988291}}} id=2
425SkOpAngle::afterPart {{{3.50765967,2.99080825}, {3.50728869,2.99125361}}} id=6
426SkOpAngle::after [6/10] 21/21 tStart=0.498468047 tEnd=0.498542274 < [2/24] 5/5 tStart=0.145241853 tEnd=0.715768455 < [6/9] 5/5 tStart=0.498468047 tEnd=0.316647149 T 11
427SkOpAngle::afterPart {{{3.50765967,2.99080825}, {3.50728869,2.99125361}}} id=6
428SkOpAngle::afterPart {{{3.50765967,2.99080825}, {4.00201137,2.49043886}, {4.43658858,2.02620596}, {4.41676426,1.89988291}}} id=2
429SkOpAngle::afterPart {{{3.50765967,2.99080825}, {4.41676426,1.89988291}}} id=6
430SkOpSegment::sortAngles [6] tStart=0.498542274 [14]
431SkOpSegment::sortAngles [6] tStart=0.5 [23]
432SkOpAngle::after [6/13] 5/5 tStart=0.5 tEnd=0.498542274 < [3/31] 5/5 tStart=0.5 tEnd=0.498607541 < [6/14] 21/21 tStart=0.5 tEnd=0.737211419 T 12
433SkOpAngle::afterPart {{{3.5,3}, {3.50728869,2.99125361}}} id=6
434SkOpAngle::afterPart {{{3.5,3}, {3.50139236,2.99721503}}} id=3
435SkOpAngle::afterPart {{{3.5,3}, {2.31394291,4.42326832}}} id=6
436SkOpAngle::after [6/13] 5/5 tStart=0.5 tEnd=0.498542274 < [3/32] 21/21 tStart=0.5 tEnd=1 < [3/31] 5/5 tStart=0.5 tEnd=0.498607541 F 5
437SkOpAngle::afterPart {{{3.5,3}, {3.50728869,2.99125361}}} id=6
438SkOpAngle::afterPart {{{3.5,3}, {3,4}}} id=3
439SkOpAngle::afterPart {{{3.5,3}, {3.50139236,2.99721503}}} id=3
440SkOpAngle::after [3/31] 5/5 tStart=0.5 tEnd=0.498607541 < [3/32] 21/21 tStart=0.5 tEnd=1 < [6/14] 21/21 tStart=0.5 tEnd=0.737211419 F 11
441SkOpAngle::afterPart {{{3.5,3}, {3.50139236,2.99721503}}} id=3
442SkOpAngle::afterPart {{{3.5,3}, {3,4}}} id=3
443SkOpAngle::afterPart {{{3.5,3}, {2.31394291,4.42326832}}} id=6
444SkOpAngle::after [6/14] 21/21 tStart=0.5 tEnd=0.737211419 < [3/32] 21/21 tStart=0.5 tEnd=1 < [6/13] 5/5 tStart=0.5 tEnd=0.498542274 T 12
445SkOpAngle::afterPart {{{3.5,3}, {2.31394291,4.42326832}}} id=6
446SkOpAngle::afterPart {{{3.5,3}, {3,4}}} id=3
447SkOpAngle::afterPart {{{3.5,3}, {3.50728869,2.99125361}}} id=6
448SkOpSegment::sortAngles [6] tStart=0.737211419 [17]
449SkOpAngle::after [6/15] 5/5 tStart=0.737211419 tEnd=0.5 < [1/17] 1/1 tStart=0.220070773 tEnd=0 < [6/16] 21/21 tStart=0.737211419 tEnd=1 F 4
450SkOpAngle::afterPart {{{2.31394291,4.42326832}, {3.5,3}}} id=6
451SkOpAngle::afterPart {{{2.31394291,4.42326832}, {2.44875776,4.35538685}, {2.66989384,4.22007077}, {3,4}}} id=1
452SkOpAngle::afterPart {{{2.31394291,4.42326832}, {1,6}}} id=6
453SkOpAngle::after [6/15] 5/5 tStart=0.737211419 tEnd=0.5 < [1/18] 17/5 tStart=0.220070773 tEnd=1 < [6/16] 21/21 tStart=0.737211419 tEnd=1 T 12
454SkOpAngle::afterPart {{{2.31394291,4.42326832}, {3.5,3}}} id=6
455SkOpAngle::afterPart {{{2.31394291,4.42326832}, {1.83616005,4.66383975}, {2.44256193,4.05743807}, {3.125,3.375}}} id=1
456SkOpAngle::afterPart {{{2.31394291,4.42326832}, {1,6}}} id=6
457SkOpSegment::sortAngles [1] tStart=0.220070773 [18]
caryclark2bec26a2016-05-26 09:01:47 -0700458SkOpSegment::sortAngles [1] tStart=1 [2]
caryclark55888e42016-07-18 10:01:36 -0700459SkOpSegment::sortAngles [2] tStart=0 [3]
460SkOpSegment::sortAngles [2] tStart=0.142857143 [25]
461SkOpAngle::after [2/21] 21/21 tStart=0.142857143 tEnd=0 < [3/27] 5/5 tStart=0.498542274 tEnd=0 < [2/22] 5/5 tStart=0.142857143 tEnd=0.145241853 F 11
462SkOpAngle::afterPart {{{3.50145769,2.99708462}, {3.37755099,3.12244905}, {3.25,3.25}, {3.125,3.375}}} id=2
463SkOpAngle::afterPart {{{3.50145769,2.99708462}, {4,2}}} id=3
464SkOpAngle::afterPart {{{3.50145769,2.99708462}, {3.50352606,2.99499191}, {3.50559336,2.99289971}, {3.50765967,2.99080825}}} id=2
465SkOpAngle::after [2/21] 21/21 tStart=0.142857143 tEnd=0 < [3/28] 21/21 tStart=0.498542274 tEnd=0.498607541 < [2/22] 5/5 tStart=0.142857143 tEnd=0.145241853 T 12
466SkOpAngle::afterPart {{{3.50145769,2.99708462}, {3.37755099,3.12244905}, {3.25,3.25}, {3.125,3.375}}} id=2
467SkOpAngle::afterPart {{{3.50145769,2.99708462}, {3.50139236,2.99721503}}} id=3
468SkOpAngle::afterPart {{{3.50145769,2.99708462}, {3.50352606,2.99499191}, {3.50559336,2.99289971}, {3.50765967,2.99080825}}} id=2
469SkOpSegment::sortAngles [2] tStart=0.145241853 [20]
470SkOpSegment::sortAngles [2] tStart=0.715768455 [22]
471SkOpSegment::sortAngles [3] tStart=0.498542274 [26]
472SkOpSegment::sortAngles [3] tStart=0.498607541 [16]
473SkOpSegment::sortAngles [3] tStart=0.5 [24]
474SkOpSegment::debugShowActiveSpans id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 tEnd=1 windSum=? windValue=1
475SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
476SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
477SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
478SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
479SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
480SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
481SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
482SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=? windValue=1
483SkOpSegment::debugShowActiveSpans id=6 (2.31394291,4.42326832 1,6) t=0.737211419 tEnd=1 windSum=? windValue=1
484SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=? windValue=1
485SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=? windValue=1
486SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
487SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
488SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
489SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
490SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
491SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
492SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
493SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=? windValue=1
494SkOpSpan::sortableTop dir=kLeft seg=4 t=0.5 pt=(1.921875,4.640625)
495SkOpSpan::sortableTop [0] valid=1 operand=1 span=7 ccw=1 seg=4 {{{1, 6}, {1.5f, 5}, {2.25f, 4.25f}, {3.125f, 3.375f}}} t=0.5 pt=(1.921875,4.640625) slope=(2.15625,-2.53125)
496SkOpSegment::markWinding id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 [7] (1,6) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
497SkOpSegment::markWinding id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 [7] (1,6) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
498SkOpSegment::markWinding id=6 (6,0 1,6) t=0.737211419 [17] (2.31394291,4.42326832) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
499SkOpSegment::activeOp id=4 t=1 tEnd=0 op=diff miFrom=0 miTo=0 suFrom=0 suTo=1 result=0
500SkOpSegment::markDone id=4 (1,6 1.5,5 2.25,4.25 3.125,3.375) t=0 [7] (1,6) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
501SkOpSegment::markDone id=6 (6,0 1,6) t=0.737211419 [17] (2.31394291,4.42326832) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
502bridgeOp chase.append id=6 windSum=-1
503SkOpSegment::markWinding id=1 (3,4 1.5,5 2.25,4.25 3.125,3.375) t=0 [1] (3,4) tEnd=0.220070773 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
504SkOpSegment::markWinding id=3 (4,2 3,4) t=0.5 [24] (3.5,3) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
505SkOpSegment::markAngle last segment=3 span=24 windSum=-1
506SkOpSegment::markWinding id=6 (6,0 1,6) t=0.5 [23] (3.5,3) tEnd=0.737211419 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=0
507SkOpSegment::markAngle last segment=6 span=23 windSum=-1
508SkOpSegment::markWinding id=1 (3,4 1.5,5 2.25,4.25 3.125,3.375) t=0.220070773 [18] (2.31394291,4.42326832) tEnd=1 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=0
509SkOpSegment::markAngle last segment=1 span=2
510SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=? windValue=1
511SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=? windValue=1
512SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
513SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
514SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
515SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
516SkOpSegment::debugShowActiveSpans id=6 (3.50728869,2.99125361 3.5,3) t=0.498542274 tEnd=0.5 windSum=? windValue=1
517SkOpSegment::debugShowActiveSpans id=6 (3.5,3 2.31394291,4.42326832) t=0.5 tEnd=0.737211419 windSum=-1 oppSum=-1 windValue=1 oppValue=0
518SkOpSegment::debugShowActiveSpans id=1 (3,4 2.66989384,4.22007077 2.44875776,4.35538685 2.31394291,4.42326832) t=0 tEnd=0.220070773 windSum=-1 oppSum=0 windValue=1 oppValue=0
519SkOpSegment::debugShowActiveSpans id=1 (2.31394291,4.42326832 1.83616005,4.66383975 2.44256193,4.05743807 3.125,3.375) t=0.220070773 tEnd=1 windSum=-1 oppSum=-1 windValue=1 oppValue=0
520SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
521SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
522SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
523SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
524SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
525SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=? windValue=1
526SkOpSegment::debugShowActiveSpans id=3 (3.50139236,2.99721503 3.5,3) t=0.498607541 tEnd=0.5 windSum=? windValue=1
527SkOpSegment::debugShowActiveSpans id=3 (3.5,3 3,4) t=0.5 tEnd=1 windSum=-1 oppSum=0 windValue=1 oppValue=0
528SkOpSegment::activeOp id=1 t=0.220070773 tEnd=0 op=diff miFrom=0 miTo=1 suFrom=0 suTo=0 result=1
529SkOpSegment::findNextOp simple
530SkOpSegment::markDone id=1 (3,4 1.5,5 2.25,4.25 3.125,3.375) t=0 [1] (3,4) tEnd=0.220070773 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
531bridgeOp current id=1 from=(2.31394291,4.42326832) to=(3,4)
532path.moveTo(2.31394291,4.42326832);
533path.cubicTo(2.44875765,4.35538673, 2.66989374,4.22007084, 3,4);
534SkOpSegment::markWinding id=6 (6,0 1,6) t=0.498542274 [14] (3.50728869,2.99125361) tEnd=0.5 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
535SkOpSegment::markAngle last segment=6 span=14 windSum=-1
536SkOpSegment::markWinding id=3 (4,2 3,4) t=0.498607541 [16] (3.50139236,2.99721503) tEnd=0.5 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=0
537SkOpSegment::markAngle last segment=3 span=16 windSum=-1
538SkOpSegment::findNextOp
539SkOpAngle::dumpOne [3/32] next=6/13 sect=21/21 s=0.5 [24] e=1 [6] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=0
540SkOpAngle::dumpOne [6/13] next=3/31 sect=5/5 s=0.5 [23] e=0.498542274 [14] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=0 operand
541SkOpAngle::dumpOne [3/31] next=6/14 sect=5/5 s=0.5 [24] e=0.498607541 [16] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=-1
542SkOpAngle::dumpOne [6/14] next=3/32 sect=21/21 s=0.5 [23] e=0.737211419 [17] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=-1 operand
543SkOpSegment::activeOp id=6 t=0.5 tEnd=0.498542274 op=diff miFrom=0 miTo=0 suFrom=0 suTo=1 result=0
544SkOpSegment::markDone id=6 (6,0 1,6) t=0.498542274 [14] (3.50728869,2.99125361) tEnd=0.5 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
545SkOpSegment::findNextOp chase.append segment=6 span=14 windSum=-1
546SkOpSegment::activeOp id=3 t=0.5 tEnd=0.498607541 op=diff miFrom=0 miTo=1 suFrom=1 suTo=1 result=0
547SkOpSegment::markDone id=3 (4,2 3,4) t=0.498607541 [16] (3.50139236,2.99721503) tEnd=0.5 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=0
548SkOpSegment::findNextOp chase.append segment=3 span=16 windSum=-1
549SkOpSegment::activeOp id=6 t=0.5 tEnd=0.737211419 op=diff miFrom=1 miTo=1 suFrom=1 suTo=0 result=1
550SkOpSegment::markDone id=3 (4,2 3,4) t=0.5 [24] (3.5,3) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
551SkOpSegment::findNextOp from:[3] to:[6] start=19488848 end=19488176
552bridgeOp current id=3 from=(3,4) to=(3.5,3)
553SkOpSegment::findNextOp
554SkOpAngle::dumpOne [6/15] next=1/18 sect=5/5 s=0.737211419 [17] e=0.5 [23] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=-1 operand
555SkOpAngle::dumpOne [1/18] next=6/16 sect=17/5 s=0.220070773 [18] e=1 [2] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=-1
556SkOpAngle::dumpOne [6/16] next=1/17 sect=21/21 s=0.737211419 [17] e=1 [12] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=0 done operand
557SkOpAngle::dumpOne [1/17] next=6/15 sect=1/1 s=0.220070773 [18] e=0 [1] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=0 done
558SkOpSegment::activeOp id=1 t=0.220070773 tEnd=1 op=diff miFrom=1 miTo=0 suFrom=1 suTo=1 result=0
559SkOpSegment::markDone id=1 (3,4 1.5,5 2.25,4.25 3.125,3.375) t=0.220070773 [18] (2.31394291,4.42326832) tEnd=1 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=0
560SkOpSegment::activeOp id=6 t=0.737211419 tEnd=1 op=diff miFrom=0 miTo=0 suFrom=1 suTo=0 result=0
561SkOpSegment::activeOp id=1 t=0.220070773 tEnd=0 op=diff miFrom=0 miTo=1 suFrom=0 suTo=0 result=1
562SkOpSegment::markDone id=6 (6,0 1,6) t=0.5 [23] (3.5,3) tEnd=0.737211419 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=0
563SkOpSegment::findNextOp from:[6] to:[1] start=19488288 end=123925160
564bridgeOp current id=6 from=(3.5,3) to=(2.31394291,4.42326832)
565path.lineTo(3.5,3);
566path.lineTo(2.31394291,4.42326832);
caryclark2bec26a2016-05-26 09:01:47 -0700567path.close();
caryclark55888e42016-07-18 10:01:36 -0700568SkOpSegment::markWinding id=3 (4,2 3,4) t=0.498542274 [26] (3.50145769,2.99708462) tEnd=0.498607541 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=0
569SkOpSegment::markAngle last segment=3 span=26 windSum=-1
570SkOpSegment::markWinding id=5 (3.125,3.375 4,2.5 5,1.5 6,0) t=0.140692452 [15] (3.50139236,2.99721503) tEnd=0.142857143 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=0
571SkOpSegment::markAngle last segment=5 span=13 windSum=?
572SkOpSegment::markWinding id=5 (3.125,3.375 4,2.5 5,1.5 6,0) t=0 [9] (3.125,3.375) tEnd=0.140692452 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=0
573SkOpSegment::markAngle last segment=5 span=9 windSum=-1
574SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=-1 oppSum=-1 windValue=1 oppValue=0
575SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=-1 oppSum=-1 windValue=1 oppValue=0
576SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
577SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
578SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
579SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
580SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=? windValue=1
581SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=? windValue=1
582SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
583SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=? windValue=1
584SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=? windValue=1
585SkOpSegment::debugShowActiveSpans id=3 (3.50145769,2.99708462 3.50139236,2.99721503) t=0.498542274 tEnd=0.498607541 windSum=-1 oppSum=-1 windValue=1 oppValue=0
586SkOpSegment::activeOp id=3 t=0.498607541 tEnd=0.498542274 op=diff miFrom=0 miTo=1 suFrom=1 suTo=1 result=0
587SkOpSegment::markDone id=3 (4,2 3,4) t=0.498542274 [26] (3.50145769,2.99708462) tEnd=0.498607541 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=0
588bridgeOp chase.append id=3 windSum=-1
589SkOpSegment::markWinding id=2 (3.125,3.375 4,2.5 5,1.5 4,2) t=0.142857143 [25] (3.50145769,2.99708462) tEnd=0.145241853 newWindSum=1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=0
590SkOpSegment::markAngle last segment=2 span=20 windSum=?
591SkOpSegment::markWinding id=3 (4,2 3,4) t=0 [5] (4,2) tEnd=0.498542274 newWindSum=1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=0
592SkOpSegment::markWinding id=2 (3.125,3.375 4,2.5 5,1.5 4,2) t=0.715768455 [22] (4.41676426,1.89988291) tEnd=1 newWindSum=1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=0
593SkOpSegment::markAngle last segment=2 span=22 windSum=1
594SkOpSegment::markWinding id=2 (3.125,3.375 4,2.5 5,1.5 4,2) t=0 [3] (3.125,3.375) tEnd=0.142857143 newWindSum=-1 newOppSum=-1 oppSum=? windSum=? windValue=1 oppValue=0
595SkOpSegment::markAngle last segment=2 span=3 windSum=-1
596SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=-1 oppSum=-1 windValue=1 oppValue=0
597SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=-1 oppSum=-1 windValue=1 oppValue=0
598SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
599SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
600SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=? windValue=1
601SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=? windValue=1
602SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=-1 oppSum=-1 windValue=1 oppValue=0
603SkOpSegment::debugShowActiveSpans id=2 (3.50145769,2.99708462 3.50352606,2.99499191 3.50559336,2.99289971 3.50765967,2.99080825) t=0.142857143 tEnd=0.145241853 windSum=1 oppSum=-1 windValue=1 oppValue=0
604SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=? windValue=1
605SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=1 oppSum=-1 windValue=1 oppValue=0
606SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=1 oppSum=-1 windValue=1 oppValue=0
607SkOpSegment::activeOp id=2 t=0.142857143 tEnd=0.145241853 op=diff miFrom=0 miTo=1 suFrom=1 suTo=1 result=0
608SkOpSegment::markDone id=2 (3.125,3.375 4,2.5 5,1.5 4,2) t=0.142857143 [25] (3.50145769,2.99708462) tEnd=0.145241853 newWindSum=1 newOppSum=-1 oppSum=-1 windSum=1 windValue=1 oppValue=0
609bridgeOp chase.append id=2 windSum=-2147483647
610SkOpSegment::markWinding id=6 (6,0 1,6) t=0.498468047 [19] (3.50765967,2.99080825) tEnd=0.498542274 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
611SkOpSegment::markAngle last segment=6 span=14 windSum=-1
612SkOpSegment::markWinding id=2 (3.125,3.375 4,2.5 5,1.5 4,2) t=0.145241853 [20] (3.50765967,2.99080825) tEnd=0.715768455 newWindSum=1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
613SkOpSegment::markAngle last segment=2 span=22 windSum=1
614SkOpSegment::markWinding id=6 (6,0 1,6) t=0.316647149 [21] (4.41676426,1.89988291) tEnd=0.498468047 newWindSum=-1 newOppSum=1 oppSum=? windSum=? windValue=1 oppValue=0
615SkOpSegment::markAngle last segment=6 span=21 windSum=-1
616SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=-1 oppSum=-1 windValue=1 oppValue=0
617SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=-1 oppSum=-1 windValue=1 oppValue=0
618SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
619SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
620SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=-1 oppSum=1 windValue=1 oppValue=0
621SkOpSegment::debugShowActiveSpans id=6 (3.50765967,2.99080825 3.50728869,2.99125361) t=0.498468047 tEnd=0.498542274 windSum=-1 oppSum=0 windValue=1 oppValue=0
622SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=-1 oppSum=-1 windValue=1 oppValue=0
623SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=1 oppSum=0 windValue=1 oppValue=0
624SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=1 oppSum=-1 windValue=1 oppValue=0
625SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=1 oppSum=-1 windValue=1 oppValue=0
626SkOpSegment::activeOp id=6 t=0.498468047 tEnd=0.498542274 op=diff miFrom=0 miTo=0 suFrom=1 suTo=0 result=0
627SkOpSegment::markDone id=6 (6,0 1,6) t=0.498468047 [19] (3.50765967,2.99080825) tEnd=0.498542274 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
628SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=-1 oppSum=-1 windValue=1 oppValue=0
629SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=-1 oppSum=-1 windValue=1 oppValue=0
630SkOpSegment::debugShowActiveSpans id=5 (3.50728869,2.99125361 4.28571435,2.2040816 5.14285714,1.28571429 6,0) t=0.142857143 tEnd=1 windSum=? windValue=1
631SkOpSegment::debugShowActiveSpans id=6 (6,0 4.41676426,1.89988291) t=0 tEnd=0.316647149 windSum=? windValue=1
632SkOpSegment::debugShowActiveSpans id=6 (4.41676426,1.89988291 3.50765967,2.99080825) t=0.316647149 tEnd=0.498468047 windSum=-1 oppSum=1 windValue=1 oppValue=0
633SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=-1 oppSum=-1 windValue=1 oppValue=0
634SkOpSegment::debugShowActiveSpans id=2 (3.50765967,2.99080825 4.00201137,2.49043886 4.43658858,2.02620596 4.41676426,1.89988291) t=0.145241853 tEnd=0.715768455 windSum=1 oppSum=0 windValue=1 oppValue=0
635SkOpSegment::debugShowActiveSpans id=2 (4.41676426,1.89988291 4.40688795,1.83694983 4.28423154,1.85788423 4,2) t=0.715768455 tEnd=1 windSum=1 oppSum=-1 windValue=1 oppValue=0
636SkOpSegment::debugShowActiveSpans id=3 (4,2 3.50145769,2.99708462) t=0 tEnd=0.498542274 windSum=1 oppSum=-1 windValue=1 oppValue=0
637SkOpSegment::activeOp id=6 t=0.498468047 tEnd=0.316647149 op=diff miFrom=1 miTo=1 suFrom=0 suTo=1 result=1
638SkOpSegment::markWinding id=6 (6,0 1,6) t=0 [11] (6,0) tEnd=0.316647149 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
639SkOpSegment::markWinding id=5 (3.125,3.375 4,2.5 5,1.5 6,0) t=0.142857143 [13] (3.50728869,2.99125361) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
640SkOpSegment::markAngle last segment=5 span=13 windSum=-1
641SkOpSegment::findNextOp
642SkOpAngle::dumpOne [6/8] next=2/25 sect=21/21 s=0.316647149 [21] e=0.498468047 [19] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=1 operand
643SkOpAngle::dumpOne [2/25] next=6/7 sect=25/21 s=0.715768455 [22] e=0.145241853 [20] sgn=1 windVal=1 windSum=1 oppVal=0 oppSum=0
644SkOpAngle::dumpOne [6/7] next=2/26 sect=5/5 s=0.316647149 [21] e=0 [11] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=0 operand
645SkOpAngle::dumpOne [2/26] next=6/8 sect=9/17 s=0.715768455 [22] e=1 [4] sgn=-1 windVal=1 windSum=1 oppVal=0 oppSum=-1
646SkOpSegment::activeOp id=2 t=0.715768455 tEnd=0.145241853 op=diff miFrom=1 miTo=0 suFrom=0 suTo=0 result=1
647SkOpSegment::activeOp id=6 t=0.316647149 tEnd=0 op=diff miFrom=0 miTo=0 suFrom=0 suTo=1 result=0
648SkOpSegment::markDone id=6 (6,0 1,6) t=0 [11] (6,0) tEnd=0.316647149 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
649SkOpSegment::markDone id=5 (3.125,3.375 4,2.5 5,1.5 6,0) t=0.142857143 [13] (3.50728869,2.99125361) tEnd=1 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
650SkOpSegment::findNextOp chase.append segment=5 span=13 windSum=-1
651SkOpSegment::activeOp id=2 t=0.715768455 tEnd=1 op=diff miFrom=0 miTo=1 suFrom=1 suTo=1 result=0
652SkOpSegment::markDone id=2 (3.125,3.375 4,2.5 5,1.5 4,2) t=0.715768455 [22] (4.41676426,1.89988291) tEnd=1 newWindSum=1 newOppSum=-1 oppSum=-1 windSum=1 windValue=1 oppValue=0
653SkOpSegment::markDone id=3 (4,2 3,4) t=0 [5] (4,2) tEnd=0.498542274 newWindSum=1 newOppSum=-1 oppSum=-1 windSum=1 windValue=1 oppValue=0
654SkOpSegment::markDone id=6 (6,0 1,6) t=0.316647149 [21] (4.41676426,1.89988291) tEnd=0.498468047 newWindSum=-1 newOppSum=1 oppSum=1 windSum=-1 windValue=1 oppValue=0
655SkOpSegment::findNextOp from:[6] to:[2] start=19488736 end=19488512
656bridgeOp current id=6 from=(3.50765967,2.99080825) to=(4.41676426,1.89988291)
657SkOpSegment::findNextOp
658SkOpAngle::dumpOne [2/24] next=6/9 sect=5/5 s=0.145241853 [20] e=0.715768455 [22] sgn=-1 windVal=1 windSum=1 oppVal=0 oppSum=0
659SkOpAngle::dumpOne [6/9] next=2/23 sect=5/5 s=0.498468047 [19] e=0.316647149 [21] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=1 done operand
660SkOpAngle::dumpOne [2/23] next=6/10 sect=21/21 s=0.145241853 [20] e=0.142857143 [25] sgn=1 windVal=1 windSum=1 oppVal=0 oppSum=-1 done
661SkOpAngle::dumpOne [6/10] next=2/24 sect=21/21 s=0.498468047 [19] e=0.498542274 [14] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=0 done operand
662SkOpSegment::activeOp id=6 t=0.498468047 tEnd=0.316647149 op=diff miFrom=1 miTo=1 suFrom=0 suTo=1 result=1
663SkOpSegment::activeOp id=2 t=0.145241853 tEnd=0.142857143 op=diff miFrom=1 miTo=0 suFrom=1 suTo=1 result=0
664SkOpSegment::activeOp id=6 t=0.498468047 tEnd=0.498542274 op=diff miFrom=0 miTo=0 suFrom=1 suTo=0 result=0
665SkOpSegment::markDone id=2 (3.125,3.375 4,2.5 5,1.5 4,2) t=0.145241853 [20] (3.50765967,2.99080825) tEnd=0.715768455 newWindSum=1 newOppSum=0 oppSum=0 windSum=1 windValue=1 oppValue=0
666SkOpSegment::findNextOp from:[2] to:[6] start=19488400 end=19488624
667bridgeOp current id=2 from=(4.41676426,1.89988291) to=(3.50765967,2.99080825)
668path.moveTo(3.50765967,2.99080825);
669path.lineTo(4.41676426,1.89988291);
670path.cubicTo(4.43658876,2.02620602, 4.0020113,2.49043894, 3.50765967,2.99080825);
caryclark2bec26a2016-05-26 09:01:47 -0700671path.close();
caryclark55888e42016-07-18 10:01:36 -0700672SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=-1 oppSum=-1 windValue=1 oppValue=0
673SkOpSegment::debugShowActiveSpans id=5 (3.50139236,2.99721503 3.50335725,2.99522872 3.5053228,2.9932416 3.50728869,2.99125361) t=0.140692452 tEnd=0.142857143 windSum=-1 oppSum=-1 windValue=1 oppValue=0
674SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=-1 oppSum=-1 windValue=1 oppValue=0
675SkOpSegment::activeOp id=5 t=0.142857143 tEnd=0.140692452 op=diff miFrom=1 miTo=1 suFrom=0 suTo=1 result=1
676SkOpSegment::markDone id=5 (3.125,3.375 4,2.5 5,1.5 6,0) t=0.140692452 [15] (3.50139236,2.99721503) tEnd=0.142857143 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=0
677SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=-1 oppSum=-1 windValue=1 oppValue=0
678SkOpSegment::debugShowActiveSpans id=2 (3.125,3.375 3.25,3.25 3.37755099,3.12244905 3.50145769,2.99708462) t=0 tEnd=0.142857143 windSum=-1 oppSum=-1 windValue=1 oppValue=0
679SkOpSegment::activeOp id=2 t=0.142857143 tEnd=0 op=diff miFrom=0 miTo=1 suFrom=1 suTo=1 result=0
680SkOpSegment::markDone id=2 (3.125,3.375 4,2.5 5,1.5 4,2) t=0 [3] (3.125,3.375) tEnd=0.142857143 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=0
681bridgeOp chase.append id=2 windSum=-1
682SkOpSegment::debugShowActiveSpans id=5 (3.125,3.375 3.2481059,3.2518941 3.37368599,3.12631386 3.50139236,2.99721503) t=0 tEnd=0.140692452 windSum=-1 oppSum=-1 windValue=1 oppValue=0
683SkOpSegment::activeOp id=5 t=0.140692452 tEnd=0 op=diff miFrom=1 miTo=1 suFrom=0 suTo=1 result=1
684SkOpSegment::findNextOp
685SkOpAngle::dumpOne [5/2] next=2/20 sect=4/5 s=0 [9] e=0.140692452 [15] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=-1 operand
686SkOpAngle::dumpOne [2/20] next=4/1 sect=4/5 s=0 [3] e=0.142857143 [25] sgn=-1 windVal=1 windSum=-1 oppVal=0 oppSum=-1 done
687SkOpAngle::dumpOne [4/1] next=1/19 sect=20/21 s=1 [8] e=0 [7] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=0 done operand
688SkOpAngle::dumpOne [1/19] next=5/2 sect=20/21 s=1 [2] e=0.220070773 [18] sgn=1 windVal=1 windSum=-1 oppVal=0 oppSum=-1 done
689SkOpSegment::activeOp id=2 t=0 tEnd=0.142857143 op=diff miFrom=1 miTo=0 suFrom=0 suTo=0 result=1
690SkOpSegment::activeOp id=4 t=1 tEnd=0 op=diff miFrom=0 miTo=0 suFrom=0 suTo=1 result=0
691SkOpSegment::activeOp id=1 t=1 tEnd=0.220070773 op=diff miFrom=0 miTo=1 suFrom=1 suTo=1 result=0
692SkOpSegment::markDone id=5 (3.125,3.375 4,2.5 5,1.5 6,0) t=0 [9] (3.125,3.375) tEnd=0.140692452 newWindSum=-1 newOppSum=-1 oppSum=-1 windSum=-1 windValue=1 oppValue=0
693SkOpSegment::findNextOp from:[5] to:[2] start=19486400 end=19489072
694bridgeOp current id=5 from=(3.50139236,2.99721503) to=(3.125,3.375)
695path.moveTo(3.50139236,2.99721503);
696path.cubicTo(3.37368608,3.12631392, 3.248106,3.251894, 3.125,3.375);
caryclarkdac1d172014-06-17 05:15:38 -0700697</div>
caryclark26ad22a2015-10-16 09:03:38 -0700698
caryclarkdac1d172014-06-17 05:15:38 -0700699</div>
700
701<script type="text/javascript">
702
caryclark55888e42016-07-18 10:01:36 -0700703 var testDivs = [
704 cubics_d3,
caryclarkdac1d172014-06-17 05:15:38 -0700705];
706
707var decimal_places = 3; // make this 3 to show more precision
708
709var tests = [];
710var testLines = [];
711var testTitles = [];
712var testIndex = 0;
713var ctx;
714
715var xmin, xmax, focusXmin, focusXmax;
716var ymin, ymax, focusYmin, focusYmax;
717var scale;
718var mouseX, mouseY;
719var srcLeft, srcTop;
720var screenWidth, screenHeight;
caryclark1049f122015-04-20 08:31:59 -0700721var drawnPts, drawnLines, drawnQuads, drawnConics, drawnCubics;
caryclarkdac1d172014-06-17 05:15:38 -0700722var curveT = 0;
723
724var pt_labels = 2;
725var collect_bounds = false;
726var control_lines = 0;
727var curve_t = false;
728var debug_xy = 1;
729var focus_enabled = false;
730var focus_on_selection = false;
731var step_limit = 0;
732var draw_active = false;
733var draw_add = false;
734var draw_angle = 0;
caryclark624637c2015-05-11 07:21:27 -0700735var draw_coincidence = false;
caryclarkdac1d172014-06-17 05:15:38 -0700736var draw_deriviatives = 0;
737var draw_hints = false;
caryclarkdac1d172014-06-17 05:15:38 -0700738var draw_id = false;
739var draw_intersection = 0;
740var draw_intersectT = false;
741var draw_legend = true;
742var draw_log = false;
743var draw_mark = false;
744var draw_midpoint = false;
745var draw_op = 0;
746var draw_sequence = false;
747var draw_sort = 0;
caryclark03b03ca2015-04-23 09:13:37 -0700748var draw_top = false;
caryclarkdac1d172014-06-17 05:15:38 -0700749var draw_path = 3;
750var draw_computed = 0;
751var retina_scale = !!window.devicePixelRatio;
752
753var activeCount = 0;
754var addCount = 0;
755var angleCount = 0;
caryclark624637c2015-05-11 07:21:27 -0700756var coinCount = 0;
caryclarkdac1d172014-06-17 05:15:38 -0700757var opCount = 0;
758var sectCount = 0;
759var sortCount = 0;
caryclark03b03ca2015-04-23 09:13:37 -0700760var topCount = 0;
caryclarkdac1d172014-06-17 05:15:38 -0700761var markCount = 0;
762var activeMax = 0;
763var addMax = 0;
764var angleMax = 0;
caryclark624637c2015-05-11 07:21:27 -0700765var coinMax = 0;
caryclarkdac1d172014-06-17 05:15:38 -0700766var sectMax = 0;
767var sectMax2 = 0;
768var sortMax = 0;
caryclark03b03ca2015-04-23 09:13:37 -0700769var topMax = 0;
caryclarkdac1d172014-06-17 05:15:38 -0700770var markMax = 0;
771var opMax = 0;
772var stepMax = 0;
773var lastIndex = 0;
774var hasPath = false;
caryclark26ad22a2015-10-16 09:03:38 -0700775var hasAlignedPath = false;
caryclarkdac1d172014-06-17 05:15:38 -0700776var hasComputedPath = false;
caryclark54359292015-03-26 07:52:43 -0700777var angleBetween = false;
778var afterIndex = 0;
caryclarkdac1d172014-06-17 05:15:38 -0700779
780var firstActiveSpan = -1;
781var logStart = -1;
782var logRange = 0;
783
784var SPAN_ID = 0;
785var SPAN_X1 = SPAN_ID + 1;
786var SPAN_Y1 = SPAN_X1 + 1;
787var SPAN_X2 = SPAN_Y1 + 1;
788var SPAN_Y2 = SPAN_X2 + 1;
caryclark1049f122015-04-20 08:31:59 -0700789
caryclark55888e42016-07-18 10:01:36 -0700790var SPAN_L_TX = SPAN_Y2 + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700791var SPAN_L_TY = SPAN_L_TX + 1;
caryclark55888e42016-07-18 10:01:36 -0700792var SPAN_L_OTHER = SPAN_L_TY + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700793var SPAN_L_OTHERT = SPAN_L_OTHER + 1;
794var SPAN_L_OTHERI = SPAN_L_OTHERT + 1;
795var SPAN_L_SUM = SPAN_L_OTHERI + 1;
796var SPAN_L_VAL = SPAN_L_SUM + 1;
797var SPAN_L_OPP = SPAN_L_VAL + 1;
798
799var SPAN_X3 = SPAN_Y2 + 1;
800var SPAN_Y3 = SPAN_X3 + 1;
caryclark1049f122015-04-20 08:31:59 -0700801
caryclark55888e42016-07-18 10:01:36 -0700802var SPAN_Q_TX = SPAN_Y3 + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700803var SPAN_Q_TY = SPAN_Q_TX + 1;
caryclark55888e42016-07-18 10:01:36 -0700804var SPAN_Q_OTHER = SPAN_Q_TY + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700805var SPAN_Q_OTHERT = SPAN_Q_OTHER + 1;
806var SPAN_Q_OTHERI = SPAN_Q_OTHERT + 1;
807var SPAN_Q_SUM = SPAN_Q_OTHERI + 1;
808var SPAN_Q_VAL = SPAN_Q_SUM + 1;
809var SPAN_Q_OPP = SPAN_Q_VAL + 1;
810
caryclark1049f122015-04-20 08:31:59 -0700811var SPAN_K_W = SPAN_Y3 + 1;
caryclark55888e42016-07-18 10:01:36 -0700812var SPAN_K_TX = SPAN_K_W + 1;
caryclark1049f122015-04-20 08:31:59 -0700813var SPAN_K_TY = SPAN_K_TX + 1;
caryclark55888e42016-07-18 10:01:36 -0700814var SPAN_K_OTHER = SPAN_K_TY + 1;
caryclark1049f122015-04-20 08:31:59 -0700815var SPAN_K_OTHERT = SPAN_K_OTHER + 1;
816var SPAN_K_OTHERI = SPAN_K_OTHERT + 1;
817var SPAN_K_SUM = SPAN_K_OTHERI + 1;
818var SPAN_K_VAL = SPAN_K_SUM + 1;
819var SPAN_K_OPP = SPAN_K_VAL + 1;
820
caryclarkdac1d172014-06-17 05:15:38 -0700821var SPAN_X4 = SPAN_Y3 + 1;
822var SPAN_Y4 = SPAN_X4 + 1;
caryclark1049f122015-04-20 08:31:59 -0700823
caryclark55888e42016-07-18 10:01:36 -0700824var SPAN_C_TX = SPAN_Y4 + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700825var SPAN_C_TY = SPAN_C_TX + 1;
caryclark55888e42016-07-18 10:01:36 -0700826var SPAN_C_OTHER = SPAN_C_TY + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700827var SPAN_C_OTHERT = SPAN_C_OTHER + 1;
828var SPAN_C_OTHERI = SPAN_C_OTHERT + 1;
829var SPAN_C_SUM = SPAN_C_OTHERI + 1;
830var SPAN_C_VAL = SPAN_C_SUM + 1;
831var SPAN_C_OPP = SPAN_C_VAL + 1;
832
833var ACTIVE_LINE_SPAN = 1;
834var ACTIVE_QUAD_SPAN = ACTIVE_LINE_SPAN + 1;
caryclark1049f122015-04-20 08:31:59 -0700835var ACTIVE_CONIC_SPAN = ACTIVE_QUAD_SPAN + 1;
836var ACTIVE_CUBIC_SPAN = ACTIVE_CONIC_SPAN + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700837
838var ADD_MOVETO = ACTIVE_CUBIC_SPAN + 1;
839var ADD_LINETO = ADD_MOVETO + 1;
840var ADD_QUADTO = ADD_LINETO + 1;
caryclark1049f122015-04-20 08:31:59 -0700841var ADD_CONICTO = ADD_QUADTO + 1;
842var ADD_CUBICTO = ADD_CONICTO + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700843var ADD_CLOSE = ADD_CUBICTO + 1;
844var ADD_FILL = ADD_CLOSE + 1;
845
846var PATH_LINE = ADD_FILL + 1;
847var PATH_QUAD = PATH_LINE + 1;
caryclark1049f122015-04-20 08:31:59 -0700848var PATH_CONIC = PATH_QUAD + 1;
849var PATH_CUBIC = PATH_CONIC + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700850
851var INTERSECT_LINE = PATH_CUBIC + 1;
852var INTERSECT_LINE_2 = INTERSECT_LINE + 1;
853var INTERSECT_LINE_NO = INTERSECT_LINE_2 + 1;
854var INTERSECT_QUAD_LINE = INTERSECT_LINE_NO + 1;
855var INTERSECT_QUAD_LINE_2 = INTERSECT_QUAD_LINE + 1;
856var INTERSECT_QUAD_LINE_NO = INTERSECT_QUAD_LINE_2 + 1;
857var INTERSECT_QUAD = INTERSECT_QUAD_LINE_NO + 1;
858var INTERSECT_QUAD_2 = INTERSECT_QUAD + 1;
859var INTERSECT_QUAD_NO = INTERSECT_QUAD_2 + 1;
caryclark1049f122015-04-20 08:31:59 -0700860var INTERSECT_CONIC_LINE = INTERSECT_QUAD_NO + 1;
861var INTERSECT_CONIC_LINE_2 = INTERSECT_CONIC_LINE + 1;
862var INTERSECT_CONIC_LINE_NO = INTERSECT_CONIC_LINE_2 + 1;
caryclark55888e42016-07-18 10:01:36 -0700863var INTERSECT_CONIC_QUAD = INTERSECT_CONIC_LINE_NO + 1;
864var INTERSECT_CONIC_QUAD_2 = INTERSECT_CONIC_QUAD + 1;
865var INTERSECT_CONIC_QUAD_NO = INTERSECT_CONIC_QUAD_2 + 1;
866var INTERSECT_CONIC = INTERSECT_CONIC_QUAD_NO + 1;
caryclark1049f122015-04-20 08:31:59 -0700867var INTERSECT_CONIC_2 = INTERSECT_CONIC + 1;
868var INTERSECT_CONIC_NO = INTERSECT_CONIC_2 + 1;
869var INTERSECT_SELF_CUBIC = INTERSECT_CONIC_NO + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700870var INTERSECT_SELF_CUBIC_NO = INTERSECT_SELF_CUBIC + 1;
871var INTERSECT_CUBIC_LINE = INTERSECT_SELF_CUBIC_NO + 1;
872var INTERSECT_CUBIC_LINE_2 = INTERSECT_CUBIC_LINE + 1;
873var INTERSECT_CUBIC_LINE_3 = INTERSECT_CUBIC_LINE_2 + 1;
874var INTERSECT_CUBIC_LINE_NO = INTERSECT_CUBIC_LINE_3 + 1;
875var INTERSECT_CUBIC_QUAD = INTERSECT_CUBIC_LINE_NO + 1;
876var INTERSECT_CUBIC_QUAD_2 = INTERSECT_CUBIC_QUAD + 1;
877var INTERSECT_CUBIC_QUAD_3 = INTERSECT_CUBIC_QUAD_2 + 1;
878var INTERSECT_CUBIC_QUAD_4 = INTERSECT_CUBIC_QUAD_3 + 1;
879var INTERSECT_CUBIC_QUAD_NO = INTERSECT_CUBIC_QUAD_4 + 1;
880var INTERSECT_CUBIC = INTERSECT_CUBIC_QUAD_NO + 1;
881var INTERSECT_CUBIC_2 = INTERSECT_CUBIC + 1;
882var INTERSECT_CUBIC_3 = INTERSECT_CUBIC_2 + 1;
883var INTERSECT_CUBIC_4 = INTERSECT_CUBIC_3 + 1;
884// FIXME: add cubic 5- 9
885var INTERSECT_CUBIC_NO = INTERSECT_CUBIC_4 + 1;
886
887var SORT_UNARY = INTERSECT_CUBIC_NO + 1;
888var SORT_BINARY = SORT_UNARY + 1;
889
890var OP_DIFFERENCE = SORT_BINARY + 1;
891var OP_INTERSECT = OP_DIFFERENCE + 1;
892var OP_UNION = OP_INTERSECT + 1;
893var OP_XOR = OP_UNION + 1;
894
895var MARK_LINE = OP_XOR + 1;
896var MARK_QUAD = MARK_LINE + 1;
caryclark1049f122015-04-20 08:31:59 -0700897var MARK_CONIC = MARK_QUAD + 1;
898var MARK_CUBIC = MARK_CONIC + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700899var MARK_DONE_LINE = MARK_CUBIC + 1;
900var MARK_DONE_QUAD = MARK_DONE_LINE + 1;
caryclark1049f122015-04-20 08:31:59 -0700901var MARK_DONE_CONIC = MARK_DONE_QUAD + 1;
902var MARK_DONE_CUBIC = MARK_DONE_CONIC + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700903var MARK_UNSORTABLE_LINE = MARK_DONE_CUBIC + 1;
904var MARK_UNSORTABLE_QUAD = MARK_UNSORTABLE_LINE + 1;
caryclark1049f122015-04-20 08:31:59 -0700905var MARK_UNSORTABLE_CONIC = MARK_UNSORTABLE_QUAD + 1;
906var MARK_UNSORTABLE_CUBIC = MARK_UNSORTABLE_CONIC + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700907var MARK_SIMPLE_LINE = MARK_UNSORTABLE_CUBIC + 1;
908var MARK_SIMPLE_QUAD = MARK_SIMPLE_LINE + 1;
caryclark1049f122015-04-20 08:31:59 -0700909var MARK_SIMPLE_CONIC = MARK_SIMPLE_QUAD + 1;
910var MARK_SIMPLE_CUBIC = MARK_SIMPLE_CONIC + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700911var MARK_SIMPLE_DONE_LINE = MARK_SIMPLE_CUBIC + 1;
912var MARK_SIMPLE_DONE_QUAD = MARK_SIMPLE_DONE_LINE + 1;
caryclark1049f122015-04-20 08:31:59 -0700913var MARK_SIMPLE_DONE_CONIC = MARK_SIMPLE_DONE_QUAD + 1;
914var MARK_SIMPLE_DONE_CUBIC = MARK_SIMPLE_DONE_CONIC + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700915var MARK_DONE_UNARY_LINE = MARK_SIMPLE_DONE_CUBIC + 1;
916var MARK_DONE_UNARY_QUAD = MARK_DONE_UNARY_LINE + 1;
caryclark1049f122015-04-20 08:31:59 -0700917var MARK_DONE_UNARY_CONIC = MARK_DONE_UNARY_QUAD + 1;
918var MARK_DONE_UNARY_CUBIC = MARK_DONE_UNARY_CONIC + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700919var MARK_ANGLE_LAST = MARK_DONE_UNARY_CUBIC + 1;
920
921var COMPUTED_SET_1 = MARK_ANGLE_LAST + 1;
922var COMPUTED_SET_2 = COMPUTED_SET_1 + 1;
923
caryclark624637c2015-05-11 07:21:27 -0700924var ANGLE_AFTER = COMPUTED_SET_2 + 1;
caryclark54359292015-03-26 07:52:43 -0700925var ANGLE_AFTERPART = ANGLE_AFTER + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700926
caryclark54359292015-03-26 07:52:43 -0700927var ACTIVE_OP = ANGLE_AFTERPART + 1;
caryclarkdac1d172014-06-17 05:15:38 -0700928
caryclark624637c2015-05-11 07:21:27 -0700929var COIN_MAIN_SPAN = ACTIVE_OP + 1;
930var COIN_OPP_SPAN = COIN_MAIN_SPAN + 1;
931
932var FRAG_TYPE_LAST = COIN_OPP_SPAN;
caryclarkdac1d172014-06-17 05:15:38 -0700933
934var REC_TYPE_UNKNOWN = -1;
935var REC_TYPE_PATH = 0;
caryclark54359292015-03-26 07:52:43 -0700936var REC_TYPE_PATH2 = 1;
937var REC_TYPE_SECT = 2;
938var REC_TYPE_ACTIVE = 3;
939var REC_TYPE_ADD = 4;
940var REC_TYPE_SORT = 5;
941var REC_TYPE_OP = 6;
942var REC_TYPE_MARK = 7;
943var REC_TYPE_COMPUTED = 8;
944var REC_TYPE_COIN = 9;
945var REC_TYPE_ANGLE = 10;
946var REC_TYPE_ACTIVE_OP = 11;
947var REC_TYPE_AFTERPART = 12;
caryclark03b03ca2015-04-23 09:13:37 -0700948var REC_TYPE_TOP = 13;
caryclark624637c2015-05-11 07:21:27 -0700949var REC_TYPE_COINCIDENCE = 14;
caryclark26ad22a2015-10-16 09:03:38 -0700950var REC_TYPE_ALIGNED = 15;
951var REC_TYPE_LAST = REC_TYPE_ALIGNED;
caryclarkdac1d172014-06-17 05:15:38 -0700952
953function strs_to_nums(strs) {
954 var result = [];
955 for (var idx = 1; idx < strs.length; ++idx) {
956 var str = strs[idx];
957 var num = parseFloat(str);
958 if (isNaN(num)) {
959 result.push(str);
960 } else {
961 result.push(num);
962 }
963 }
964 return result;
965}
966
967function filter_str_by(id, str, regex, array) {
968 if (regex.test(str)) {
969 var strs = regex.exec(str);
970 var result = strs_to_nums(strs);
971 array.push(id);
972 array.push(result);
973 return true;
974 }
975 return false;
976}
977
978function construct_regexp2(pattern) {
979 var escape = pattern.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
980 escape = escape.replace(/UNSORTABLE/g, "\\*\\*\\* UNSORTABLE \\*\\*\\*");
981 escape = escape.replace(/CUBIC_VAL/g, "\\(P_VAL P_VAL P_VAL P_VAL\\)");
caryclark1049f122015-04-20 08:31:59 -0700982 escape = escape.replace(/CONIC_VAL/g, "\\(P_VAL P_VAL P_VAL W_VAL\\)");
caryclarkdac1d172014-06-17 05:15:38 -0700983 escape = escape.replace(/QUAD_VAL/g, "\\(P_VAL P_VAL P_VAL\\)");
984 escape = escape.replace(/LINE_VAL/g, "\\(P_VAL P_VAL\\)");
985 escape = escape.replace(/FILL_TYPE/g, "SkPath::k[a-zA-Z]+_FillType");
caryclark54359292015-03-26 07:52:43 -0700986 escape = escape.replace(/PTR_VAL/g, "0x[0-9A-F]+");
caryclarkdac1d172014-06-17 05:15:38 -0700987 escape = escape.replace(/PT_VAL/g, "\\(P_VAL\\)");
988 escape = escape.replace(/P_VAL/g, "(-?\\d+\\.?\\d*(?:e-?\\d+)?)[Ff]?, ?(-?\\d+\\.?\\d*(?:e-?\\d+)?)[Ff]?");
989 escape = escape.replace(/T_VAL/g, "(-?\\d+\\.?\\d*(?:e-?\\d+)?)");
caryclark1049f122015-04-20 08:31:59 -0700990 escape = escape.replace(/W_VAL/g, "(-?\\d+\\.?\\d*(?:e-?\\d+)?)[Ff]?");
caryclarkdac1d172014-06-17 05:15:38 -0700991 escape = escape.replace(/PATH/g, "pathB?");
caryclark1049f122015-04-20 08:31:59 -0700992 escape = escape.replace(/IDX/g, "(-?\\d+)");
caryclarkdac1d172014-06-17 05:15:38 -0700993 escape = escape.replace(/NUM/g, "(-?\\d+)");
994 escape = escape.replace(/OPT/g, "(\\?|-?\\d+)");
995 return new RegExp(escape, 'i');
996}
997
998function construct_regexp2c(pattern) {
999 var escape = pattern.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
1000 escape = escape.replace(/UNSORTABLE/g, "\\*\\*\\* UNSORTABLE \\*\\*\\*");
caryclark54359292015-03-26 07:52:43 -07001001 escape = escape.replace(/CUBIC_VAL/g, "(?:\\$\\d = )?\\{\\{\\{P_VAL\\}, \\{P_VAL\\}, \\{P_VAL\\}, \\{P_VAL\\}\\}\\}");
caryclark1049f122015-04-20 08:31:59 -07001002 escape = escape.replace(/CONIC_VAL/g, "(?:\\$\\d = )?\\{\\{\\{\\{P_VAL\\}, \\{P_VAL\\}, \\{P_VAL\\}\\}\\}, W_VAL\\}");
caryclark54359292015-03-26 07:52:43 -07001003 escape = escape.replace(/QUAD_VAL/g, "(?:\\$\\d = )?\\{\\{\\{P_VAL\\}, \\{P_VAL\\}, \\{P_VAL\\}\\}\\}");
1004 escape = escape.replace(/LINE_VAL/g, "(?:\\$\\d = )?\\{\\{\\{P_VAL\\}, \\{P_VAL\\}\\}\\}");
caryclarkdac1d172014-06-17 05:15:38 -07001005 escape = escape.replace(/FILL_TYPE/g, "SkPath::k[a-zA-Z]+_FillType");
caryclark54359292015-03-26 07:52:43 -07001006 escape = escape.replace(/PTR_VAL/g, "0x[0-9A-F]+");
caryclarkdac1d172014-06-17 05:15:38 -07001007 escape = escape.replace(/PT_VAL/g, "\\{\\{P_VAL\\}\\}");
caryclark54359292015-03-26 07:52:43 -07001008 escape = escape.replace(/P_VAL/g, "(?:f?[xX] = )?(-?\\d+\\.?\\d*(?:e-?\\d+)?)[Ff]?, *(?: f?[yY] = )?(-?\\d+\\.?\\d*(?:e-?\\d+)?)[Ff]?");
caryclarkdac1d172014-06-17 05:15:38 -07001009 escape = escape.replace(/T_VAL/g, "(-?\\d+\\.?\\d*(?:e-?\\d+)?)");
caryclark1049f122015-04-20 08:31:59 -07001010 escape = escape.replace(/W_VAL/g, "(-?\\d+\\.?\\d*(?:e-?\\d+)?)[Ff]?");
caryclarkdac1d172014-06-17 05:15:38 -07001011 escape = escape.replace(/OPER/g, "[a-z]+");
1012 escape = escape.replace(/PATH/g, "pathB?");
1013 escape = escape.replace(/T_F/g, "([TF])");
caryclark1049f122015-04-20 08:31:59 -07001014 escape = escape.replace(/IDX/g, "(-?\\d+)");
caryclarkdac1d172014-06-17 05:15:38 -07001015 escape = escape.replace(/NUM/g, "(-?\\d+)");
1016 escape = escape.replace(/OPT/g, "(\\?|-?\\d+)");
1017 return new RegExp(escape, 'i');
1018}
1019
1020function match_regexp(str, lineNo, array, id, pattern) {
1021 var regex = construct_regexp2(pattern);
1022 if (filter_str_by(id, str, regex, array)) {
1023 return true;
1024 }
1025 regex = construct_regexp2c(pattern);
1026 return filter_str_by(id, str, regex, array);
1027}
1028
1029function endsWith(str, suffix) {
1030 return str.indexOf(suffix, str.length - suffix.length) !== -1;
1031}
1032
1033function parse_all(test) {
1034 var lines = test.match(/[^\r\n]+/g);
1035 var records = []; // a rec can be the original paths, a set of intersections, a set of active spans, a sort, or a path add
1036 var record = [];
1037 var recType = REC_TYPE_UNKNOWN;
1038 var lastLineNo;
1039 var moveX, moveY;
1040 for (var lineNo = 0; lineNo < lines.length; ++lineNo) {
1041 var line = lines[lineNo];
1042 if (line.length == 0) {
1043 continue;
1044 }
1045 var opStart = "SkOpSegment::";
1046 if (line.lastIndexOf(opStart, 0) === 0) {
1047 line = line.substr(opStart.length);
1048 }
1049 var angleStart = "SkOpAngle::";
1050 if (line.lastIndexOf(angleStart, 0) === 0) {
1051 line = line.substr(angleStart.length);
1052 }
caryclark624637c2015-05-11 07:21:27 -07001053 var coinStart = "SkOpCoincidence::";
1054 if (line.lastIndexOf(coinStart, 0) === 0) {
1055 line = line.substr(coinStart.length);
1056 }
caryclark54359292015-03-26 07:52:43 -07001057 var type = line.lastIndexOf("debugShowActiveSpans", 0) === 0 ? REC_TYPE_ACTIVE
caryclark624637c2015-05-11 07:21:27 -07001058 : line.lastIndexOf("debugShowCoincidence", 0) === 0 ? REC_TYPE_COINCIDENCE
caryclark54359292015-03-26 07:52:43 -07001059 : line.lastIndexOf("((SkOpSegment*)", 0) === 0 ? REC_TYPE_PATH2
caryclark55888e42016-07-18 10:01:36 -07001060 : line.lastIndexOf("debugShowTs", 0) === 0 ? REC_TYPE_COIN
caryclark54359292015-03-26 07:52:43 -07001061 : line.lastIndexOf("afterPart", 0) === 0 ? REC_TYPE_AFTERPART
caryclarkdac1d172014-06-17 05:15:38 -07001062 : line.lastIndexOf("debugShow", 0) === 0 ? REC_TYPE_SECT
1063 : line.lastIndexOf("activeOp", 0) === 0 ? REC_TYPE_ACTIVE_OP
1064 : line.lastIndexOf("computed", 0) === 0 ? REC_TYPE_COMPUTED
1065 : line.lastIndexOf("debugOne", 0) === 0 ? REC_TYPE_SORT
caryclark26ad22a2015-10-16 09:03:38 -07001066 : line.lastIndexOf("aligned=", 0) === 0 ? REC_TYPE_ALIGNED
caryclarkdac1d172014-06-17 05:15:38 -07001067 : line.lastIndexOf("dumpOne", 0) === 0 ? REC_TYPE_SORT
caryclark03b03ca2015-04-23 09:13:37 -07001068 : line.lastIndexOf("findTop", 0) === 0 ? REC_TYPE_TOP
caryclarkdac1d172014-06-17 05:15:38 -07001069 : line.lastIndexOf("pathB.", 0) === 0 ? REC_TYPE_ADD
1070 : line.lastIndexOf("path.", 0) === 0 ? REC_TYPE_ADD
1071 : line.lastIndexOf("after", 0) === 0 ? REC_TYPE_ANGLE
1072 : line.lastIndexOf("mark", 0) === 0 ? REC_TYPE_MARK
1073 : line.lastIndexOf(" {{", 0) === 0 ? REC_TYPE_COMPUTED
caryclark54359292015-03-26 07:52:43 -07001074 : line.lastIndexOf("seg=", 0) === 0 ? REC_TYPE_PATH
caryclarkdac1d172014-06-17 05:15:38 -07001075 : line.lastIndexOf("op", 0) === 0 ? REC_TYPE_OP
1076 : line.lastIndexOf("$", 0) === 0 ? REC_TYPE_PATH
1077 : REC_TYPE_UNKNOWN;
1078 if (recType != type || recType == REC_TYPE_ADD || recType == REC_TYPE_SECT
1079 || recType == REC_TYPE_ACTIVE_OP || recType == REC_TYPE_ANGLE) {
1080 if (recType != REC_TYPE_UNKNOWN) {
1081 records.push(recType);
1082 records.push(lastLineNo);
1083 records.push(record);
1084 }
1085 record = [];
1086 recType = type;
1087 lastLineNo = lineNo;
1088 }
1089 var found = false;
1090 switch (recType) {
1091 case REC_TYPE_ACTIVE:
1092 found = match_regexp(line, lineNo, record, ACTIVE_LINE_SPAN, "debugShowActiveSpans" +
caryclark55888e42016-07-18 10:01:36 -07001093" id=IDX LINE_VAL t=T_VAL tEnd=T_VAL windSum=OPT windValue=IDX"
caryclarkdac1d172014-06-17 05:15:38 -07001094 ) || match_regexp(line, lineNo, record, ACTIVE_QUAD_SPAN, "debugShowActiveSpans" +
caryclark55888e42016-07-18 10:01:36 -07001095" id=IDX QUAD_VAL t=T_VAL tEnd=T_VAL windSum=OPT windValue=IDX"
caryclark1049f122015-04-20 08:31:59 -07001096 ) || match_regexp(line, lineNo, record, ACTIVE_CONIC_SPAN, "debugShowActiveSpans" +
caryclark55888e42016-07-18 10:01:36 -07001097" id=IDX CONIC_VAL t=T_VAL tEnd=T_VAL windSum=OPT windValue=IDX"
caryclarkdac1d172014-06-17 05:15:38 -07001098 ) || match_regexp(line, lineNo, record, ACTIVE_CUBIC_SPAN, "debugShowActiveSpans" +
caryclark55888e42016-07-18 10:01:36 -07001099" id=IDX CUBIC_VAL t=T_VAL tEnd=T_VAL windSum=OPT windValue=IDX"
caryclark624637c2015-05-11 07:21:27 -07001100 ) || match_regexp(line, lineNo, record, ACTIVE_LINE_SPAN, "debugShowActiveSpans" +
caryclark55888e42016-07-18 10:01:36 -07001101" id=IDX LINE_VAL t=T_VAL tEnd=T_VAL windSum=OPT oppSum=OPT windValue=IDX oppValue=NUM"
caryclark624637c2015-05-11 07:21:27 -07001102 ) || match_regexp(line, lineNo, record, ACTIVE_QUAD_SPAN, "debugShowActiveSpans" +
caryclark55888e42016-07-18 10:01:36 -07001103" id=IDX QUAD_VAL t=T_VAL tEnd=T_VAL windSum=OPT oppSum=OPT windValue=IDX oppValue=NUM"
caryclark624637c2015-05-11 07:21:27 -07001104 ) || match_regexp(line, lineNo, record, ACTIVE_CONIC_SPAN, "debugShowActiveSpans" +
caryclark55888e42016-07-18 10:01:36 -07001105" id=IDX CONIC_VAL t=T_VAL tEnd=T_VAL windSum=OPT oppSum=OPT windValue=IDX oppValue=NUM"
caryclark624637c2015-05-11 07:21:27 -07001106 ) || match_regexp(line, lineNo, record, ACTIVE_CUBIC_SPAN, "debugShowActiveSpans" +
caryclark55888e42016-07-18 10:01:36 -07001107" id=IDX CUBIC_VAL t=T_VAL tEnd=T_VAL windSum=OPT oppSum=OPT windValue=IDX oppValue=NUM"
caryclarkdac1d172014-06-17 05:15:38 -07001108 );
1109 break;
1110 case REC_TYPE_ACTIVE_OP:
1111 found = match_regexp(line, lineNo, record, ACTIVE_OP, "activeOp" +
1112" id=IDX t=T_VAL tEnd=T_VAL op=OPER miFrom=NUM miTo=NUM suFrom=NUM suTo=NUM result=IDX"
1113 );
1114 break;
1115 case REC_TYPE_ADD:
1116 if (match_regexp(line, lineNo, record, ADD_MOVETO, "PATH.moveTo(P_VAL);")) {
1117 moveX = record[1][0];
1118 moveY = record[1][1];
1119 found = true;
1120 } else if (match_regexp(line, lineNo, record, ADD_LINETO, "PATH.lineTo(P_VAL);")) {
1121 record[1].unshift(moveY);
1122 record[1].unshift(moveX);
1123 moveX = record[1][2];
1124 moveY = record[1][3];
1125 found = true;
1126 } else if (match_regexp(line, lineNo, record, ADD_QUADTO, "PATH.quadTo(P_VAL, P_VAL);")) {
1127 record[1].unshift(moveY);
1128 record[1].unshift(moveX);
1129 moveX = record[1][4];
1130 moveY = record[1][5];
1131 found = true;
caryclark1049f122015-04-20 08:31:59 -07001132 } else if (match_regexp(line, lineNo, record, ADD_CONICTO, "PATH.conicTo(P_VAL, P_VAL, T_VAL);")) {
1133 record[1].unshift(moveY);
1134 record[1].unshift(moveX);
1135 moveX = record[1][4];
1136 moveY = record[1][5];
1137 found = true;
caryclarkdac1d172014-06-17 05:15:38 -07001138 } else if (match_regexp(line, lineNo, record, ADD_CUBICTO, "PATH.cubicTo(P_VAL, P_VAL, P_VAL);")) {
1139 record[1].unshift(moveY);
1140 record[1].unshift(moveX);
1141 moveX = record[1][6];
1142 moveY = record[1][7];
1143 found = true;
1144 } else if (match_regexp(line, lineNo, record, ADD_FILL, "PATH.setFillType(FILL_TYPE);")) {
1145 found = true;
1146 } else {
1147 found = match_regexp(line, lineNo, record, ADD_CLOSE, "PATH.close();");
1148 }
1149 break;
caryclark54359292015-03-26 07:52:43 -07001150 case REC_TYPE_AFTERPART:
1151 found = match_regexp(line, lineNo, record, PATH_LINE, "afterPart LINE_VAL")
1152 || match_regexp(line, lineNo, record, PATH_QUAD, "afterPart QUAD_VAL")
caryclark1049f122015-04-20 08:31:59 -07001153 || match_regexp(line, lineNo, record, PATH_CONIC, "afterPart CONIC_VAL")
caryclark54359292015-03-26 07:52:43 -07001154 || match_regexp(line, lineNo, record, PATH_CUBIC, "afterPart CUBIC_VAL")
1155 break;
caryclark26ad22a2015-10-16 09:03:38 -07001156 case REC_TYPE_ALIGNED:
1157 found = match_regexp(line, lineNo, record, PATH_LINE, "aligned=IDX LINE_VAL"
1158 ) || match_regexp(line, lineNo, record, PATH_QUAD, "aligned=IDX QUAD_VAL"
1159 ) || match_regexp(line, lineNo, record, PATH_CONIC, "aligned=IDX CONIC_VAL"
1160 ) || match_regexp(line, lineNo, record, PATH_CUBIC, "aligned=IDX CUBIC_VAL"
1161 );
1162 break;
caryclarkdac1d172014-06-17 05:15:38 -07001163 case REC_TYPE_ANGLE:
1164 found = match_regexp(line, lineNo, record, ANGLE_AFTER, "after " +
caryclarkdac1d172014-06-17 05:15:38 -07001165"[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");
1166 break;
1167 case REC_TYPE_COIN:
1168 found = true;
1169 break;
caryclark624637c2015-05-11 07:21:27 -07001170 case REC_TYPE_COINCIDENCE:
1171 found = match_regexp(line, lineNo, record, COIN_MAIN_SPAN, "debugShowCoincidence" +
1172" + id=IDX t=T_VAL tEnd=T_VAL"
1173 ) || match_regexp(line, lineNo, record, COIN_OPP_SPAN, "debugShowCoincidence" +
1174" - id=IDX t=T_VAL tEnd=T_VAL"
1175 );
1176 break;
caryclarkdac1d172014-06-17 05:15:38 -07001177 case REC_TYPE_COMPUTED:
1178 found = line == "computed quadratics given"
1179 || match_regexp(line, lineNo, record, COMPUTED_SET_1, "computed quadratics set 1"
1180 ) || match_regexp(line, lineNo, record, COMPUTED_SET_2, "computed quadratics set 2"
1181 ) || match_regexp(line, lineNo, record, PATH_QUAD, " QUAD_VAL,"
caryclark1049f122015-04-20 08:31:59 -07001182 ) || match_regexp(line, lineNo, record, PATH_CONIC, " CONIC_VAL,"
caryclarkdac1d172014-06-17 05:15:38 -07001183 ) || match_regexp(line, lineNo, record, PATH_CUBIC, " CUBIC_VAL,"
1184 );
1185 break;
1186 case REC_TYPE_PATH:
caryclark54359292015-03-26 07:52:43 -07001187 found = match_regexp(line, lineNo, record, PATH_LINE, "seg=IDX LINE_VAL"
1188 ) || match_regexp(line, lineNo, record, PATH_QUAD, "seg=IDX QUAD_VAL"
caryclark1049f122015-04-20 08:31:59 -07001189 ) || match_regexp(line, lineNo, record, PATH_CONIC, "seg=IDX CONIC_VAL"
caryclark54359292015-03-26 07:52:43 -07001190 ) || match_regexp(line, lineNo, record, PATH_CUBIC, "seg=IDX CUBIC_VAL"
1191 );
1192 break;
1193 case REC_TYPE_PATH2:
1194 found = match_regexp(line, lineNo, record, PATH_LINE, "((SkOpSegment*) PTR_VAL) [IDX] {LINE_VAL}"
1195 ) || match_regexp(line, lineNo, record, PATH_QUAD, "((SkOpSegment*) PTR_VAL) [IDX] {QUAD_VAL}"
caryclark1049f122015-04-20 08:31:59 -07001196 ) || match_regexp(line, lineNo, record, PATH_CONIC, "((SkOpSegment*) PTR_VAL) [IDX] {CONIC_VAL}"
caryclark54359292015-03-26 07:52:43 -07001197 ) || match_regexp(line, lineNo, record, PATH_CUBIC, "((SkOpSegment*) PTR_VAL) [IDX] {CUBIC_VAL}"
caryclarkdac1d172014-06-17 05:15:38 -07001198 );
1199 break;
1200 case REC_TYPE_SECT:
1201 found = match_regexp(line, lineNo, record, INTERSECT_LINE, "debugShowLineIntersection" +
1202" wtTs[0]=T_VAL LINE_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL"
1203 ) || match_regexp(line, lineNo, record, INTERSECT_LINE_2, "debugShowLineIntersection" +
1204" wtTs[0]=T_VAL LINE_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL wnTs[1]=T_VAL"
1205 ) || match_regexp(line, lineNo, record, INTERSECT_LINE_NO, "debugShowLineIntersection" +
1206" no intersect LINE_VAL LINE_VAL"
1207 ) || match_regexp(line, lineNo, record, INTERSECT_QUAD_LINE, "debugShowQuadLineIntersection" +
1208" wtTs[0]=T_VAL QUAD_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL"
1209 ) || match_regexp(line, lineNo, record, INTERSECT_QUAD_LINE_2, "debugShowQuadLineIntersection" +
1210" wtTs[0]=T_VAL QUAD_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL wnTs[1]=T_VAL"
1211 ) || match_regexp(line, lineNo, record, INTERSECT_QUAD_LINE_NO, "debugShowQuadLineIntersection" +
1212" no intersect QUAD_VAL LINE_VAL"
1213 ) || match_regexp(line, lineNo, record, INTERSECT_QUAD, "debugShowQuadIntersection" +
1214" wtTs[0]=T_VAL QUAD_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL"
1215 ) || match_regexp(line, lineNo, record, INTERSECT_QUAD_2, "debugShowQuadIntersection" +
1216" wtTs[0]=T_VAL QUAD_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL wnTs[1]=T_VAL"
1217 ) || match_regexp(line, lineNo, record, INTERSECT_QUAD_NO, "debugShowQuadIntersection" +
1218" no intersect QUAD_VAL QUAD_VAL"
caryclark55888e42016-07-18 10:01:36 -07001219
caryclark1049f122015-04-20 08:31:59 -07001220 ) || match_regexp(line, lineNo, record, INTERSECT_CONIC_LINE, "debugShowConicLineIntersection" +
1221" wtTs[0]=T_VAL CONIC_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL"
1222 ) || match_regexp(line, lineNo, record, INTERSECT_CONIC_LINE_2, "debugShowConicLineIntersection" +
1223" wtTs[0]=T_VAL CONIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL wnTs[1]=T_VAL"
1224 ) || match_regexp(line, lineNo, record, INTERSECT_CONIC_LINE_NO, "debugShowConicLineIntersection" +
1225" no intersect CONIC_VAL LINE_VAL"
caryclark55888e42016-07-18 10:01:36 -07001226
1227 ) || match_regexp(line, lineNo, record, INTERSECT_CONIC_QUAD, "debugShowConicQuadIntersection" +
1228" wtTs[0]=T_VAL CONIC_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL"
1229 ) || match_regexp(line, lineNo, record, INTERSECT_CONIC_QUAD_2, "debugShowConicQuadIntersection" +
1230" wtTs[0]=T_VAL CONIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL wnTs[1]=T_VAL"
1231 ) || match_regexp(line, lineNo, record, INTERSECT_CONIC_QUAD_NO, "debugShowConicQuadIntersection" +
1232" no intersect CONIC_VAL QUAD_VAL"
1233
caryclark1049f122015-04-20 08:31:59 -07001234 ) || match_regexp(line, lineNo, record, INTERSECT_CONIC, "debugShowConicIntersection" +
1235" wtTs[0]=T_VAL CONIC_VAL PT_VAL wnTs[0]=T_VAL CONIC_VAL"
1236 ) || match_regexp(line, lineNo, record, INTERSECT_CONIC_2, "debugShowConicIntersection" +
1237" wtTs[0]=T_VAL CONIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL CONIC_VAL wnTs[1]=T_VAL"
1238 ) || match_regexp(line, lineNo, record, INTERSECT_CONIC_NO, "debugShowConicIntersection" +
1239" no intersect CONIC_VAL CONIC_VAL"
caryclarkdac1d172014-06-17 05:15:38 -07001240 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_LINE, "debugShowCubicLineIntersection" +
1241" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL"
1242 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_LINE_2, "debugShowCubicLineIntersection" +
1243" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL wnTs[1]=T_VAL"
1244 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_LINE_3, "debugShowCubicLineIntersection" +
1245" 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"
1246 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_LINE_NO, "debugShowCubicLineIntersection" +
1247" no intersect CUBIC_VAL LINE_VAL"
1248 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD, "debugShowCubicQuadIntersection" +
1249" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL"
1250 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD_2, "debugShowCubicQuadIntersection" +
1251" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL wnTs[1]=T_VAL"
1252 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD_3, "debugShowCubicQuadIntersection" +
1253" 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"
1254 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD_4, "debugShowCubicQuadIntersection" +
1255" 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"
1256 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD_NO, "debugShowCubicQuadIntersection" +
1257" no intersect CUBIC_VAL QUAD_VAL"
1258 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC, "debugShowCubicIntersection" +
1259" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wnTs[0]=T_VAL CUBIC_VAL"
1260 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_2, "debugShowCubicIntersection" +
1261" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL CUBIC_VAL wnTs[1]=T_VAL"
1262 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_3, "debugShowCubicIntersection" +
1263" 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"
1264 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_4, "debugShowCubicIntersection" +
1265" 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"
1266 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_NO, "debugShowCubicIntersection" +
1267" no intersect CUBIC_VAL CUBIC_VAL"
1268 ) || match_regexp(line, lineNo, record, INTERSECT_SELF_CUBIC, "debugShowCubicIntersection" +
1269" wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL"
1270 ) || match_regexp(line, lineNo, record, INTERSECT_SELF_CUBIC_NO, "debugShowCubicIntersection" +
1271" no self intersect CUBIC_VAL"
1272 );
1273 break;
1274 case REC_TYPE_SORT:
1275 var hasDone = / done/.test(line);
1276 var hasUnorderable = / unorderable/.test(line);
1277 var hasSmall = / small/.test(line);
1278 var hasTiny = / tiny/.test(line);
1279 var hasOperand = / operand/.test(line);
1280 var hasStop = / stop/.test(line);
1281 line.replace(/[ a-z]+$/, "");
1282 found = match_regexp(line, lineNo, record, SORT_UNARY, "debugOne" +
1283" [IDX/IDX] next=IDX/IDX sect=IDX/IDX s=T_VAL [IDX] e=T_VAL [IDX] sgn=NUM windVal=IDX windSum=OPT"
1284 ) || match_regexp(line, lineNo, record, SORT_BINARY, "debugOne" +
1285" [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"
1286 ) || match_regexp(line, lineNo, record, SORT_UNARY, "dumpOne" +
1287" [IDX/IDX] next=IDX/IDX sect=NUM/NUM s=T_VAL [IDX] e=T_VAL [IDX] sgn=NUM windVal=IDX windSum=OPT"
1288 ) || match_regexp(line, lineNo, record, SORT_BINARY, "dumpOne" +
1289" [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"
1290 );
1291 if (found) {
1292 record[1].push(hasDone);
1293 record[1].push(hasUnorderable);
1294 record[1].push(hasSmall);
1295 record[1].push(hasTiny);
1296 record[1].push(hasOperand);
1297 record[1].push(hasStop);
1298 }
1299 break;
caryclark03b03ca2015-04-23 09:13:37 -07001300 case REC_TYPE_TOP:
1301 found = match_regexp(line, lineNo, record, ACTIVE_OP, "findTop" +
1302" id=IDX s=T_VAL e=T_VAL cw=NUM swap=NUM inflections=NUM monotonic=NUM"
1303 ) || match_regexp(line, lineNo, record, ACTIVE_OP, "findTop" +
1304" id=IDX s=T_VAL e=T_VAL (-) cw=NUM swap=NUM inflections=NUM monotonic=NUM"
1305 ) || match_regexp(line, lineNo, record, ACTIVE_OP, "findTop" +
1306" id=IDX s=T_VAL e=T_VAL (+) cw=NUM swap=NUM inflections=NUM monotonic=NUM"
1307 );
1308 break;
caryclarkdac1d172014-06-17 05:15:38 -07001309 case REC_TYPE_MARK:
1310 found = match_regexp(line, lineNo, record, MARK_LINE, "markWinding" +
caryclark54359292015-03-26 07:52:43 -07001311" id=IDX LINE_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM newOppSum=OPT oppSum=OPT windSum=OPT windValue=IDX"
caryclarkdac1d172014-06-17 05:15:38 -07001312 ) || match_regexp(line, lineNo, record, MARK_QUAD, "markWinding" +
caryclark54359292015-03-26 07:52:43 -07001313" id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM newOppSum=OPT oppSum=OPT windSum=OPT windValue=IDX"
caryclark1049f122015-04-20 08:31:59 -07001314 ) || match_regexp(line, lineNo, record, MARK_CONIC, "markWinding" +
1315" id=IDX CONIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM newOppSum=OPT oppSum=OPT windSum=OPT windValue=IDX"
caryclarkdac1d172014-06-17 05:15:38 -07001316 ) || match_regexp(line, lineNo, record, MARK_CUBIC, "markWinding" +
caryclark54359292015-03-26 07:52:43 -07001317" id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM newOppSum=OPT oppSum=OPT windSum=OPT windValue=IDX"
1318 ) || match_regexp(line, lineNo, record, MARK_DONE_LINE, "markDone" +
1319" 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"
1320 ) || match_regexp(line, lineNo, record, MARK_DONE_QUAD, "markDone" +
1321" 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"
caryclark1049f122015-04-20 08:31:59 -07001322 ) || match_regexp(line, lineNo, record, MARK_DONE_CONIC, "markDone" +
1323" 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"
caryclark54359292015-03-26 07:52:43 -07001324 ) || match_regexp(line, lineNo, record, MARK_DONE_CUBIC, "markDone" +
1325" 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"
caryclarkdac1d172014-06-17 05:15:38 -07001326 ) || match_regexp(line, lineNo, record, MARK_SIMPLE_LINE, "markWinding" +
1327" id=IDX LINE_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX"
1328 ) || match_regexp(line, lineNo, record, MARK_SIMPLE_QUAD, "markWinding" +
1329" id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX"
caryclark1049f122015-04-20 08:31:59 -07001330 ) || match_regexp(line, lineNo, record, MARK_SIMPLE_CONIC, "markWinding" +
1331" id=IDX CONIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX"
caryclarkdac1d172014-06-17 05:15:38 -07001332 ) || match_regexp(line, lineNo, record, MARK_SIMPLE_CUBIC, "markWinding" +
1333" id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT windValue=IDX"
caryclarkdac1d172014-06-17 05:15:38 -07001334 ) || match_regexp(line, lineNo, record, MARK_ANGLE_LAST, "markAngle" +
caryclark1049f122015-04-20 08:31:59 -07001335" last segment=IDX span=IDX"
caryclark54359292015-03-26 07:52:43 -07001336 ) || match_regexp(line, lineNo, record, MARK_ANGLE_LAST, "markAngle" +
caryclark55888e42016-07-18 10:01:36 -07001337" last seg=IDX span=IDX"
1338 ) || match_regexp(line, lineNo, record, MARK_ANGLE_LAST, "markAngle" +
1339" last segment=IDX span=IDX windSum=OPT"
1340 ) || match_regexp(line, lineNo, record, MARK_ANGLE_LAST, "markAngle" +
1341" last seg=IDX span=IDX windSum=OPT"
1342 );
caryclarkdac1d172014-06-17 05:15:38 -07001343 break;
1344 case REC_TYPE_OP:
1345 if (line.lastIndexOf("oppSign oppSign=", 0) === 0
1346 || line.lastIndexOf("operator<", 0) === 0) {
1347 found = true;
1348 break;
1349 }
caryclark54359292015-03-26 07:52:43 -07001350 found = match_regexp(line, lineNo, record, OP_DIFFERENCE, "op diff"
caryclarkdac1d172014-06-17 05:15:38 -07001351 ) || match_regexp(line, lineNo, record, OP_INTERSECT, "op intersect"
caryclark54359292015-03-26 07:52:43 -07001352 ) || match_regexp(line, lineNo, record, OP_INTERSECT, "op sect"
caryclarkdac1d172014-06-17 05:15:38 -07001353 ) || match_regexp(line, lineNo, record, OP_UNION, "op union"
1354 ) || match_regexp(line, lineNo, record, OP_XOR, "op xor"
1355 );
1356 break;
1357 case REC_TYPE_UNKNOWN:
1358 found = true;
1359 break;
1360 }
1361 if (!found) {
1362 console.log(line + " [" + lineNo + "] of type " + type + " not found");
1363 }
1364 }
1365 if (recType != REC_TYPE_UNKNOWN) {
1366 records.push(recType);
1367 records.push(lastLineNo);
1368 records.push(record);
1369 }
1370 if (records.length >= 1) {
1371 tests[testIndex] = records;
1372 testLines[testIndex] = lines;
1373 }
1374}
1375
1376function init(test) {
1377 var canvas = document.getElementById('canvas');
1378 if (!canvas.getContext) return;
1379 ctx = canvas.getContext('2d');
1380 var resScale = retina_scale && window.devicePixelRatio ? window.devicePixelRatio : 1;
1381 var unscaledWidth = window.innerWidth - 20;
1382 var unscaledHeight = window.innerHeight - 20;
1383 screenWidth = unscaledWidth;
1384 screenHeight = unscaledHeight;
1385 canvas.width = unscaledWidth * resScale;
1386 canvas.height = unscaledHeight * resScale;
1387 canvas.style.width = unscaledWidth + 'px';
1388 canvas.style.height = unscaledHeight + 'px';
1389 if (resScale != 1) {
1390 ctx.scale(resScale, resScale);
1391 }
1392 xmin = Infinity;
1393 xmax = -Infinity;
1394 ymin = Infinity;
1395 ymax = -Infinity;
caryclark26ad22a2015-10-16 09:03:38 -07001396 hasPath = hasAlignedPath = hasComputedPath = false;
caryclarkdac1d172014-06-17 05:15:38 -07001397 firstActiveSpan = -1;
1398 for (var tIndex = 0; tIndex < test.length; tIndex += 3) {
1399 var recType = test[tIndex];
1400 if (!typeof recType == 'number' || recType < REC_TYPE_UNKNOWN || recType > REC_TYPE_LAST) {
1401 console.log("unknown rec type: " + recType);
1402 throw "stop execution";
1403 }
1404 var records = test[tIndex + 2];
1405 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2) {
1406 var fragType = records[recordIndex];
1407 if (!typeof fragType == 'number' || fragType < 1 || fragType > FRAG_TYPE_LAST) {
1408 console.log("unknown in range frag type: " + fragType);
1409 throw "stop execution";
1410 }
1411 var frags = records[recordIndex + 1];
1412 var first = 0;
1413 var last = -1;
1414 var first2 = 0;
1415 var last2 = 0;
1416 switch (recType) {
caryclark26ad22a2015-10-16 09:03:38 -07001417 case REC_TYPE_ALIGNED:
1418 hasAlignedPath = true;
caryclarkdac1d172014-06-17 05:15:38 -07001419 case REC_TYPE_COMPUTED:
1420 if (fragType == COMPUTED_SET_1 || fragType == COMPUTED_SET_2) {
1421 break;
1422 }
caryclark26ad22a2015-10-16 09:03:38 -07001423 if (REC_TYPE_COMPUTED == recType) {
1424 hasComputedPath = true;
1425 }
caryclarkdac1d172014-06-17 05:15:38 -07001426 case REC_TYPE_PATH:
caryclark54359292015-03-26 07:52:43 -07001427 first = 1;
caryclarkdac1d172014-06-17 05:15:38 -07001428 switch (fragType) {
1429 case PATH_LINE:
caryclark54359292015-03-26 07:52:43 -07001430 last = 5;
caryclarkdac1d172014-06-17 05:15:38 -07001431 break;
caryclark1049f122015-04-20 08:31:59 -07001432 case PATH_CONIC:
caryclarkdac1d172014-06-17 05:15:38 -07001433 case PATH_QUAD:
caryclark54359292015-03-26 07:52:43 -07001434 last = 7;
caryclarkdac1d172014-06-17 05:15:38 -07001435 break;
1436 case PATH_CUBIC:
caryclark54359292015-03-26 07:52:43 -07001437 last = 9;
caryclarkdac1d172014-06-17 05:15:38 -07001438 break;
1439 default:
caryclark55888e42016-07-18 10:01:36 -07001440 console.log("unknown " + (recType == REC_TYPE_PATH ? "REC_TYPE_PATH"
caryclarkdac1d172014-06-17 05:15:38 -07001441 : "REC_TYPE_COMPUTED") + " frag type:" + fragType);
1442 throw "stop execution";
1443 }
1444 if (recType == REC_TYPE_PATH) {
1445 hasPath = true;
1446 }
1447 break;
caryclark54359292015-03-26 07:52:43 -07001448 case REC_TYPE_PATH2:
1449 first = 1;
1450 switch (fragType) {
1451 case PATH_LINE:
1452 last = 5;
1453 break;
caryclark1049f122015-04-20 08:31:59 -07001454 case PATH_CONIC:
caryclark54359292015-03-26 07:52:43 -07001455 case PATH_QUAD:
1456 last = 7;
1457 break;
1458 case PATH_CUBIC:
1459 last = 9;
1460 break;
1461 default:
caryclark55888e42016-07-18 10:01:36 -07001462 console.log("unknown " + (recType == REC_TYPE_PATH2 ? "REC_TYPE_PATH2"
caryclark54359292015-03-26 07:52:43 -07001463 : "REC_TYPE_COMPUTED") + " frag type:" + fragType);
1464 throw "stop execution";
1465 }
1466 if (recType == REC_TYPE_PATH2) {
1467 hasPath = true;
1468 }
1469 break;
caryclarkdac1d172014-06-17 05:15:38 -07001470 case REC_TYPE_ACTIVE:
1471 if (firstActiveSpan < 0) {
1472 firstActiveSpan = tIndex;
1473 }
1474 first = 1;
1475 switch (fragType) {
1476 case ACTIVE_LINE_SPAN:
1477 last = 5;
1478 break;
caryclark1049f122015-04-20 08:31:59 -07001479 case ACTIVE_CONIC_SPAN:
caryclarkdac1d172014-06-17 05:15:38 -07001480 case ACTIVE_QUAD_SPAN:
1481 last = 7;
1482 break;
1483 case ACTIVE_CUBIC_SPAN:
1484 last = 9;
1485 break;
1486 default:
1487 console.log("unknown REC_TYPE_ACTIVE frag type: " + fragType);
1488 throw "stop execution";
1489 }
1490 break;
1491 case REC_TYPE_ADD:
1492 switch (fragType) {
1493 case ADD_MOVETO:
1494 break;
1495 case ADD_LINETO:
1496 last = 4;
1497 break;
caryclark1049f122015-04-20 08:31:59 -07001498 case ADD_CONICTO:
caryclarkdac1d172014-06-17 05:15:38 -07001499 case ADD_QUADTO:
1500 last = 6;
1501 break;
1502 case ADD_CUBICTO:
1503 last = 8;
1504 break;
1505 case ADD_CLOSE:
1506 case ADD_FILL:
1507 break;
1508 default:
1509 console.log("unknown REC_TYPE_ADD frag type: " + fragType);
1510 throw "stop execution";
1511 }
1512 break;
caryclark54359292015-03-26 07:52:43 -07001513 case REC_TYPE_AFTERPART:
1514 switch (fragType) {
1515 case PATH_LINE:
1516 last = 4;
1517 break;
caryclark1049f122015-04-20 08:31:59 -07001518 case PATH_CONIC:
caryclark54359292015-03-26 07:52:43 -07001519 case PATH_QUAD:
1520 last = 6;
1521 break;
1522 case PATH_CUBIC:
1523 last = 8;
1524 break;
1525 default:
1526 console.log("unknown REC_TYPE_ACTIVEPART frag type: " + fragType);
1527 throw "stop execution";
1528 }
1529 break;
caryclarkdac1d172014-06-17 05:15:38 -07001530 case REC_TYPE_SECT:
1531 switch (fragType) {
1532 case INTERSECT_LINE:
1533 first = 1; last = 5; first2 = 8; last2 = 12;
1534 break;
1535 case INTERSECT_LINE_2:
1536 first = 1; last = 5; first2 = 11; last2 = 15;
1537 break;
1538 case INTERSECT_LINE_NO:
1539 first = 0; last = 4; first2 = 4; last2 = 8;
1540 break;
caryclark1049f122015-04-20 08:31:59 -07001541 case INTERSECT_CONIC_LINE:
1542 first = 1; last = 7; first2 = 11; last2 = 15;
1543 break;
caryclarkdac1d172014-06-17 05:15:38 -07001544 case INTERSECT_QUAD_LINE:
1545 first = 1; last = 7; first2 = 10; last2 = 14;
1546 break;
caryclark1049f122015-04-20 08:31:59 -07001547 case INTERSECT_CONIC_LINE_2:
1548 first = 1; last = 7; first2 = 14; last2 = 18;
1549 break;
caryclarkdac1d172014-06-17 05:15:38 -07001550 case INTERSECT_QUAD_LINE_2:
1551 first = 1; last = 7; first2 = 13; last2 = 17;
1552 break;
caryclark1049f122015-04-20 08:31:59 -07001553 case INTERSECT_CONIC_LINE_NO:
1554 first = 0; last = 6; first2 = 7; last2 = 11;
1555 break;
caryclarkdac1d172014-06-17 05:15:38 -07001556 case INTERSECT_QUAD_LINE_NO:
1557 first = 0; last = 6; first2 = 6; last2 = 10;
1558 break;
caryclark1049f122015-04-20 08:31:59 -07001559 case INTERSECT_CONIC:
1560 first = 1; last = 7; first2 = 11; last2 = 17;
1561 break;
caryclarkdac1d172014-06-17 05:15:38 -07001562 case INTERSECT_QUAD:
1563 first = 1; last = 7; first2 = 10; last2 = 16;
1564 break;
caryclark1049f122015-04-20 08:31:59 -07001565 case INTERSECT_CONIC_2:
1566 first = 1; last = 7; first2 = 14; last2 = 20;
1567 break;
caryclarkdac1d172014-06-17 05:15:38 -07001568 case INTERSECT_QUAD_2:
1569 first = 1; last = 7; first2 = 13; last2 = 19;
1570 break;
caryclark1049f122015-04-20 08:31:59 -07001571 case INTERSECT_CONIC_NO:
1572 first = 0; last = 6; first2 = 7; last2 = 13;
1573 break;
caryclarkdac1d172014-06-17 05:15:38 -07001574 case INTERSECT_QUAD_NO:
1575 first = 0; last = 6; first2 = 6; last2 = 12;
1576 break;
1577 case INTERSECT_SELF_CUBIC:
1578 first = 1; last = 9;
1579 break;
1580 case INTERSECT_SELF_CUBIC_NO:
1581 first = 0; last = 8;
1582 break;
1583 case INTERSECT_CUBIC_LINE:
1584 first = 1; last = 9; first2 = 12; last2 = 16;
1585 break;
1586 case INTERSECT_CUBIC_LINE_2:
1587 first = 1; last = 9; first2 = 15; last2 = 19;
1588 break;
1589 case INTERSECT_CUBIC_LINE_3:
1590 first = 1; last = 9; first2 = 18; last2 = 22;
1591 break;
1592 case INTERSECT_CUBIC_LINE_NO:
1593 first = 0; last = 8; first2 = 8; last2 = 12;
1594 break;
caryclark55888e42016-07-18 10:01:36 -07001595 case INTERSECT_CONIC_QUAD:
1596 first = 1; last = 7; first2 = 11; last2 = 17;
1597 break;
1598 case INTERSECT_CONIC_QUAD_2:
1599 first = 1; last = 7; first2 = 14; last2 = 20;
1600 break;
1601 case INTERSECT_CONIC_QUAD_NO:
1602 first = 0; last = 6; first2 = 7; last2 = 13;
1603 break;
caryclarkdac1d172014-06-17 05:15:38 -07001604 case INTERSECT_CUBIC_QUAD:
1605 first = 1; last = 9; first2 = 12; last2 = 18;
1606 break;
1607 case INTERSECT_CUBIC_QUAD_2:
1608 first = 1; last = 9; first2 = 15; last2 = 21;
1609 break;
1610 case INTERSECT_CUBIC_QUAD_3:
1611 first = 1; last = 9; first2 = 18; last2 = 24;
1612 break;
1613 case INTERSECT_CUBIC_QUAD_4:
1614 first = 1; last = 9; first2 = 21; last2 = 27;
1615 break;
1616 case INTERSECT_CUBIC_QUAD_NO:
1617 first = 0; last = 8; first2 = 8; last2 = 14;
1618 break;
1619 case INTERSECT_CUBIC:
1620 first = 1; last = 9; first2 = 12; last2 = 20;
1621 break;
1622 case INTERSECT_CUBIC_2:
1623 first = 1; last = 9; first2 = 15; last2 = 23;
1624 break;
1625 case INTERSECT_CUBIC_3:
1626 first = 1; last = 9; first2 = 18; last2 = 26;
1627 break;
1628 case INTERSECT_CUBIC_4:
1629 first = 1; last = 9; first2 = 21; last2 = 29;
1630 break;
1631 case INTERSECT_CUBIC_NO:
1632 first = 0; last = 8; first2 = 8; last2 = 16;
1633 break;
1634 default:
1635 console.log("unknown REC_TYPE_SECT frag type: " + fragType);
1636 throw "stop execution";
1637 }
1638 break;
1639 default:
1640 continue;
1641 }
1642 for (var idx = first; idx < last; idx += 2) {
1643 xmin = Math.min(xmin, frags[idx]);
1644 xmax = Math.max(xmax, frags[idx]);
1645 ymin = Math.min(ymin, frags[idx + 1]);
1646 ymax = Math.max(ymax, frags[idx + 1]);
1647 }
1648 for (var idx = first2; idx < last2; idx += 2) {
1649 xmin = Math.min(xmin, frags[idx]);
1650 xmax = Math.max(xmax, frags[idx]);
1651 ymin = Math.min(ymin, frags[idx + 1]);
1652 ymax = Math.max(ymax, frags[idx + 1]);
1653 }
1654 }
1655 }
1656 var angleBounds = [Infinity, Infinity, -Infinity, -Infinity];
1657 for (var tIndex = 0; tIndex < test.length; tIndex += 3) {
1658 var recType = test[tIndex];
1659 var records = test[tIndex + 2];
1660 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2) {
1661 var fragType = records[recordIndex];
1662 var frags = records[recordIndex + 1];
1663 switch (recType) {
1664 case REC_TYPE_ACTIVE_OP:
1665 if (!draw_op) {
1666 break;
1667 }
1668 {
1669 var curve = curvePartialByID(test, frags[0], frags[1], frags[2]);
1670 curve_extremes(curve, angleBounds);
1671 }
1672 break;
1673 case REC_TYPE_ANGLE:
1674 if (!draw_angle) {
1675 break;
1676 }
caryclark54359292015-03-26 07:52:43 -07001677 {
caryclarkdac1d172014-06-17 05:15:38 -07001678 var curve = curvePartialByID(test, frags[0], frags[4], frags[5]);
1679 curve_extremes(curve, angleBounds);
1680 curve = curvePartialByID(test, frags[6], frags[10], frags[11]);
1681 curve_extremes(curve, angleBounds);
1682 curve = curvePartialByID(test, frags[12], frags[16], frags[17]);
1683 }
1684 break;
caryclark624637c2015-05-11 07:21:27 -07001685 case REC_TYPE_COINCIDENCE:
1686 if (!draw_coincidence) {
1687 break;
1688 }
1689 {
1690 var curve = curvePartialByID(test, frags[0], frags[1], frags[2]);
1691 curve_extremes(curve, angleBounds);
1692 }
1693 break;
caryclarkdac1d172014-06-17 05:15:38 -07001694 case REC_TYPE_SORT:
1695 if (!draw_sort) {
1696 break;
1697 }
1698 if (fragType == SORT_UNARY || fragType == SORT_BINARY) {
1699 var curve = curvePartialByID(test, frags[0], frags[6], frags[8]);
1700 curve_extremes(curve, angleBounds);
1701 }
1702 break;
caryclark03b03ca2015-04-23 09:13:37 -07001703 case REC_TYPE_TOP:
1704 if (!draw_top) {
1705 break;
1706 }
1707 {
1708 var curve = curvePartialByID(test, frags[0], frags[1], frags[2]);
1709 curve_extremes(curve, angleBounds);
1710 }
1711 break;
caryclarkdac1d172014-06-17 05:15:38 -07001712 }
1713 }
1714 }
1715 xmin = Math.min(xmin, angleBounds[0]);
1716 ymin = Math.min(ymin, angleBounds[1]);
1717 xmax = Math.max(xmax, angleBounds[2]);
1718 ymax = Math.max(ymax, angleBounds[3]);
1719 setScale(xmin, xmax, ymin, ymax);
1720 if (hasPath == false && hasComputedPath == true && !draw_computed) {
caryclark1049f122015-04-20 08:31:59 -07001721 draw_computed = 7; // show quadratics, conics, and cubics
caryclarkdac1d172014-06-17 05:15:38 -07001722 }
1723 if (hasPath == true && hasComputedPath == false && draw_computed) {
1724 draw_computed = 0;
1725 }
1726}
1727
caryclark26ad22a2015-10-16 09:03:38 -07001728function curveByIDMatch(test, id, recMatch) {
caryclark54359292015-03-26 07:52:43 -07001729 var tIndex = -3;
1730 while ((tIndex += 3) < test.length) {
caryclarkdac1d172014-06-17 05:15:38 -07001731 var recType = test[tIndex];
caryclark54359292015-03-26 07:52:43 -07001732 if (recType == REC_TYPE_OP) {
1733 continue;
1734 }
caryclark26ad22a2015-10-16 09:03:38 -07001735 if (recType != recMatch) {
caryclarkdac1d172014-06-17 05:15:38 -07001736 return [];
1737 }
1738 var records = test[tIndex + 2];
1739 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2) {
1740 var fragType = records[recordIndex];
1741 var frags = records[recordIndex + 1];
1742 if (frags[0] == id) {
1743 switch (fragType) {
caryclark54359292015-03-26 07:52:43 -07001744 case PATH_LINE:
caryclarkdac1d172014-06-17 05:15:38 -07001745 return [frags[1], frags[2], frags[3], frags[4]];
caryclark54359292015-03-26 07:52:43 -07001746 case PATH_QUAD:
caryclarkdac1d172014-06-17 05:15:38 -07001747 return [frags[1], frags[2], frags[3], frags[4],
1748 frags[5], frags[6]];
caryclark1049f122015-04-20 08:31:59 -07001749 case PATH_CONIC:
1750 return [frags[1], frags[2], frags[3], frags[4],
1751 frags[5], frags[6], frags[7]];
caryclark54359292015-03-26 07:52:43 -07001752 case PATH_CUBIC:
caryclarkdac1d172014-06-17 05:15:38 -07001753 return [frags[1], frags[2], frags[3], frags[4],
1754 frags[5], frags[6], frags[7], frags[8]];
1755 }
1756 }
1757 }
caryclarkdac1d172014-06-17 05:15:38 -07001758 }
1759 return [];
1760}
1761
caryclark26ad22a2015-10-16 09:03:38 -07001762function curveByID(test, id) {
1763 var result = draw_path >= 4 ? curveByIDMatch(test, id, REC_TYPE_ALIGNED) : [];
1764 if (!result.length) {
1765 result = curveByIDMatch(test, id, REC_TYPE_PATH);
1766 }
1767 return result;
1768}
1769
1770function curvePartialByIDMatch(test, id, t0, t1, recMatch) {
caryclark54359292015-03-26 07:52:43 -07001771 var tIndex = -3;
1772 while ((tIndex += 3) < test.length) {
caryclarkdac1d172014-06-17 05:15:38 -07001773 var recType = test[tIndex];
caryclark54359292015-03-26 07:52:43 -07001774 if (recType == REC_TYPE_OP) {
1775 continue;
1776 }
caryclark26ad22a2015-10-16 09:03:38 -07001777 if (recType != recMatch) {
caryclarkdac1d172014-06-17 05:15:38 -07001778 return [];
1779 }
1780 var records = test[tIndex + 2];
1781 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2) {
1782 var fragType = records[recordIndex];
1783 var frags = records[recordIndex + 1];
1784 if (frags[0] == id) {
1785 switch (fragType) {
caryclark54359292015-03-26 07:52:43 -07001786 case PATH_LINE:
caryclarkdac1d172014-06-17 05:15:38 -07001787 return linePartial(frags[1], frags[2], frags[3], frags[4], t0, t1);
caryclark54359292015-03-26 07:52:43 -07001788 case PATH_QUAD:
caryclarkdac1d172014-06-17 05:15:38 -07001789 return quadPartial(frags[1], frags[2], frags[3], frags[4],
1790 frags[5], frags[6], t0, t1);
caryclark1049f122015-04-20 08:31:59 -07001791 case PATH_CONIC:
1792 return conicPartial(frags[1], frags[2], frags[3], frags[4],
1793 frags[5], frags[6], frags[7], t0, t1);
caryclark54359292015-03-26 07:52:43 -07001794 case PATH_CUBIC:
caryclarkdac1d172014-06-17 05:15:38 -07001795 return cubicPartial(frags[1], frags[2], frags[3], frags[4],
1796 frags[5], frags[6], frags[7], frags[8], t0, t1);
1797 }
1798 }
1799 }
caryclarkdac1d172014-06-17 05:15:38 -07001800 }
1801 return [];
1802}
1803
caryclark26ad22a2015-10-16 09:03:38 -07001804function curvePartialByID(test, id, t0, t1) {
1805 var result = draw_path >= 4 ? curvePartialByIDMatch(test, id, t0, t1, REC_TYPE_ALIGNED) : [];
1806 if (!result.length) {
1807 result = curvePartialByIDMatch(test, id, t0, t1, REC_TYPE_PATH);
1808 }
1809 return result;
1810}
1811
1812function idByCurveIDMatch(test, frag, type, recMatch) {
caryclark54359292015-03-26 07:52:43 -07001813 var tIndex = 0;
caryclarkdac1d172014-06-17 05:15:38 -07001814 while (tIndex < test.length) {
1815 var recType = test[tIndex];
caryclark26ad22a2015-10-16 09:03:38 -07001816 if (recType != recMatch) {
caryclark54359292015-03-26 07:52:43 -07001817 ++tIndex;
1818 continue;
caryclarkdac1d172014-06-17 05:15:38 -07001819 }
1820 var records = test[tIndex + 2];
1821 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2) {
1822 var fragType = records[recordIndex];
1823 var frags = records[recordIndex + 1];
caryclark54359292015-03-26 07:52:43 -07001824 if (frag.length != frags.length - 1) {
1825 continue;
1826 }
caryclarkdac1d172014-06-17 05:15:38 -07001827 switch (fragType) {
caryclark54359292015-03-26 07:52:43 -07001828 case PATH_LINE:
caryclarkdac1d172014-06-17 05:15:38 -07001829 if (frag[0] != frags[1] || frag[1] != frags[2]
1830 || frag[2] != frags[3] || frag[3] != frags[4]) {
1831 continue;
1832 }
1833 return frags[0];
caryclark54359292015-03-26 07:52:43 -07001834 case PATH_QUAD:
caryclarkdac1d172014-06-17 05:15:38 -07001835 if (frag[0] != frags[1] || frag[1] != frags[2]
1836 || frag[2] != frags[3] || frag[3] != frags[4]
1837 || frag[4] != frags[5] || frag[5] != frags[6]) {
1838 continue;
1839 }
1840 return frags[0];
caryclark1049f122015-04-20 08:31:59 -07001841 case PATH_CONIC:
1842 if (frag[0] != frags[1] || frag[1] != frags[2]
1843 || frag[2] != frags[3] || frag[3] != frags[4]
1844 || frag[4] != frags[5] || frag[5] != frags[6]
1845 || frag[6] != frags[7]) {
1846 continue;
1847 }
1848 return frags[0];
caryclark54359292015-03-26 07:52:43 -07001849 case PATH_CUBIC:
caryclarkdac1d172014-06-17 05:15:38 -07001850 if (frag[0] != frags[1] || frag[1] != frags[2]
1851 || frag[2] != frags[3] || frag[3] != frags[4]
1852 || frag[4] != frags[5] || frag[5] != frags[6]
1853 || frag[6] != frags[7] || frag[7] != frags[8]) {
1854 continue;
1855 }
1856 return frags[0];
1857 }
1858 }
1859 ++tIndex;
1860 }
1861 return -1;
1862}
1863
caryclark26ad22a2015-10-16 09:03:38 -07001864function idByCurve(test, frag, type) {
1865 var result = draw_path >= 4 ? idByCurveIDMatch(test, frag, type, REC_TYPE_ALIGNED) : [];
1866 if (!result.length) {
1867 result = idByCurveIDMatch(test, frag, type, REC_TYPE_PATH);
1868 }
1869 return result;
1870}
1871
caryclarkdac1d172014-06-17 05:15:38 -07001872function curve_extremes(curve, bounds) {
caryclark1049f122015-04-20 08:31:59 -07001873 var length = curve.length == 7 ? 6 : curve.length;
caryclarked0935a2015-10-22 07:23:52 -07001874 for (var index = 0; index < length; index += 2) {
caryclarkdac1d172014-06-17 05:15:38 -07001875 var x = curve[index];
1876 var y = curve[index + 1];
1877 bounds[0] = Math.min(bounds[0], x);
1878 bounds[1] = Math.min(bounds[1], y);
1879 bounds[2] = Math.max(bounds[2], x);
1880 bounds[3] = Math.max(bounds[3], y);
1881 }
1882}
1883
1884function setScale(x0, x1, y0, y1) {
1885 var srcWidth = x1 - x0;
1886 var srcHeight = y1 - y0;
1887 var usableWidth = screenWidth;
1888 var xDigits = Math.ceil(Math.log(Math.abs(xmax)) / Math.log(10));
1889 var yDigits = Math.ceil(Math.log(Math.abs(ymax)) / Math.log(10));
1890 usableWidth -= (xDigits + yDigits) * 10;
1891 usableWidth -= decimal_places * 10;
1892 if (draw_legend) {
1893 usableWidth -= 40;
1894 }
1895 var hscale = usableWidth / srcWidth;
1896 var vscale = screenHeight / srcHeight;
1897 scale = Math.min(hscale, vscale);
1898 var invScale = 1 / scale;
1899 var sxmin = x0 - invScale * 5;
1900 var symin = y0 - invScale * 10;
1901 var sxmax = x1 + invScale * (6 * decimal_places + 10);
1902 var symax = y1 + invScale * 10;
1903 srcWidth = sxmax - sxmin;
1904 srcHeight = symax - symin;
1905 hscale = usableWidth / srcWidth;
1906 vscale = screenHeight / srcHeight;
1907 scale = Math.min(hscale, vscale);
1908 srcLeft = sxmin;
1909 srcTop = symin;
1910}
1911
1912function drawArc(curve, op, from, to) {
1913 var type = PATH_LINE + (curve.length / 2 - 2);
1914 var pt = pointAtT(curve, type, op ? 0.4 : 0.6);
1915 var dy = pt.y - curve[1];
1916 var dx = pt.x - curve[0];
1917 var dist = Math.sqrt(dy * dy + dx * dx);
1918 var _dist = dist * scale;
1919 var angle = Math.atan2(dy, dx);
1920 var _px = (curve[0] - srcLeft) * scale;
1921 var _py = (curve[1] - srcTop) * scale;
1922 var divisor = 4;
1923 var endDist;
1924 do {
1925 var ends = [];
1926 for (var index = -1; index <= 1; index += 2) {
1927 var px = Math.cos(index * Math.PI / divisor);
1928 var py = Math.sin(index * Math.PI / divisor);
1929 ends.push(px);
1930 ends.push(py);
1931 }
1932 var endDx = (ends[2] - ends[0]) * scale * dist;
1933 var endDy = (ends[3] - ends[1]) * scale * dist;
1934 endDist = Math.sqrt(endDx * endDx + endDy * endDy);
1935 if (endDist < 100) {
1936 break;
1937 }
1938 divisor *= 2;
1939 } while (true);
1940 if (endDist < 30) {
1941 return;
1942 }
1943 if (op) {
1944 divisor *= 2;
1945 }
1946 ctx.strokeStyle = op ? "rgba(210,0,45, 0.4)" : "rgba(90,90,90, 0.5)";
1947 ctx.beginPath();
1948 ctx.arc(_px, _py, _dist, angle - Math.PI / divisor, angle + Math.PI / divisor, false);
1949 ctx.stroke();
1950 var saveAlign = ctx.textAlign;
1951 var saveStyle = ctx.fillStyle;
1952 var saveFont = ctx.font;
1953 ctx.textAlign = "center";
1954 ctx.fillStyle = "black";
1955 ctx.font = "normal 24px Arial";
1956 divisor *= 0.8;
1957 for (var index = -1; index <= 1; index += 2) {
1958 var px = curve[0] + Math.cos(angle + index * Math.PI / divisor) * dist;
1959 var py = curve[1] + Math.sin(angle + index * Math.PI / divisor) * dist;
1960 var _px = (px - srcLeft) * scale;
1961 var _py = (py - srcTop) * scale;
1962 ctx.fillText(index < 0 ? to.toString() : from.toString(), _px, _py + 8);
1963 }
1964 ctx.textAlign = saveAlign;
1965 ctx.fillStyle = saveStyle;
1966 ctx.font = saveFont;
1967}
1968
1969function drawPoint(px, py, end) {
caryclark1049f122015-04-20 08:31:59 -07001970 var length = drawnPts.length == 7 ? 6 : drawnPts.length;
1971 for (var pts = 0; pts < length; pts += 2) {
caryclarkdac1d172014-06-17 05:15:38 -07001972 var x = drawnPts[pts];
1973 var y = drawnPts[pts + 1];
1974 if (px == x && py == y) {
1975 return;
1976 }
1977 }
1978 drawnPts.push(px);
1979 drawnPts.push(py);
1980 var label = px.toFixed(decimal_places) + ", " + py.toFixed(decimal_places);
1981 var _px = (px - srcLeft) * scale;
1982 var _py = (py - srcTop) * scale;
1983 ctx.beginPath();
1984 ctx.arc(_px, _py, 3, 0, Math.PI*2, true);
1985 ctx.closePath();
1986 if (end) {
1987 ctx.fill();
1988 } else {
1989 ctx.stroke();
1990 }
1991 if (debug_xy) {
1992 ctx.textAlign = "left";
1993 ctx.fillText(label, _px + 5, _py);
1994 }
1995}
1996
caryclark1049f122015-04-20 08:31:59 -07001997function coordCount(curveType) {
1998 switch (curveType) {
1999 case PATH_LINE:
2000 return 4;
2001 case PATH_QUAD:
2002 return 6;
2003 case PATH_CONIC:
2004 return 6;
2005 case PATH_CUBIC:
2006 return 8;
2007 }
2008 return -1;
2009}
2010
caryclarkdac1d172014-06-17 05:15:38 -07002011function drawPoints(ptArray, curveType, drawControls) {
caryclark1049f122015-04-20 08:31:59 -07002012 var count = coordCount(curveType);
caryclarkdac1d172014-06-17 05:15:38 -07002013 for (var idx = 0; idx < count; idx += 2) {
2014 if (!drawControls && idx != 0 && idx != count - 2) {
2015 continue;
2016 }
2017 drawPoint(ptArray[idx], ptArray[idx + 1], idx == 0 || idx == count - 2);
2018 }
2019}
2020
2021function drawControlLines(curve, curveType, drawEnd) {
2022 if (curveType == PATH_LINE) {
2023 return;
2024 }
2025 ctx.strokeStyle = "rgba(0,0,0, 0.3)";
2026 drawLine(curve[0], curve[1], curve[2], curve[3]);
2027 drawLine(curve[2], curve[3], curve[4], curve[5]);
2028 if (curveType == PATH_CUBIC) {
2029 drawLine(curve[4], curve[5], curve[6], curve[7]);
2030 if (drawEnd > 1) {
2031 drawLine(curve[6], curve[7], curve[0], curve[1]);
2032 if (drawEnd > 2) {
2033 drawLine(curve[0], curve[1], curve[4], curve[5]);
2034 drawLine(curve[6], curve[7], curve[2], curve[3]);
2035 }
2036 }
2037 } else if (drawEnd > 1) {
2038 drawLine(curve[4], curve[5], curve[0], curve[1]);
2039 }
2040}
2041
2042function pointAtT(curve, curveType, t) {
2043 var xy = {};
2044 switch (curveType) {
2045 case PATH_LINE:
2046 var a = 1 - t;
2047 var b = t;
2048 xy.x = a * curve[0] + b * curve[2];
2049 xy.y = a * curve[1] + b * curve[3];
2050 break;
2051 case PATH_QUAD:
2052 var one_t = 1 - t;
2053 var a = one_t * one_t;
2054 var b = 2 * one_t * t;
2055 var c = t * t;
2056 xy.x = a * curve[0] + b * curve[2] + c * curve[4];
2057 xy.y = a * curve[1] + b * curve[3] + c * curve[5];
2058 break;
caryclark1049f122015-04-20 08:31:59 -07002059 case PATH_CONIC:
2060 var one_t = 1 - t;
2061 var a = one_t * one_t;
2062 var b = 2 * one_t * t;
2063 var c = t * t;
2064 xy.x = a * curve[0] + b * curve[2] * curve[6] + c * curve[4];
2065 xy.y = a * curve[1] + b * curve[3] * curve[6] + c * curve[5];
2066 var d = a + b * curve[6] + c;
2067 xy.x /= d;
2068 xy.y /= d;
2069 break;
caryclarkdac1d172014-06-17 05:15:38 -07002070 case PATH_CUBIC:
2071 var one_t = 1 - t;
2072 var one_t2 = one_t * one_t;
2073 var a = one_t2 * one_t;
2074 var b = 3 * one_t2 * t;
2075 var t2 = t * t;
2076 var c = 3 * one_t * t2;
2077 var d = t2 * t;
2078 xy.x = a * curve[0] + b * curve[2] + c * curve[4] + d * curve[6];
2079 xy.y = a * curve[1] + b * curve[3] + c * curve[5] + d * curve[7];
2080 break;
2081 }
2082 return xy;
2083}
caryclark55888e42016-07-18 10:01:36 -07002084
caryclarkdac1d172014-06-17 05:15:38 -07002085function drawPointAtT(curve, curveType) {
2086 var x, y;
2087 var xy = pointAtT(curve, curveType, curveT);
2088 drawPoint(xy.x, xy.y, true);
2089 if (!draw_intersectT) {
2090 return;
2091 }
2092 ctx.fillStyle = "red";
2093 drawTAtPointUp(xy.x, xy.y, curveT);
2094}
2095
2096function drawTAtPointUp(px, py, t) {
2097 var label = t.toFixed(decimal_places);
2098 var _px = (px - srcLeft)* scale;
2099 var _py = (py - srcTop) * scale;
2100 ctx.fillText(label, _px + 5, _py - 10);
2101}
2102
2103function drawTAtPointDown(px, py, t) {
2104 var label = t.toFixed(decimal_places);
2105 var _px = (px - srcLeft)* scale;
2106 var _py = (py - srcTop) * scale;
2107 ctx.fillText(label, _px + 5, _py + 10);
2108}
2109
2110function alreadyDrawnLine(x1, y1, x2, y2) {
2111 if (collect_bounds) {
2112 if (focus_enabled) {
2113 focusXmin = Math.min(focusXmin, x1, x2);
2114 focusYmin = Math.min(focusYmin, y1, y2);
2115 focusXmax = Math.max(focusXmax, x1, x2);
2116 focusYmax = Math.max(focusYmax, y1, y2);
2117 }
2118 return true;
2119 }
2120 for (var pts = 0; pts < drawnLines.length; pts += 4) {
2121 if (x1 == drawnLines[pts] && y1 == drawnLines[pts + 1]
2122 && x2 == drawnLines[pts + 2] && y2 == drawnLines[pts + 3]) {
2123 return true;
2124 }
2125 }
2126 drawnLines.push(x1);
2127 drawnLines.push(y1);
2128 drawnLines.push(x2);
2129 drawnLines.push(y2);
2130 return false;
2131}
2132
2133function drawLine(x1, y1, x2, y2) {
2134 if (alreadyDrawnLine(x1, y1, x2, y2)) {
2135 return;
2136 }
2137 ctx.beginPath();
2138 ctx.moveTo((x1 - srcLeft) * scale,
2139 (y1 - srcTop) * scale);
2140 ctx.lineTo((x2 - srcLeft) * scale,
2141 (y2 - srcTop) * scale);
2142 ctx.stroke();
2143}
2144
2145function linePartial(x1, y1, x2, y2, t1, t2) {
2146 var dx = x1 - x2;
2147 var dy = y1 - y2;
2148 var array = [
2149 x1 - t1 * dx,
2150 y1 - t1 * dy,
2151 x1 - t2 * dx,
2152 y1 - t2 * dy
2153 ];
2154 return array;
2155}
2156
2157function drawLinePartial(x1, y1, x2, y2, t1, t2) {
2158 var a = linePartial(x1, y1, x2, y2, t1, t2);
2159 var ax = a[0];
2160 var ay = a[1];
2161 var bx = a[2];
2162 var by = a[3];
2163 if (alreadyDrawnLine(ax, ay, bx, by)) {
2164 return;
2165 }
2166 ctx.beginPath();
2167 ctx.moveTo((ax - srcLeft) * scale,
2168 (ay - srcTop) * scale);
2169 ctx.lineTo((bx - srcLeft) * scale,
2170 (by - srcTop) * scale);
2171 ctx.stroke();
2172}
2173
2174function alreadyDrawnQuad(x1, y1, x2, y2, x3, y3) {
2175 if (collect_bounds) {
2176 if (focus_enabled) {
2177 focusXmin = Math.min(focusXmin, x1, x2, x3);
2178 focusYmin = Math.min(focusYmin, y1, y2, y3);
2179 focusXmax = Math.max(focusXmax, x1, x2, x3);
2180 focusYmax = Math.max(focusYmax, y1, y2, y3);
2181 }
2182 return true;
2183 }
2184 for (var pts = 0; pts < drawnQuads.length; pts += 6) {
2185 if (x1 == drawnQuads[pts] && y1 == drawnQuads[pts + 1]
2186 && x2 == drawnQuads[pts + 2] && y2 == drawnQuads[pts + 3]
2187 && x3 == drawnQuads[pts + 4] && y3 == drawnQuads[pts + 5]) {
2188 return true;
2189 }
2190 }
2191 drawnQuads.push(x1);
2192 drawnQuads.push(y1);
2193 drawnQuads.push(x2);
2194 drawnQuads.push(y2);
2195 drawnQuads.push(x3);
2196 drawnQuads.push(y3);
2197 return false;
2198}
2199
2200function drawQuad(x1, y1, x2, y2, x3, y3) {
2201 if (alreadyDrawnQuad(x1, y1, x2, y2, x3, y3)) {
2202 return;
2203 }
2204 ctx.beginPath();
2205 ctx.moveTo((x1 - srcLeft) * scale,
2206 (y1 - srcTop) * scale);
2207 ctx.quadraticCurveTo((x2 - srcLeft) * scale,
2208 (y2 - srcTop) * scale,
2209 (x3 - srcLeft) * scale,
2210 (y3 - srcTop) * scale);
2211 ctx.stroke();
2212}
2213
2214function interp(A, B, t) {
2215 return A + (B - A) * t;
2216}
2217
2218function interp_quad_coords(x1, x2, x3, t)
2219{
2220 var ab = interp(x1, x2, t);
2221 var bc = interp(x2, x3, t);
2222 var abc = interp(ab, bc, t);
2223 return abc;
2224}
2225
2226function quadPartial(x1, y1, x2, y2, x3, y3, t1, t2) {
2227 var ax = interp_quad_coords(x1, x2, x3, t1);
2228 var ay = interp_quad_coords(y1, y2, y3, t1);
2229 var dx = interp_quad_coords(x1, x2, x3, (t1 + t2) / 2);
2230 var dy = interp_quad_coords(y1, y2, y3, (t1 + t2) / 2);
2231 var cx = interp_quad_coords(x1, x2, x3, t2);
2232 var cy = interp_quad_coords(y1, y2, y3, t2);
2233 var bx = 2*dx - (ax + cx)/2;
2234 var by = 2*dy - (ay + cy)/2;
2235 var array = [
2236 ax, ay, bx, by, cx, cy
2237 ];
2238 return array;
2239}
2240
2241function drawQuadPartial(x1, y1, x2, y2, x3, y3, t1, t2) {
2242 var a = quadPartial(x1, y1, x2, y2, x3, y3, t1, t2);
2243 var ax = a[0];
2244 var ay = a[1];
2245 var bx = a[2];
2246 var by = a[3];
2247 var cx = a[4];
2248 var cy = a[5];
2249 if (alreadyDrawnQuad(ax, ay, bx, by, cx, cy)) {
2250 return;
2251 }
2252 ctx.beginPath();
2253 ctx.moveTo((ax - srcLeft) * scale,
2254 (ay - srcTop) * scale);
2255 ctx.quadraticCurveTo((bx - srcLeft) * scale,
2256 (by - srcTop) * scale,
2257 (cx - srcLeft) * scale,
2258 (cy - srcTop) * scale);
2259 ctx.stroke();
2260}
2261
caryclark1049f122015-04-20 08:31:59 -07002262function alreadyDrawnConic(x1, y1, x2, y2, x3, y3, w) {
2263 if (collect_bounds) {
2264 if (focus_enabled) {
2265 focusXmin = Math.min(focusXmin, x1, x2, x3);
2266 focusYmin = Math.min(focusYmin, y1, y2, y3);
2267 focusXmax = Math.max(focusXmax, x1, x2, x3);
2268 focusYmax = Math.max(focusYmax, y1, y2, y3);
2269 }
2270 return true;
2271 }
2272 for (var pts = 0; pts < drawnConics.length; pts += 8) {
2273 if (x1 == drawnConics[pts] && y1 == drawnCubics[pts + 1]
caryclark55888e42016-07-18 10:01:36 -07002274 && x2 == drawnCubics[pts + 2] && y2 == drawnCubics[pts + 3]
2275 && x3 == drawnCubics[pts + 4] && y3 == drawnCubics[pts + 5]
caryclark1049f122015-04-20 08:31:59 -07002276 && w == drawnCubics[pts + 6]) {
2277 return true;
2278 }
2279 }
2280 drawnConics.push(x1);
2281 drawnConics.push(y1);
2282 drawnConics.push(x2);
2283 drawnConics.push(y2);
2284 drawnConics.push(x3);
2285 drawnConics.push(y3);
2286 drawnCubics.push(w);
2287 return false;
2288}
2289
2290var kMaxConicToQuadPOW2 = 5;
2291
2292function computeQuadPOW2(curve, tol) {
2293 var a = curve[6] - 1;
2294 var k = a / (4 * (2 + a));
2295 var x = k * (curve[0] - 2 * curve[2] + curve[4]);
2296 var y = k * (curve[1] - 2 * curve[3] + curve[5]);
2297
2298 var error = Math.sqrt(x * x + y * y);
2299 var pow2;
2300 for (pow2 = 0; pow2 < kMaxConicToQuadPOW2; ++pow2) {
2301 if (error <= tol) {
2302 break;
2303 }
2304 error *= 0.25;
2305 }
2306 return pow2;
2307}
2308
2309function subdivide_w_value(w) {
2310 return Math.sqrt(0.5 + w * 0.5);
2311}
2312
2313function chop(curve, part1, part2) {
2314 var w = curve[6];
2315 var scale = 1 / (1 + w);
2316 part1[0] = curve[0];
2317 part1[1] = curve[1];
2318 part1[2] = (curve[0] + curve[2] * w) * scale;
2319 part1[3] = (curve[1] + curve[3] * w) * scale;
2320 part1[4] = part2[0] = (curve[0] + (curve[2] * w) * 2 + curve[4]) * scale * 0.5;
2321 part1[5] = part2[1] = (curve[1] + (curve[3] * w) * 2 + curve[5]) * scale * 0.5;
2322 part2[2] = (curve[2] * w + curve[4]) * scale;
2323 part2[3] = (curve[3] * w + curve[5]) * scale;
2324 part2[4] = curve[4];
2325 part2[5] = curve[5];
2326 part1[6] = part2[6] = subdivide_w_value(w);
2327}
2328
2329function subdivide(curve, level, pts) {
2330 if (0 == level) {
2331 pts.push(curve[2]);
2332 pts.push(curve[3]);
2333 pts.push(curve[4]);
2334 pts.push(curve[5]);
2335 } else {
2336 var part1 = [], part2 = [];
2337 chop(curve, part1, part2);
2338 --level;
2339 subdivide(part1, level, pts);
2340 subdivide(part2, level, pts);
2341 }
2342}
2343
2344function chopIntoQuadsPOW2(curve, pow2, pts) {
2345 subdivide(curve, pow2, pts);
2346 return 1 << pow2;
2347}
2348
2349function drawConicWithQuads(x1, y1, x2, y2, x3, y3, w) {
2350 if (alreadyDrawnConic(x1, y1, x2, y2, x3, y3, w)) {
2351 return;
2352 }
2353 ctx.beginPath();
2354 ctx.moveTo((x1 - srcLeft) * scale,
2355 (y1 - srcTop) * scale);
2356 var tol = 1 / scale;
2357 var curve = [x1, y1, x2, y2, x3, y3, w];
2358 var pow2 = computeQuadPOW2(curve, tol);
2359 var pts = [];
2360 chopIntoQuadsPOW2(curve, pow2, pts);
2361 for (var i = 0; i < pts.length; i += 4) {
2362 ctx.quadraticCurveTo(
2363 (pts[i + 0] - srcLeft) * scale, (pts[i + 1] - srcTop) * scale,
2364 (pts[i + 2] - srcLeft) * scale, (pts[i + 3] - srcTop) * scale);
2365 }
2366 ctx.stroke();
2367}
2368
2369function conic_eval_numerator(x1, x2, x3, w, t) {
2370 var src2w = x2 * w;
2371 var C = x1;
2372 var A = x3 - 2 * src2w + C;
2373 var B = 2 * (src2w - C);
2374 return (A * t + B) * t + C;
2375}
2376
2377
2378function conic_eval_denominator(w, t) {
2379 var B = 2 * (w - 1);
2380 var C = 1;
2381 var A = -B;
2382 return (A * t + B) * t + C;
2383}
2384
2385function conicPartial(x1, y1, x2, y2, x3, y3, w, t1, t2) {
2386 var ax = conic_eval_numerator(x1, x2, x3, w, t1);
2387 var ay = conic_eval_numerator(y1, y2, y3, w, t1);
2388 var az = conic_eval_denominator(w, t1);
2389 var midT = (t1 + t2) / 2;
2390 var dx = conic_eval_numerator(x1, x2, x3, w, midT);
2391 var dy = conic_eval_numerator(y1, y2, y3, w, midT);
2392 var dz = conic_eval_denominator(w, midT);
2393 var cx = conic_eval_numerator(x1, x2, x3, w, t2);
2394 var cy = conic_eval_numerator(y1, y2, y3, w, t2);
2395 var cz = conic_eval_denominator(w, t2);
2396 var bx = 2 * dx - (ax + cx) / 2;
2397 var by = 2 * dy - (ay + cy) / 2;
2398 var bz = 2 * dz - (az + cz) / 2;
2399 var dt = t2 - t1;
2400 var dt_1 = 1 - dt;
caryclark1049f122015-04-20 08:31:59 -07002401 var array = [
caryclarked0935a2015-10-22 07:23:52 -07002402 ax / az, ay / az, bx / bz, by / bz, cx / cz, cy / cz, 0
caryclark1049f122015-04-20 08:31:59 -07002403 ];
caryclarked0935a2015-10-22 07:23:52 -07002404 var dMidAC = { x:(array[0] + array[4]) / 2, y:(array[1] + array[5]) / 2 };
2405 var dMid = { x:dx / dz, y:dy / dz };
2406 var dWNumer = { x:dMidAC.x - dMid.x, y:dMidAC.y - dMid.y };
2407 var dWDenom = { x:dMid.x - array[2], y:dMid.y - array[3] };
2408 var partW = Math.sqrt(dWNumer.x * dWNumer.x + dWNumer.y * dWNumer.y)
2409 / Math.sqrt(dWDenom.x * dWDenom.x + dWDenom.y * dWDenom.y);
2410 array[6] = partW;
caryclark1049f122015-04-20 08:31:59 -07002411 return array;
2412}
caryclark55888e42016-07-18 10:01:36 -07002413
caryclark1049f122015-04-20 08:31:59 -07002414function drawConicPartial(x1, y1, x2, y2, x3, y3, w, t1, t2) {
2415 var a = conicPartial(x1, y1, x2, y2, x3, y3, w, t1, t2);
2416 var ax = a[0];
2417 var ay = a[1];
2418 var bx = a[2];
2419 var by = a[3];
2420 var cx = a[4];
2421 var cy = a[5];
2422 var w_ = a[6];
2423 drawConicWithQuads(ax, ay, bx, by, cx, cy, w_);
2424}
2425
caryclarkdac1d172014-06-17 05:15:38 -07002426function alreadyDrawnCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
2427 if (collect_bounds) {
2428 if (focus_enabled) {
2429 focusXmin = Math.min(focusXmin, x1, x2, x3, x4);
2430 focusYmin = Math.min(focusYmin, y1, y2, y3, y4);
2431 focusXmax = Math.max(focusXmax, x1, x2, x3, x4);
2432 focusYmax = Math.max(focusYmax, y1, y2, y3, y4);
2433 }
2434 return true;
2435 }
2436 for (var pts = 0; pts < drawnCubics.length; pts += 8) {
2437 if (x1 == drawnCubics[pts] && y1 == drawnCubics[pts + 1]
caryclark55888e42016-07-18 10:01:36 -07002438 && x2 == drawnCubics[pts + 2] && y2 == drawnCubics[pts + 3]
2439 && x3 == drawnCubics[pts + 4] && y3 == drawnCubics[pts + 5]
caryclarkdac1d172014-06-17 05:15:38 -07002440 && x4 == drawnCubics[pts + 6] && y4 == drawnCubics[pts + 7]) {
2441 return true;
2442 }
2443 }
2444 drawnCubics.push(x1);
2445 drawnCubics.push(y1);
2446 drawnCubics.push(x2);
2447 drawnCubics.push(y2);
2448 drawnCubics.push(x3);
2449 drawnCubics.push(y3);
2450 drawnCubics.push(x4);
2451 drawnCubics.push(y4);
2452 return false;
2453}
2454
2455function drawCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
2456 if (alreadyDrawnCubic(x1, y1, x2, y2, x3, y3, x4, y4)) {
2457 return;
2458 }
2459 ctx.beginPath();
2460 ctx.moveTo((x1 - srcLeft) * scale,
2461 (y1 - srcTop) * scale);
2462 ctx.bezierCurveTo((x2 - srcLeft) * scale,
2463 (y2 - srcTop) * scale,
2464 (x3 - srcLeft) * scale,
2465 (y3 - srcTop) * scale,
2466 (x4 - srcLeft) * scale,
2467 (y4 - srcTop) * scale);
2468 ctx.stroke();
2469}
2470
2471function interp_cubic_coords(x1, x2, x3, x4, t)
2472{
2473 var ab = interp(x1, x2, t);
2474 var bc = interp(x2, x3, t);
2475 var cd = interp(x3, x4, t);
2476 var abc = interp(ab, bc, t);
2477 var bcd = interp(bc, cd, t);
2478 var abcd = interp(abc, bcd, t);
2479 return abcd;
2480}
2481
2482function cubicPartial(x1, y1, x2, y2, x3, y3, x4, y4, t1, t2) {
2483 var ax = interp_cubic_coords(x1, x2, x3, x4, t1);
2484 var ay = interp_cubic_coords(y1, y2, y3, y4, t1);
2485 var ex = interp_cubic_coords(x1, x2, x3, x4, (t1*2+t2)/3);
2486 var ey = interp_cubic_coords(y1, y2, y3, y4, (t1*2+t2)/3);
2487 var fx = interp_cubic_coords(x1, x2, x3, x4, (t1+t2*2)/3);
2488 var fy = interp_cubic_coords(y1, y2, y3, y4, (t1+t2*2)/3);
2489 var dx = interp_cubic_coords(x1, x2, x3, x4, t2);
2490 var dy = interp_cubic_coords(y1, y2, y3, y4, t2);
2491 var mx = ex * 27 - ax * 8 - dx;
2492 var my = ey * 27 - ay * 8 - dy;
2493 var nx = fx * 27 - ax - dx * 8;
2494 var ny = fy * 27 - ay - dy * 8;
2495 var bx = (mx * 2 - nx) / 18;
2496 var by = (my * 2 - ny) / 18;
2497 var cx = (nx * 2 - mx) / 18;
2498 var cy = (ny * 2 - my) / 18;
2499 var array = [
2500 ax, ay, bx, by, cx, cy, dx, dy
2501 ];
2502 return array;
2503}
caryclark55888e42016-07-18 10:01:36 -07002504
caryclarkdac1d172014-06-17 05:15:38 -07002505function drawCubicPartial(x1, y1, x2, y2, x3, y3, x4, y4, t1, t2) {
2506 var a = cubicPartial(x1, y1, x2, y2, x3, y3, x4, y4, t1, t2);
2507 var ax = a[0];
2508 var ay = a[1];
2509 var bx = a[2];
2510 var by = a[3];
2511 var cx = a[4];
2512 var cy = a[5];
2513 var dx = a[6];
2514 var dy = a[7];
2515 if (alreadyDrawnCubic(ax, ay, bx, by, cx, cy, dx, dy)) {
2516 return;
2517 }
2518 ctx.beginPath();
2519 ctx.moveTo((ax - srcLeft) * scale,
2520 (ay - srcTop) * scale);
2521 ctx.bezierCurveTo((bx - srcLeft) * scale,
2522 (by - srcTop) * scale,
2523 (cx - srcLeft) * scale,
2524 (cy - srcTop) * scale,
2525 (dx - srcLeft) * scale,
2526 (dy - srcTop) * scale);
2527 ctx.stroke();
2528}
2529
2530function drawCurve(c) {
2531 switch (c.length) {
2532 case 4:
2533 drawLine(c[0], c[1], c[2], c[3]);
2534 break;
2535 case 6:
2536 drawQuad(c[0], c[1], c[2], c[3], c[4], c[5]);
2537 break;
caryclark1049f122015-04-20 08:31:59 -07002538 case 7:
2539 drawConicWithQuads(c[0], c[1], c[2], c[3], c[4], c[5], c[6]);
2540 break;
caryclarkdac1d172014-06-17 05:15:38 -07002541 case 8:
2542 drawCubic(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]);
2543 break;
2544 }
2545}
2546
2547function boundsWidth(pts) {
2548 var min = pts[0];
2549 var max = pts[0];
caryclark1049f122015-04-20 08:31:59 -07002550 var length = pts.length == 7 ? 6 : pts.length;
2551 for (var idx = 2; idx < length; idx += 2) {
caryclarkdac1d172014-06-17 05:15:38 -07002552 min = Math.min(min, pts[idx]);
2553 max = Math.max(max, pts[idx]);
2554 }
2555 return max - min;
2556}
2557
2558function boundsHeight(pts) {
2559 var min = pts[1];
2560 var max = pts[1];
caryclark1049f122015-04-20 08:31:59 -07002561 var length = pts.length == 7 ? 6 : pts.length;
2562 for (var idx = 3; idx < length; idx += 2) {
caryclarkdac1d172014-06-17 05:15:38 -07002563 min = Math.min(min, pts[idx]);
2564 max = Math.max(max, pts[idx]);
2565 }
2566 return max - min;
2567}
2568
2569function tangent(pts) {
2570 var dx = pts[2] - pts[0];
2571 var dy = pts[3] - pts[1];
2572 if (dx == 0 && dy == 0 && pts.length > 4) {
2573 dx = pts[4] - pts[0];
2574 dy = pts[5] - pts[1];
caryclark1049f122015-04-20 08:31:59 -07002575 if (dx == 0 && dy == 0 && pts.length == 8) {
caryclarkdac1d172014-06-17 05:15:38 -07002576 dx = pts[6] - pts[0];
2577 dy = pts[7] - pts[1];
2578 }
2579 }
2580 return Math.atan2(-dy, dx);
2581}
2582
2583function hodograph(cubic) {
2584 var hodo = [];
2585 hodo[0] = 3 * (cubic[2] - cubic[0]);
2586 hodo[1] = 3 * (cubic[3] - cubic[1]);
2587 hodo[2] = 3 * (cubic[4] - cubic[2]);
2588 hodo[3] = 3 * (cubic[5] - cubic[3]);
2589 hodo[4] = 3 * (cubic[6] - cubic[4]);
2590 hodo[5] = 3 * (cubic[7] - cubic[5]);
2591 return hodo;
2592}
2593
2594function hodograph2(cubic) {
2595 var quad = hodograph(cubic);
2596 var hodo = [];
2597 hodo[0] = 2 * (quad[2] - quad[0]);
2598 hodo[1] = 2 * (quad[3] - quad[1]);
2599 hodo[2] = 2 * (quad[4] - quad[2]);
2600 hodo[3] = 2 * (quad[5] - quad[3]);
2601 return hodo;
2602}
2603
2604function quadraticRootsReal(A, B, C, s) {
2605 if (A == 0) {
2606 if (B == 0) {
2607 s[0] = 0;
2608 return C == 0;
2609 }
2610 s[0] = -C / B;
2611 return 1;
2612 }
2613 /* normal form: x^2 + px + q = 0 */
2614 var p = B / (2 * A);
2615 var q = C / A;
2616 var p2 = p * p;
2617 if (p2 < q) {
2618 return 0;
2619 }
2620 var sqrt_D = 0;
2621 if (p2 > q) {
2622 sqrt_D = sqrt(p2 - q);
2623 }
2624 s[0] = sqrt_D - p;
2625 s[1] = -sqrt_D - p;
2626 return 1 + s[0] != s[1];
2627}
2628
2629function add_valid_ts(s, realRoots, t) {
2630 var foundRoots = 0;
2631 for (var index = 0; index < realRoots; ++index) {
2632 var tValue = s[index];
2633 if (tValue >= 0 && tValue <= 1) {
2634 for (var idx2 = 0; idx2 < foundRoots; ++idx2) {
2635 if (t[idx2] != tValue) {
2636 t[foundRoots++] = tValue;
2637 }
2638 }
2639 }
2640 }
2641 return foundRoots;
2642}
2643
2644function quadraticRootsValidT(a, b, c, t) {
2645 var s = [];
2646 var realRoots = quadraticRootsReal(A, B, C, s);
2647 var foundRoots = add_valid_ts(s, realRoots, t);
2648 return foundRoots != 0;
2649}
2650
2651function find_cubic_inflections(cubic, tValues) {
2652 var Ax = src[2] - src[0];
2653 var Ay = src[3] - src[1];
2654 var Bx = src[4] - 2 * src[2] + src[0];
2655 var By = src[5] - 2 * src[3] + src[1];
2656 var Cx = src[6] + 3 * (src[2] - src[4]) - src[0];
2657 var Cy = src[7] + 3 * (src[3] - src[5]) - src[1];
2658 return quadraticRootsValidT(Bx * Cy - By * Cx, (Ax * Cy - Ay * Cx),
2659 Ax * By - Ay * Bx, tValues);
2660}
2661
2662function dxy_at_t(curve, type, t) {
2663 var dxy = {};
2664 if (type == PATH_QUAD) {
2665 var a = t - 1;
2666 var b = 1 - 2 * t;
2667 var c = t;
2668 dxy.x = a * curve[0] + b * curve[2] + c * curve[4];
2669 dxy.y = a * curve[1] + b * curve[3] + c * curve[5];
caryclark1049f122015-04-20 08:31:59 -07002670 } else if (type == PATH_CONIC) {
2671 var p20x = curve[4] - curve[0];
2672 var p20y = curve[5] - curve[1];
2673 var p10xw = (curve[2] - curve[0]) * curve[6];
2674 var p10yw = (curve[3] - curve[1]) * curve[6];
2675 var coeff0x = curve[6] * p20x - p20x;
2676 var coeff0y = curve[6] * p20y - p20y;
2677 var coeff1x = p20x - 2 * p10xw;
2678 var coeff1y = p20y - 2 * p10yw;
2679 dxy.x = t * (t * coeff0x + coeff1x) + p10xw;
2680 dxy.y = t * (t * coeff0y + coeff1y) + p10yw;
caryclarkdac1d172014-06-17 05:15:38 -07002681 } else if (type == PATH_CUBIC) {
2682 var one_t = 1 - t;
2683 var a = curve[0];
2684 var b = curve[2];
2685 var c = curve[4];
2686 var d = curve[6];
2687 dxy.x = 3 * ((b - a) * one_t * one_t + 2 * (c - b) * t * one_t + (d - c) * t * t);
2688 a = curve[1];
2689 b = curve[3];
2690 c = curve[5];
2691 d = curve[7];
2692 dxy.y = 3 * ((b - a) * one_t * one_t + 2 * (c - b) * t * one_t + (d - c) * t * t);
2693 }
2694 return dxy;
2695}
2696
2697function drawLabel(num, px, py) {
2698 ctx.beginPath();
2699 ctx.arc(px, py, 8, 0, Math.PI*2, true);
2700 ctx.closePath();
2701 ctx.strokeStyle = "rgba(0,0,0, 0.4)";
2702 ctx.lineWidth = num == 0 || num == 3 ? 2 : 1;
2703 ctx.stroke();
2704 ctx.fillStyle = "black";
2705 ctx.font = "normal 10px Arial";
2706 // ctx.rotate(0.001);
2707 ctx.fillText(num, px - 2, py + 3);
2708 // ctx.rotate(-0.001);
2709}
2710
2711function drawLabelX(ymin, num, loc) {
2712 var px = (loc - srcLeft) * scale;
2713 var py = (ymin - srcTop) * scale - 20;
2714 drawLabel(num, px, py);
2715}
2716
2717function drawLabelY(xmin, num, loc) {
2718 var px = (xmin - srcLeft) * scale - 20;
2719 var py = (loc - srcTop) * scale;
2720 drawLabel(num, px, py);
2721}
2722
2723function drawHodoOrigin(hx, hy, hMinX, hMinY, hMaxX, hMaxY) {
2724 ctx.beginPath();
2725 ctx.moveTo(hx, hy - 100);
2726 ctx.lineTo(hx, hy);
2727 ctx.strokeStyle = hMinY < 0 ? "green" : "blue";
2728 ctx.stroke();
2729 ctx.beginPath();
2730 ctx.moveTo(hx, hy);
2731 ctx.lineTo(hx, hy + 100);
2732 ctx.strokeStyle = hMaxY > 0 ? "green" : "blue";
2733 ctx.stroke();
2734 ctx.beginPath();
2735 ctx.moveTo(hx - 100, hy);
2736 ctx.lineTo(hx, hy);
2737 ctx.strokeStyle = hMinX < 0 ? "green" : "blue";
2738 ctx.stroke();
2739 ctx.beginPath();
2740 ctx.moveTo(hx, hy);
2741 ctx.lineTo(hx + 100, hy);
2742 ctx.strokeStyle = hMaxX > 0 ? "green" : "blue";
2743 ctx.stroke();
2744}
2745
2746function scalexy(x, y, mag) {
2747 var length = Math.sqrt(x * x + y * y);
2748 return mag / length;
2749}
2750
caryclark03b03ca2015-04-23 09:13:37 -07002751function drawArrow(x, y, dx, dy, s) {
2752 var dscale = scalexy(dx, dy, 1 / scale * 100 * s);
caryclarkdac1d172014-06-17 05:15:38 -07002753 dx *= dscale;
2754 dy *= dscale;
2755 ctx.beginPath();
2756 ctx.moveTo((x - srcLeft) * scale, (y - srcTop) * scale);
2757 x += dx;
2758 y += dy;
2759 ctx.lineTo((x - srcLeft) * scale, (y - srcTop) * scale);
2760 dx /= 10;
2761 dy /= 10;
2762 ctx.lineTo((x - dy - srcLeft) * scale, (y + dx - srcTop) * scale);
2763 ctx.lineTo((x + dx * 2 - srcLeft) * scale, (y + dy * 2 - srcTop) * scale);
2764 ctx.lineTo((x + dy - srcLeft) * scale, (y - dx - srcTop) * scale);
2765 ctx.lineTo((x - srcLeft) * scale, (y - srcTop) * scale);
2766 ctx.strokeStyle = "rgba(0,75,0, 0.4)";
2767 ctx.stroke();
2768}
2769
2770function x_at_t(curve, t) {
2771 var one_t = 1 - t;
2772 if (curve.length == 4) {
2773 return one_t * curve[0] + t * curve[2];
2774 }
2775 var one_t2 = one_t * one_t;
2776 var t2 = t * t;
2777 if (curve.length == 6) {
2778 return one_t2 * curve[0] + 2 * one_t * t * curve[2] + t2 * curve[4];
2779 }
caryclark1049f122015-04-20 08:31:59 -07002780 if (curve.length == 7) {
2781 return (one_t2 * curve[0] + 2 * one_t * t * curve[2] * curve[6] + t2 * curve[4])
2782 / (one_t2 +2 * one_t * t * curve[6] + t2);
2783 }
caryclarkdac1d172014-06-17 05:15:38 -07002784 var a = one_t2 * one_t;
2785 var b = 3 * one_t2 * t;
2786 var c = 3 * one_t * t2;
2787 var d = t2 * t;
2788 return a * curve[0] + b * curve[2] + c * curve[4] + d * curve[6];
2789}
2790
2791function y_at_t(curve, t) {
2792 var one_t = 1 - t;
2793 if (curve.length == 4) {
2794 return one_t * curve[1] + t * curve[3];
2795 }
2796 var one_t2 = one_t * one_t;
2797 var t2 = t * t;
2798 if (curve.length == 6) {
2799 return one_t2 * curve[1] + 2 * one_t * t * curve[3] + t2 * curve[5];
2800 }
caryclark1049f122015-04-20 08:31:59 -07002801 if (curve.length == 7) {
2802 return (one_t2 * curve[1] + 2 * one_t * t * curve[3] * curve[6] + t2 * curve[5])
2803 / (one_t2 +2 * one_t * t * curve[6] + t2);
2804 }
caryclarkdac1d172014-06-17 05:15:38 -07002805 var a = one_t2 * one_t;
2806 var b = 3 * one_t2 * t;
2807 var c = 3 * one_t * t2;
2808 var d = t2 * t;
2809 return a * curve[1] + b * curve[3] + c * curve[5] + d * curve[7];
2810}
2811
2812function drawOrder(curve, label) {
2813 var px = x_at_t(curve, 0.75);
2814 var py = y_at_t(curve, 0.75);
2815 var _px = (px - srcLeft) * scale;
2816 var _py = (py - srcTop) * scale;
2817 ctx.beginPath();
2818 ctx.arc(_px, _py, 15, 0, Math.PI * 2, true);
2819 ctx.closePath();
2820 ctx.fillStyle = "white";
2821 ctx.fill();
2822 if (label == 'L') {
2823 ctx.strokeStyle = "rgba(255,0,0, 1)";
2824 ctx.fillStyle = "rgba(255,0,0, 1)";
2825 } else {
2826 ctx.strokeStyle = "rgba(0,0,255, 1)";
2827 ctx.fillStyle = "rgba(0,0,255, 1)";
2828 }
2829 ctx.stroke();
2830 ctx.font = "normal 16px Arial";
2831 ctx.textAlign = "center";
2832 ctx.fillText(label, _px, _py + 5);
2833 ctx.font = "normal 10px Arial";
2834}
2835
2836function drawID(curve, id) {
2837 var px = x_at_t(curve, 0.5);
2838 var py = y_at_t(curve, 0.5);
2839 var _px = (px - srcLeft) * scale;
2840 var _py = (py - srcTop) * scale;
2841 draw_id_at(id, _px, _py);
2842}
2843
2844function draw_id_at(id, _px, _py) {
2845 ctx.beginPath();
2846 ctx.arc(_px, _py, 15, 0, Math.PI * 2, true);
2847 ctx.closePath();
2848 ctx.fillStyle = "white";
2849 ctx.fill();
2850 ctx.strokeStyle = "rgba(127,127,0, 1)";
2851 ctx.fillStyle = "rgba(127,127,0, 1)";
2852 ctx.stroke();
2853 ctx.font = "normal 16px Arial";
2854 ctx.textAlign = "center";
2855 ctx.fillText(id, _px, _py + 5);
2856 ctx.font = "normal 10px Arial";
2857}
2858
2859function drawLinePartialID(id, x1, y1, x2, y2, t1, t2) {
2860 var curve = [x1, y1, x2, y2];
2861 drawCurvePartialID(id, curve, t1, t2);
2862}
2863
caryclark55888e42016-07-18 10:01:36 -07002864function drawLineID(id, x1, y1, x2, y2) {
2865 drawLinePartialID(id, x1, y1, x2, y2, 0, 1);
2866}
2867
caryclarkdac1d172014-06-17 05:15:38 -07002868function drawQuadPartialID(id, x1, y1, x2, y2, x3, y3, t1, t2) {
2869 var curve = [x1, y1, x2, y2, x3, y3];
2870 drawCurvePartialID(id, curve, t1, t2);
2871}
2872
caryclark55888e42016-07-18 10:01:36 -07002873function drawQuadID(id, x1, y1, x2, y2, x3, y3) {
2874 drawQuadPartialID(id, x1, y1, x2, y2, x3, y3, 0, 1);
2875}
2876
caryclark1049f122015-04-20 08:31:59 -07002877function drawConicPartialID(id, x1, y1, x2, y2, x3, y3, w, t1, t2) {
2878 var curve = [x1, y1, x2, y2, x3, y3, w];
2879 drawCurvePartialID(id, curve, t1, t2);
2880}
2881
caryclark55888e42016-07-18 10:01:36 -07002882function drawConicID(id, x1, y1, x2, y2, x3, y3, w) {
2883 drawConicPartialID(id, x1, y1, x2, y2, x3, y3, w, 0, 1);
2884}
2885
caryclarkdac1d172014-06-17 05:15:38 -07002886function drawCubicPartialID(id, x1, y1, x2, y2, x3, y3, x4, y4, t1, t2) {
2887 var curve = [x1, y1, x2, y2, x3, y3, x4, y4];
2888 drawCurvePartialID(id, curve, t1, t2);
2889}
2890
caryclark55888e42016-07-18 10:01:36 -07002891function drawCubicID(id, x1, y1, x2, y2, x3, y3, x4, y4) {
2892 drawCubicPartialID(id, x1, y1, x2, y2, x3, y3, x4, y4, 0, 1);
2893}
2894
caryclarkdac1d172014-06-17 05:15:38 -07002895function drawCurvePartialID(id, curve, t1, t2) {
2896 var px = x_at_t(curve, (t1 + t2) / 2);
2897 var py = y_at_t(curve, (t1 + t2) / 2);
2898 var _px = (px - srcLeft) * scale;
2899 var _py = (py - srcTop) * scale;
2900 draw_id_at(id, _px, _py);
2901}
2902
2903function drawCurveSpecials(test, curve, type) {
2904 if (pt_labels) {
2905 drawPoints(curve, type, pt_labels == 2);
2906 }
2907 if (control_lines != 0) {
2908 drawControlLines(curve, type, control_lines);
2909 }
2910 if (curve_t) {
2911 drawPointAtT(curve, type);
2912 }
2913 if (draw_midpoint) {
2914 var mid = pointAtT(curve, type, 0.5);
2915 drawPoint(mid.x, mid.y, true);
2916 }
2917 if (draw_id) {
2918 var id = idByCurve(test, curve, type);
2919 if (id >= 0) {
2920 drawID(curve, id);
2921 }
2922 }
2923 if (type == PATH_LINE) {
2924 return;
2925 }
2926 if (draw_deriviatives > 0) {
2927 var d = dxy_at_t(curve, type, 0);
caryclark03b03ca2015-04-23 09:13:37 -07002928 drawArrow(curve[0], curve[1], d.x, d.y, 1);
caryclarkdac1d172014-06-17 05:15:38 -07002929 if (draw_deriviatives == 2) {
2930 d = dxy_at_t(curve, type, 1);
2931 if (type == PATH_CUBIC) {
caryclark03b03ca2015-04-23 09:13:37 -07002932 drawArrow(curve[6], curve[7], d.x, d.y, 1);
caryclarkdac1d172014-06-17 05:15:38 -07002933 } else {
caryclark03b03ca2015-04-23 09:13:37 -07002934 drawArrow(curve[4], curve[5], d.x, d.y, 1);
caryclarkdac1d172014-06-17 05:15:38 -07002935 }
2936 }
2937 if (draw_midpoint) {
2938 var mid = pointAtT(curve, type, 0.5);
2939 d = dxy_at_t(curve, type, 0.5);
caryclark03b03ca2015-04-23 09:13:37 -07002940 drawArrow(mid.x, mid.y, d.x, d.y, 1);
caryclarkdac1d172014-06-17 05:15:38 -07002941 }
2942 }
2943 if (type != PATH_CUBIC) {
2944 return;
2945 }
caryclarkdac1d172014-06-17 05:15:38 -07002946 if (draw_sequence) {
2947 var ymin = Math.min(curve[1], curve[3], curve[5], curve[7]);
2948 for (var i = 0; i < 8; i+= 2) {
2949 drawLabelX(ymin, i >> 1, curve[i]);
2950 }
2951 var xmin = Math.min(curve[0], curve[2], curve[4], curve[6]);
2952 for (var i = 1; i < 8; i+= 2) {
2953 drawLabelY(xmin, i >> 1, curve[i]);
2954 }
2955 }
2956}
2957
2958function logCurves(test) {
2959 for (curves in test) {
2960 var curve = test[curves];
2961 dumpCurve(curve);
2962 }
2963}
2964
2965function curveToString(curve) {
2966 var str = "{{";
caryclark1049f122015-04-20 08:31:59 -07002967 var length = curve.length == 7 ? 6 : curve.length;
2968 if (curve.length == 7) {
2969 str += "{";
2970 }
2971 for (i = 0; i < length; i += 2) {
caryclarkdac1d172014-06-17 05:15:38 -07002972 str += curve[i].toFixed(decimal_places) + "," + curve[i + 1].toFixed(decimal_places);
2973 if (i < curve.length - 2) {
2974 str += "}, {";
2975 }
2976 }
caryclark1049f122015-04-20 08:31:59 -07002977 str += "}";
2978 if (curve.length == 7) {
2979 str += "}, " + curve[6].toFixed(decimal_places);
2980 }
2981 str += "}";
caryclarkdac1d172014-06-17 05:15:38 -07002982 return str;
2983}
2984
2985function dumpCurve(curve) {
2986 console.log(curveToString(curve));
2987}
2988
2989function draw(test, lines, title) {
2990 ctx.fillStyle = "rgba(0,0,0, 0.1)";
2991 ctx.font = "normal 50px Arial";
2992 ctx.textAlign = "left";
2993 ctx.fillText(title, 50, 50);
2994 ctx.font = "normal 10px Arial";
2995 ctx.lineWidth = "1.001"; "0.999";
2996 var secondPath = test.length;
2997 var closeCount = 0;
2998 logStart = -1;
2999 logRange = 0;
3000 // find last active rec type at this step
3001 var curType = test[0];
3002 var curStep = 0;
3003 var hasOp = false;
3004 var lastActive = 0;
3005 var lastAdd = 0;
caryclark624637c2015-05-11 07:21:27 -07003006 var lastCoin = 0;
caryclarkdac1d172014-06-17 05:15:38 -07003007 var lastSect = 0;
3008 var lastSort = 0;
3009 var lastMark = 0;
caryclark03b03ca2015-04-23 09:13:37 -07003010 var lastTop = 0;
caryclarkdac1d172014-06-17 05:15:38 -07003011 activeCount = 0;
3012 addCount = 0;
3013 angleCount = 0;
3014 opCount = 0;
3015 sectCount = 0;
3016 sortCount = 0;
caryclark03b03ca2015-04-23 09:13:37 -07003017 topCount = 0;
caryclarkdac1d172014-06-17 05:15:38 -07003018 markCount = 0;
3019 activeMax = 0;
3020 addMax = 0;
3021 angleMax = 0;
caryclark624637c2015-05-11 07:21:27 -07003022 coinMax = 0;
caryclarkdac1d172014-06-17 05:15:38 -07003023 opMax = 0;
3024 sectMax = 0;
3025 sectMax2 = 0;
3026 sortMax = 0;
caryclark03b03ca2015-04-23 09:13:37 -07003027 topMax = 0;
caryclarkdac1d172014-06-17 05:15:38 -07003028 markMax = 0;
3029 lastIndex = test.length - 3;
3030 for (var tIndex = 0; tIndex < test.length; tIndex += 3) {
3031 var recType = test[tIndex];
3032 if (!typeof recType == 'number' || recType < REC_TYPE_UNKNOWN || recType > REC_TYPE_LAST) {
3033 console.log("unknown rec type: " + recType);
3034 throw "stop execution";
3035 }
3036 // if (curType == recType && curType != REC_TYPE_ADD) {
3037 // continue;
3038 // }
3039 var inStepRange = step_limit == 0 || curStep < step_limit;
3040 curType = recType;
3041 if (recType == REC_TYPE_OP) {
3042 hasOp = true;
3043 continue;
3044 }
3045 if (recType == REC_TYPE_UNKNOWN) {
3046 // these types do not advance step
3047 continue;
3048 }
3049 var bumpStep = false;
3050 var records = test[tIndex + 2];
3051 var fragType = records[0];
3052 if (recType == REC_TYPE_ADD) {
3053 if (records.length != 2) {
3054 console.log("expect only two elements: " + records.length);
3055 throw "stop execution";
3056 }
3057 if (fragType == ADD_MOVETO || fragType == ADD_CLOSE) {
3058 continue;
3059 }
3060 ++addMax;
3061 if (!draw_add || !inStepRange) {
3062 continue;
3063 }
3064 lastAdd = tIndex;
3065 ++addCount;
3066 bumpStep = true;
3067 }
3068 if (recType == REC_TYPE_PATH && hasOp) {
3069 secondPath = tIndex;
3070 }
caryclark54359292015-03-26 07:52:43 -07003071 if (recType == REC_TYPE_PATH2 && hasOp) {
3072 secondPath = tIndex;
3073 }
caryclarkdac1d172014-06-17 05:15:38 -07003074 if (recType == REC_TYPE_ACTIVE) {
3075 ++activeMax;
3076 if (!draw_active || !inStepRange) {
3077 continue;
3078 }
3079 lastActive = tIndex;
3080 ++activeCount;
3081 bumpStep = true;
3082 }
3083 if (recType == REC_TYPE_ACTIVE_OP) {
3084 ++opMax;
3085 if (!draw_op || !inStepRange) {
3086 continue;
3087 }
3088 lastOp = tIndex;
3089 ++opCount;
3090 bumpStep = true;
3091 }
caryclark54359292015-03-26 07:52:43 -07003092 if (recType == REC_TYPE_AFTERPART) {
3093 if (draw_angle != 3 || !inStepRange) {
3094 continue;
3095 }
3096 lastAngle = tIndex;
3097 ++angleCount;
3098 bumpStep = true;
3099 }
caryclarkdac1d172014-06-17 05:15:38 -07003100 if (recType == REC_TYPE_ANGLE) {
3101 ++angleMax;
caryclark54359292015-03-26 07:52:43 -07003102 if (draw_angle == 0 || draw_angle == 3 || !inStepRange) {
caryclarkdac1d172014-06-17 05:15:38 -07003103 continue;
3104 }
3105 lastAngle = tIndex;
3106 ++angleCount;
3107 bumpStep = true;
3108 }
caryclark624637c2015-05-11 07:21:27 -07003109 if (recType == REC_TYPE_COINCIDENCE) {
3110 ++coinMax;
3111 if (!draw_coincidence || !inStepRange) {
3112 continue;
3113 }
3114 lastCoin = tIndex;
3115 ++coinCount;
3116 bumpStep = true;
3117 }
caryclarkdac1d172014-06-17 05:15:38 -07003118 if (recType == REC_TYPE_SECT) {
3119 if (records.length != 2) {
3120 console.log("expect only two elements: " + records.length);
3121 throw "stop execution";
3122 }
3123 ++sectMax;
3124 var sectBump = 1;
3125 switch (fragType) {
3126 case INTERSECT_LINE:
3127 case INTERSECT_QUAD_LINE:
3128 case INTERSECT_QUAD:
caryclark1049f122015-04-20 08:31:59 -07003129 case INTERSECT_CONIC_LINE:
caryclark55888e42016-07-18 10:01:36 -07003130 case INTERSECT_CONIC_QUAD:
caryclark1049f122015-04-20 08:31:59 -07003131 case INTERSECT_CONIC:
caryclarkdac1d172014-06-17 05:15:38 -07003132 case INTERSECT_SELF_CUBIC:
3133 case INTERSECT_CUBIC_LINE:
3134 case INTERSECT_CUBIC_QUAD:
3135 case INTERSECT_CUBIC:
3136 sectBump = 1;
3137 break;
3138 case INTERSECT_LINE_2:
3139 case INTERSECT_QUAD_LINE_2:
3140 case INTERSECT_QUAD_2:
caryclark1049f122015-04-20 08:31:59 -07003141 case INTERSECT_CONIC_LINE_2:
caryclark55888e42016-07-18 10:01:36 -07003142 case INTERSECT_CONIC_QUAD_2:
caryclark1049f122015-04-20 08:31:59 -07003143 case INTERSECT_CONIC_2:
caryclarkdac1d172014-06-17 05:15:38 -07003144 case INTERSECT_CUBIC_LINE_2:
3145 case INTERSECT_CUBIC_QUAD_2:
3146 case INTERSECT_CUBIC_2:
3147 sectBump = 2;
3148 break;
3149 case INTERSECT_LINE_NO:
3150 case INTERSECT_QUAD_LINE_NO:
3151 case INTERSECT_QUAD_NO:
caryclark1049f122015-04-20 08:31:59 -07003152 case INTERSECT_CONIC_LINE_NO:
caryclark55888e42016-07-18 10:01:36 -07003153 case INTERSECT_CONIC_QUAD_NO:
caryclark1049f122015-04-20 08:31:59 -07003154 case INTERSECT_CONIC_NO:
caryclarkdac1d172014-06-17 05:15:38 -07003155 case INTERSECT_SELF_CUBIC_NO:
3156 case INTERSECT_CUBIC_LINE_NO:
3157 case INTERSECT_CUBIC_QUAD_NO:
3158 case INTERSECT_CUBIC_NO:
3159 sectBump = 0;
3160 break;
3161 case INTERSECT_CUBIC_LINE_3:
3162 case INTERSECT_CUBIC_QUAD_3:
3163 case INTERSECT_CUBIC_3:
3164 sectBump = 3;
3165 break;
3166 case INTERSECT_CUBIC_QUAD_4:
3167 case INTERSECT_CUBIC_4:
3168 sectBump = 4;
3169 break;
3170 default:
3171 console.log("missing case " + records.length);
3172 throw "stop execution";
3173 }
3174 sectMax2 += sectBump;
3175 if (draw_intersection <= 1 || !inStepRange) {
3176 continue;
3177 }
3178 lastSect = tIndex;
3179 sectCount += sectBump;
3180 bumpStep = true;
3181 }
3182 if (recType == REC_TYPE_SORT) {
3183 ++sortMax;
3184 if (!draw_sort || !inStepRange) {
3185 continue;
3186 }
3187 lastSort = tIndex;
3188 ++sortCount;
3189 bumpStep = true;
3190 }
caryclark03b03ca2015-04-23 09:13:37 -07003191 if (recType == REC_TYPE_TOP) {
3192 ++topMax;
3193 if (!draw_top || !inStepRange) {
3194 continue;
3195 }
3196 lastTop = tIndex;
3197 ++topCount;
3198 bumpStep = true;
3199 }
caryclarkdac1d172014-06-17 05:15:38 -07003200 if (recType == REC_TYPE_MARK) {
3201 ++markMax;
3202 if (!draw_mark || !inStepRange) {
3203 continue;
3204 }
3205 lastMark = tIndex;
3206 ++markCount;
3207 bumpStep = true;
3208 }
3209 if (bumpStep) {
3210 lastIndex = tIndex;
3211 logStart = test[tIndex + 1];
3212 logRange = records.length / 2;
3213 ++curStep;
3214 }
3215 }
3216 stepMax = (draw_add ? addMax : 0)
3217 + (draw_active ? activeMax : 0)
reed0dc4dd62015-03-24 13:55:33 -07003218 + (draw_angle ? angleMax : 0)
caryclark624637c2015-05-11 07:21:27 -07003219 + (draw_coincidence ? coinMax : 0)
caryclark54359292015-03-26 07:52:43 -07003220 + (draw_op ? opMax : 0)
caryclarkdac1d172014-06-17 05:15:38 -07003221 + (draw_sort ? sortMax : 0)
caryclark03b03ca2015-04-23 09:13:37 -07003222 + (draw_top ? topMax : 0)
caryclarkdac1d172014-06-17 05:15:38 -07003223 + (draw_mark ? markMax : 0)
3224 + (draw_intersection == 2 ? sectMax : draw_intersection == 3 ? sectMax2 : 0);
3225 if (stepMax == 0) {
caryclark624637c2015-05-11 07:21:27 -07003226 stepMax = addMax + activeMax + angleMax + coinMax + opMax + sortMax + topMax + markMax;
caryclarkdac1d172014-06-17 05:15:38 -07003227 }
3228 drawnPts = [];
3229 drawnLines = [];
3230 drawnQuads = [];
caryclark1049f122015-04-20 08:31:59 -07003231 drawnConics = [];
caryclarkdac1d172014-06-17 05:15:38 -07003232 drawnCubics = [];
3233 focusXmin = focusYmin = Infinity;
3234 focusXmax = focusYmax = -Infinity;
3235 var pathIndex = 0;
3236 var opLetter = 'S';
3237 for (var tIndex = lastIndex; tIndex >= 0; tIndex -= 3) {
3238 var recType = test[tIndex];
3239 var records = test[tIndex + 2];
3240 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2) {
3241 var fragType = records[recordIndex];
3242 if (!typeof fragType == 'number' || fragType < 1 || fragType > FRAG_TYPE_LAST) {
3243 console.log("unknown in range frag type: " + fragType);
3244 throw "stop execution";
3245 }
3246 var frags = records[recordIndex + 1];
3247 focus_enabled = false;
3248 switch (recType) {
3249 case REC_TYPE_COMPUTED:
3250 if (draw_computed == 0) {
3251 continue;
3252 }
3253 ctx.lineWidth = 1;
3254 ctx.strokeStyle = pathIndex == 0 ? "black" : "red";
3255 ctx.fillStyle = "blue";
3256 var drawThis = false;
3257 switch (fragType) {
3258 case PATH_QUAD:
caryclark1049f122015-04-20 08:31:59 -07003259 if ((draw_computed & 0x9) == 1 || ((draw_computed & 8) != 0
3260 && (draw_computed & 7) == pathIndex)) {
caryclarkdac1d172014-06-17 05:15:38 -07003261 drawQuad(frags[0], frags[1], frags[2], frags[3],
3262 frags[4], frags[5]);
3263 drawThis = true;
3264 }
3265 break;
caryclark1049f122015-04-20 08:31:59 -07003266 case PATH_CONIC:
3267 if ((draw_computed & 0xA) == 2 || ((draw_computed & 8) != 0
3268 && (draw_computed & 7) == pathIndex)) {
3269 drawConicWithQuads(frags[0], frags[1], frags[2], frags[3],
3270 frags[4], frags[5], frags[6]);
3271 drawThis = true;
3272 }
3273 break;
caryclarkdac1d172014-06-17 05:15:38 -07003274 case PATH_CUBIC:
caryclark1049f122015-04-20 08:31:59 -07003275 if ((draw_computed & 0xC) == 4 || ((draw_computed & 8) != 0
3276 && (draw_computed & 7) == pathIndex)) {
caryclarkdac1d172014-06-17 05:15:38 -07003277 drawCubic(frags[0], frags[1], frags[2], frags[3],
3278 frags[4], frags[5], frags[6], frags[7]);
3279 drawThis = true;
3280 }
3281 ++pathIndex;
3282 break;
3283 case COMPUTED_SET_1:
3284 pathIndex = 0;
3285 break;
3286 case COMPUTED_SET_2:
3287 pathIndex = 1;
3288 break;
3289 default:
3290 console.log("unknown REC_TYPE_COMPUTED frag type: " + fragType);
3291 throw "stop execution";
3292 }
3293 if (!drawThis || collect_bounds) {
3294 break;
3295 }
3296 drawCurveSpecials(test, frags, fragType);
3297 break;
caryclark26ad22a2015-10-16 09:03:38 -07003298 case REC_TYPE_ALIGNED:
3299 if (draw_path < 4) {
3300 continue;
3301 }
caryclarkdac1d172014-06-17 05:15:38 -07003302 case REC_TYPE_PATH:
caryclark54359292015-03-26 07:52:43 -07003303 case REC_TYPE_PATH2:
caryclark26ad22a2015-10-16 09:03:38 -07003304 if (REC_TYPE_ALIGNED != recType && draw_path >= 4) {
3305 continue;
3306 }
caryclarkdac1d172014-06-17 05:15:38 -07003307 if (!draw_path) {
3308 continue;
3309 }
3310 var firstPath = tIndex < secondPath;
3311 if ((draw_path & (firstPath ? 1 : 2)) == 0) {
3312 continue;
3313 }
3314 ctx.lineWidth = 1;
3315 ctx.strokeStyle = firstPath ? "black" : "red";
3316 ctx.fillStyle = "blue";
caryclark55888e42016-07-18 10:01:36 -07003317 var frags2 = [];
caryclarkdac1d172014-06-17 05:15:38 -07003318 switch (fragType) {
3319 case PATH_LINE:
caryclark54359292015-03-26 07:52:43 -07003320 for (var i = 0; i < 4; ++ i) { frags2[i] = frags[i + 1]; }
3321 drawLine(frags2[0], frags2[1], frags2[2], frags2[3]);
caryclarkdac1d172014-06-17 05:15:38 -07003322 break;
3323 case PATH_QUAD:
caryclark54359292015-03-26 07:52:43 -07003324 for (var i = 0; i < 6; ++ i) { frags2[i] = frags[i + 1]; }
3325 drawQuad(frags2[0], frags2[1], frags2[2], frags2[3],
3326 frags2[4], frags2[5]);
caryclarkdac1d172014-06-17 05:15:38 -07003327 break;
caryclark1049f122015-04-20 08:31:59 -07003328 case PATH_CONIC:
3329 for (var i = 0; i < 7; ++ i) { frags2[i] = frags[i + 1]; }
3330 drawConicWithQuads(frags2[0], frags2[1], frags2[2], frags2[3],
3331 frags2[4], frags2[5], frags2[6]);
3332 break;
caryclarkdac1d172014-06-17 05:15:38 -07003333 case PATH_CUBIC:
caryclark54359292015-03-26 07:52:43 -07003334 for (var i = 0; i < 8; ++ i) { frags2[i] = frags[i + 1]; }
3335 drawCubic(frags2[0], frags2[1], frags2[2], frags2[3],
3336 frags2[4], frags2[5], frags2[6], frags2[7]);
caryclarkdac1d172014-06-17 05:15:38 -07003337 break;
3338 default:
caryclark26ad22a2015-10-16 09:03:38 -07003339 console.log("unknown " + recType + " frag type: " + fragType);
caryclarkdac1d172014-06-17 05:15:38 -07003340 throw "stop execution";
3341 }
3342 if (collect_bounds) {
3343 break;
3344 }
caryclark54359292015-03-26 07:52:43 -07003345 drawCurveSpecials(test, frags2, fragType);
caryclarkdac1d172014-06-17 05:15:38 -07003346 break;
3347 case REC_TYPE_OP:
3348 switch (fragType) {
3349 case OP_INTERSECT: opLetter = 'I'; break;
3350 case OP_DIFFERENCE: opLetter = 'D'; break;
3351 case OP_UNION: opLetter = 'U'; break;
3352 case OP_XOR: opLetter = 'X'; break;
3353 default:
3354 console.log("unknown REC_TYPE_OP frag type: " + fragType);
3355 throw "stop execution";
3356 }
3357 break;
3358 case REC_TYPE_ACTIVE:
3359 if (!draw_active || (step_limit > 0 && tIndex < lastActive)) {
3360 continue;
3361 }
3362 var x1 = frags[SPAN_X1];
3363 var y1 = frags[SPAN_Y1];
3364 var x2 = frags[SPAN_X2];
3365 var y2 = frags[SPAN_Y2];
caryclark55888e42016-07-18 10:01:36 -07003366 var x3, y3, x3, y4, w;
caryclarkdac1d172014-06-17 05:15:38 -07003367 ctx.lineWidth = 3;
3368 ctx.strokeStyle = "rgba(0,0,255, 0.3)";
3369 focus_enabled = true;
3370 switch (fragType) {
3371 case ACTIVE_LINE_SPAN:
caryclark55888e42016-07-18 10:01:36 -07003372 drawLine(x1, y1, x2, y2);
caryclarkdac1d172014-06-17 05:15:38 -07003373 if (draw_id) {
caryclark55888e42016-07-18 10:01:36 -07003374 drawLineID(frags[0], x1, y1, x2, y2);
3375 }
3376 if (pt_labels) {
3377 var curve = [x1, y1, x2, y2];
3378 ctx.fillStyle = "blue";
3379 drawPoints(curve, PATH_LINE, pt_labels == 2);
caryclarkdac1d172014-06-17 05:15:38 -07003380 }
3381 break;
3382 case ACTIVE_QUAD_SPAN:
3383 x3 = frags[SPAN_X3];
3384 y3 = frags[SPAN_Y3];
caryclark55888e42016-07-18 10:01:36 -07003385 drawQuad(x1, y1, x2, y2, x3, y3);
caryclarkdac1d172014-06-17 05:15:38 -07003386 if (draw_id) {
caryclark55888e42016-07-18 10:01:36 -07003387 drawQuadID(frags[0], x1, y1, x2, y2, x3, y3);
3388 }
3389 if (pt_labels) {
3390 var curve = [x1, y1, x2, y2, x3, y3];
3391 ctx.fillStyle = "blue";
3392 drawPoints(curve, PATH_QUAD, pt_labels == 2);
caryclarkdac1d172014-06-17 05:15:38 -07003393 }
3394 break;
caryclark1049f122015-04-20 08:31:59 -07003395 case ACTIVE_CONIC_SPAN:
3396 x3 = frags[SPAN_X3];
3397 y3 = frags[SPAN_Y3];
caryclark1049f122015-04-20 08:31:59 -07003398 w = frags[SPAN_K_W];
caryclark55888e42016-07-18 10:01:36 -07003399 drawConicWithQuads(x1, y1, x2, y2, x3, y3, w);
caryclark1049f122015-04-20 08:31:59 -07003400 if (draw_id) {
caryclark55888e42016-07-18 10:01:36 -07003401 drawConicID(frags[0], x1, y1, x2, y2, x3, y3, w);
3402 }
3403 if (pt_labels) {
3404 var curve = [x1, y1, x2, y2, x3, y3, w];
3405 ctx.fillStyle = "blue";
3406 drawPoints(curve, PATH_CONIC, pt_labels == 2);
caryclark1049f122015-04-20 08:31:59 -07003407 }
3408 break;
caryclarkdac1d172014-06-17 05:15:38 -07003409 case ACTIVE_CUBIC_SPAN:
3410 x3 = frags[SPAN_X3];
3411 y3 = frags[SPAN_Y3];
3412 x4 = frags[SPAN_X4];
3413 y4 = frags[SPAN_Y4];
caryclark55888e42016-07-18 10:01:36 -07003414 drawCubic(x1, y1, x2, y2, x3, y3, x4, y4);
caryclarkdac1d172014-06-17 05:15:38 -07003415 if (draw_id) {
caryclark55888e42016-07-18 10:01:36 -07003416 drawCubicID(frags[0], x1, y1, x2, y2, x3, y3, x4, y4);
3417 }
3418 if (pt_labels) {
3419 var curve = [x1, y1, x2, y2, x3, y3, x4, y4];
3420 ctx.fillStyle = "blue";
3421 drawPoints(curve, PATH_CUBIC, pt_labels == 2);
caryclarkdac1d172014-06-17 05:15:38 -07003422 }
3423 break;
3424 default:
3425 console.log("unknown REC_TYPE_ACTIVE frag type: " + fragType);
3426 throw "stop execution";
3427 }
3428 break;
3429 case REC_TYPE_ACTIVE_OP:
3430 if (!draw_op || (step_limit > 0 && tIndex < lastOp)) {
3431 continue;
3432 }
3433 focus_enabled = true;
3434 ctx.lineWidth = 3;
3435 var activeSpan = frags[7] == "1";
3436 ctx.strokeStyle = activeSpan ? "rgba(45,160,0, 0.3)" : "rgba(255,45,0, 0.5)";
3437 var curve = curvePartialByID(test, frags[0], frags[1], frags[2]);
3438 drawCurve(curve);
3439 if (draw_op > 1) {
3440 drawArc(curve, false, frags[3], frags[4]);
3441 drawArc(curve, true, frags[5], frags[6]);
3442 }
3443 break;
3444 case REC_TYPE_ADD:
3445 if (!draw_add) {
3446 continue;
3447 }
3448 ctx.lineWidth = 3;
3449 ctx.strokeStyle = closeCount == 0 ? "rgba(0,0,255, 0.3)"
3450 : closeCount == 1 ? "rgba(0,127,0, 0.3)"
3451 : closeCount == 2 ? "rgba(0,127,127, 0.3)"
3452 : closeCount == 3 ? "rgba(127,127,0, 0.3)"
3453 : "rgba(127,0,127, 0.3)";
3454 focus_enabled = true;
3455 switch (fragType) {
3456 case ADD_MOVETO:
3457 break;
3458 case ADD_LINETO:
3459 if (step_limit == 0 || tIndex >= lastAdd) {
3460 drawLine(frags[0], frags[1], frags[2], frags[3]);
3461 }
3462 break;
3463 case ADD_QUADTO:
3464 if (step_limit == 0 || tIndex >= lastAdd) {
3465 drawQuad(frags[0], frags[1], frags[2], frags[3], frags[4], frags[5]);
3466 }
3467 break;
caryclark1049f122015-04-20 08:31:59 -07003468 case ADD_CONICTO:
3469 if (step_limit == 0 || tIndex >= lastAdd) {
3470 drawConicWithQuads(frags[0], frags[1], frags[2], frags[3],
3471 frags[4], frags[5], frags[6]);
3472 }
3473 break;
caryclarkdac1d172014-06-17 05:15:38 -07003474 case ADD_CUBICTO:
3475 if (step_limit == 0 || tIndex >= lastAdd) {
3476 drawCubic(frags[0], frags[1], frags[2], frags[3],
3477 frags[4], frags[5], frags[6], frags[7]);
3478 }
3479 break;
3480 case ADD_CLOSE:
3481 ++closeCount;
3482 break;
3483 case ADD_FILL:
3484 break;
3485 default:
3486 console.log("unknown REC_TYPE_ADD frag type: " + fragType);
3487 throw "stop execution";
3488 }
3489 break;
3490 case REC_TYPE_ANGLE:
caryclark54359292015-03-26 07:52:43 -07003491 angleBetween = frags[18] == "T";
3492 afterIndex = 0;
3493 if (draw_angle == 0 || draw_angle == 3 || (step_limit > 0 && tIndex < lastAngle)) {
caryclarkdac1d172014-06-17 05:15:38 -07003494 continue;
3495 }
3496 focus_enabled = true;
3497 ctx.lineWidth = 3;
3498 ctx.strokeStyle = "rgba(127,45,127, 0.3)";
caryclark54359292015-03-26 07:52:43 -07003499 var leftCurve = curvePartialByID(test, frags[0], frags[4], frags[5]);
3500 var midCurve = curvePartialByID(test, frags[6], frags[10], frags[11]);
3501 var rightCurve = curvePartialByID(test, frags[12], frags[16], frags[17]);
caryclarkdac1d172014-06-17 05:15:38 -07003502 drawCurve(leftCurve);
3503 drawCurve(rightCurve);
caryclark54359292015-03-26 07:52:43 -07003504 ctx.strokeStyle = angleBetween ? "rgba(0,160,45, 0.3)" : "rgba(255,0,45, 0.5)";
caryclarkdac1d172014-06-17 05:15:38 -07003505 drawCurve(midCurve);
3506 if (draw_angle > 1) {
3507 drawOrder(leftCurve, 'L');
3508 drawOrder(rightCurve, 'R');
3509 }
3510 break;
caryclark54359292015-03-26 07:52:43 -07003511 case REC_TYPE_AFTERPART:
3512 if (draw_angle != 3 || (step_limit > 0 && tIndex < lastAngle)) {
3513 continue;
3514 }
3515 ctx.strokeStyle = afterIndex == 0 ? "rgba(255,0,0, 1.0)"
3516 : (afterIndex == 1) == angleBetween ? "rgba(0,128,0, 1.0)"
3517 : "rgba(0,0,255, 1.0)";
3518 switch (fragType) {
3519 case PATH_LINE:
3520 drawLine(frags[0], frags[1], frags[2], frags[3]);
3521 break;
3522 case PATH_QUAD:
3523 drawQuad(frags[0], frags[1], frags[2], frags[3],
3524 frags[4], frags[5]);
3525 break;
caryclark1049f122015-04-20 08:31:59 -07003526 case PATH_CONIC:
3527 drawConicWithQuads(frags[0], frags[1], frags[2], frags[3],
3528 frags[4], frags[5], frags[6]);
3529 break;
caryclark54359292015-03-26 07:52:43 -07003530 case PATH_CUBIC:
3531 drawCubic(frags[0], frags[1], frags[2], frags[3],
caryclark1049f122015-04-20 08:31:59 -07003532 frags[4], frags[5], frags[6], frags[7]);
caryclark54359292015-03-26 07:52:43 -07003533 break;
3534 default:
3535 console.log("unknown REC_TYPE_AFTERPART frag type: " + fragType);
3536 throw "stop execution";
3537 }
3538 ++afterIndex;
3539 break;
caryclark624637c2015-05-11 07:21:27 -07003540 case REC_TYPE_COINCIDENCE:
3541 if (!draw_coincidence || (step_limit > 0 && tIndex < lastCoin)) {
3542 continue;
3543 }
3544 focus_enabled = true;
3545 ctx.lineWidth = 3;
3546 ctx.strokeStyle = "rgba(127,45,63, 0.3)";
3547 var curve = curvePartialByID(test, frags[0], frags[1], frags[2]);
3548 drawCurve(curve);
3549 break;
caryclarkdac1d172014-06-17 05:15:38 -07003550 case REC_TYPE_SECT:
3551 if (!draw_intersection) {
3552 continue;
3553 }
3554 if (draw_intersection != 1 && (step_limit > 0 && tIndex < lastSect)) {
3555 continue;
3556 }
3557 // draw_intersection == 1 : show all
3558 // draw_intersection == 2 : step == 0 ? show all : show intersection line #step
3559 // draw_intersection == 3 : step == 0 ? show all : show intersection #step
3560 ctx.lineWidth = 1;
3561 ctx.strokeStyle = "rgba(0,0,255, 0.3)";
3562 ctx.fillStyle = "blue";
3563 focus_enabled = true;
3564 var f = [];
3565 var c1s;
3566 var c1l;
3567 var c2s;
3568 var c2l;
3569 switch (fragType) {
3570 case INTERSECT_LINE:
3571 f.push(5, 6, 0, 7);
3572 c1s = 1; c1l = 4; c2s = 8; c2l = 4;
3573 break;
3574 case INTERSECT_LINE_2:
3575 f.push(5, 6, 0, 10);
3576 f.push(8, 9, 7, 15);
3577 c1s = 1; c1l = 4; c2s = 11; c2l = 4;
3578 break;
3579 case INTERSECT_LINE_NO:
3580 c1s = 0; c1l = 4; c2s = 4; c2l = 4;
3581 break;
3582 case INTERSECT_QUAD_LINE:
3583 f.push(7, 8, 0, 9);
3584 c1s = 1; c1l = 6; c2s = 10; c2l = 4;
3585 break;
3586 case INTERSECT_QUAD_LINE_2:
3587 f.push(7, 8, 0, 12);
3588 f.push(10, 11, 9, 17);
3589 c1s = 1; c1l = 6; c2s = 13; c2l = 4;
3590 break;
3591 case INTERSECT_QUAD_LINE_NO:
3592 c1s = 0; c1l = 6; c2s = 6; c2l = 4;
3593 break;
3594 case INTERSECT_QUAD:
3595 f.push(7, 8, 0, 9);
3596 c1s = 1; c1l = 6; c2s = 10; c2l = 6;
3597 break;
3598 case INTERSECT_QUAD_2:
3599 f.push(7, 8, 0, 12);
3600 f.push(10, 11, 9, 19);
3601 c1s = 1; c1l = 6; c2s = 13; c2l = 6;
3602 break;
3603 case INTERSECT_QUAD_NO:
3604 c1s = 0; c1l = 6; c2s = 6; c2l = 6;
3605 break;
caryclark1049f122015-04-20 08:31:59 -07003606 case INTERSECT_CONIC_LINE:
3607 f.push(8, 9, 0, 10);
3608 c1s = 1; c1l = 7; c2s = 11; c2l = 4;
3609 break;
3610 case INTERSECT_CONIC_LINE_2:
3611 f.push(8, 9, 0, 12);
3612 f.push(11, 12, 10, 18);
3613 c1s = 1; c1l = 7; c2s = 14; c2l = 4;
3614 break;
3615 case INTERSECT_CONIC_LINE_NO:
3616 c1s = 0; c1l = 7; c2s = 7; c2l = 4;
3617 break;
caryclark55888e42016-07-18 10:01:36 -07003618 case INTERSECT_CONIC_QUAD:
3619 f.push(8, 9, 0, 10);
3620 c1s = 1; c1l = 7; c2s = 11; c2l = 6;
3621 break;
3622 case INTERSECT_CONIC_QUAD_2:
3623 f.push(8, 9, 0, 12);
3624 f.push(11, 12, 10, 18);
3625 c1s = 1; c1l = 7; c2s = 14; c2l = 6;
3626 break;
3627 case INTERSECT_CONIC_QUAD_NO:
3628 c1s = 0; c1l = 7; c2s = 7; c2l = 6;
3629 break;
caryclark1049f122015-04-20 08:31:59 -07003630 case INTERSECT_CONIC:
3631 f.push(8, 9, 0, 10);
3632 c1s = 1; c1l = 7; c2s = 11; c2l = 7;
3633 break;
3634 case INTERSECT_CONIC_2:
3635 f.push(8, 9, 0, 13);
3636 f.push(11, 12, 10, 21);
3637 c1s = 1; c1l = 7; c2s = 14; c2l = 7;
3638 break;
3639 case INTERSECT_CONIC_NO:
3640 c1s = 0; c1l = 7; c2s = 7; c2l = 7;
3641 break;
caryclarkdac1d172014-06-17 05:15:38 -07003642 case INTERSECT_SELF_CUBIC:
3643 f.push(9, 10, 0, 11);
3644 c1s = 1; c1l = 8; c2s = 0; c2l = 0;
3645 break;
3646 case INTERSECT_SELF_CUBIC_NO:
3647 c1s = 0; c1l = 8; c2s = 0; c2l = 0;
3648 break;
3649 case INTERSECT_CUBIC_LINE:
3650 f.push(9, 10, 0, 11);
3651 c1s = 1; c1l = 8; c2s = 12; c2l = 4;
3652 break;
3653 case INTERSECT_CUBIC_LINE_2:
3654 f.push(9, 10, 0, 14);
3655 f.push(12, 13, 11, 19);
3656 c1s = 1; c1l = 8; c2s = 15; c2l = 4;
3657 break;
3658 case INTERSECT_CUBIC_LINE_3:
3659 f.push(9, 10, 0, 17);
3660 f.push(12, 13, 11, 22);
3661 f.push(15, 16, 14, 23);
3662 c1s = 1; c1l = 8; c2s = 18; c2l = 4;
3663 break;
3664 case INTERSECT_CUBIC_QUAD_NO:
3665 c1s = 0; c1l = 8; c2s = 8; c2l = 6;
3666 break;
3667 case INTERSECT_CUBIC_QUAD:
3668 f.push(9, 10, 0, 11);
3669 c1s = 1; c1l = 8; c2s = 12; c2l = 6;
3670 break;
3671 case INTERSECT_CUBIC_QUAD_2:
3672 f.push(9, 10, 0, 14);
3673 f.push(12, 13, 11, 21);
3674 c1s = 1; c1l = 8; c2s = 15; c2l = 6;
3675 break;
3676 case INTERSECT_CUBIC_QUAD_3:
3677 f.push(9, 10, 0, 17);
3678 f.push(12, 13, 11, 24);
3679 f.push(15, 16, 14, 25);
3680 c1s = 1; c1l = 8; c2s = 18; c2l = 6;
3681 break;
3682 case INTERSECT_CUBIC_QUAD_4:
3683 f.push(9, 10, 0, 20);
3684 f.push(12, 13, 11, 27);
3685 f.push(15, 16, 14, 28);
3686 f.push(18, 19, 17, 29);
3687 c1s = 1; c1l = 8; c2s = 21; c2l = 6;
3688 break;
3689 case INTERSECT_CUBIC_LINE_NO:
3690 c1s = 0; c1l = 8; c2s = 8; c2l = 4;
3691 break;
3692 case INTERSECT_CUBIC:
3693 f.push(9, 10, 0, 11);
3694 c1s = 1; c1l = 8; c2s = 12; c2l = 8;
3695 break;
3696 case INTERSECT_CUBIC_2:
3697 f.push(9, 10, 0, 14);
3698 f.push(12, 13, 11, 23);
3699 c1s = 1; c1l = 8; c2s = 15; c2l = 8;
3700 break;
3701 case INTERSECT_CUBIC_3:
3702 f.push(9, 10, 0, 17);
3703 f.push(12, 13, 11, 26);
3704 f.push(15, 16, 14, 27);
3705 c1s = 1; c1l = 8; c2s = 18; c2l = 8;
3706 break;
3707 case INTERSECT_CUBIC_4:
3708 f.push(9, 10, 0, 20);
3709 f.push(12, 13, 11, 29);
3710 f.push(15, 16, 14, 30);
3711 f.push(18, 19, 17, 31);
3712 c1s = 1; c1l = 8; c2s = 21; c2l = 8;
3713 break;
3714 case INTERSECT_CUBIC_NO:
3715 c1s = 0; c1l = 8; c2s = 8; c2l = 8;
3716 break;
3717 default:
3718 console.log("unknown REC_TYPE_SECT frag type: " + fragType);
3719 throw "stop execution";
3720 }
3721 if (draw_intersection != 1) {
3722 var id = -1;
3723 var curve;
3724 switch (c1l) {
caryclark55888e42016-07-18 10:01:36 -07003725 case 4:
caryclarkdac1d172014-06-17 05:15:38 -07003726 drawLine(frags[c1s], frags[c1s + 1], frags[c1s + 2], frags[c1s + 3]);
3727 if (draw_id) {
3728 curve = [frags[c1s], frags[c1s + 1], frags[c1s + 2], frags[c1s + 3]];
3729 id = idByCurve(test, curve, PATH_LINE);
3730 }
3731 break;
3732 case 6:
3733 drawQuad(frags[c1s], frags[c1s + 1], frags[c1s + 2], frags[c1s + 3],
3734 frags[c1s + 4], frags[c1s + 5]);
3735 if (draw_id) {
3736 curve = [frags[c1s], frags[c1s + 1], frags[c1s + 2], frags[c1s + 3],
3737 frags[c1s + 4], frags[c1s + 5]];
3738 id = idByCurve(test, curve, PATH_QUAD);
3739 }
3740 break;
caryclark1049f122015-04-20 08:31:59 -07003741 case 7:
3742 drawConicWithQuads(frags[c1s], frags[c1s + 1], frags[c1s + 2], frags[c1s + 3],
3743 frags[c1s + 4], frags[c1s + 5], frags[c1s + 6]);
3744 if (draw_id) {
3745 curve = [frags[c1s], frags[c1s + 1], frags[c1s + 2], frags[c1s + 3],
3746 frags[c1s + 4], frags[c1s + 5], frags[c1s + 6]];
3747 id = idByCurve(test, curve, PATH_CONIC);
3748 }
3749 break;
caryclarkdac1d172014-06-17 05:15:38 -07003750 case 8:
3751 drawCubic(frags[c1s], frags[c1s + 1], frags[c1s + 2], frags[c1s + 3],
3752 frags[c1s + 4], frags[c1s + 5], frags[c1s + 6], frags[c1s + 7]);
3753 if (draw_id) {
3754 curve = [frags[c1s], frags[c1s + 1], frags[c1s + 2], frags[c1s + 3],
3755 frags[c1s + 4], frags[c1s + 5], frags[c1s + 6], frags[c1s + 7]];
3756 id = idByCurve(test, curve, PATH_CUBIC);
3757 }
3758 break;
3759 }
3760 if (id >= 0) {
3761 drawID(curve, id);
3762 }
3763 id = -1;
3764 switch (c2l) {
3765 case 0:
3766 break;
caryclark55888e42016-07-18 10:01:36 -07003767 case 4:
caryclarkdac1d172014-06-17 05:15:38 -07003768 drawLine(frags[c2s], frags[c2s + 1], frags[c2s + 2], frags[c2s + 3]);
3769 if (draw_id) {
3770 curve = [frags[c2s], frags[c2s + 1], frags[c2s + 2], frags[c2s + 3]];
3771 id = idByCurve(test, curve, PATH_LINE);
3772 }
3773 break;
3774 case 6:
3775 drawQuad(frags[c2s], frags[c2s + 1], frags[c2s + 2], frags[c2s + 3],
3776 frags[c2s + 4], frags[c2s + 5]);
3777 if (draw_id) {
3778 curve = [frags[c2s], frags[c2s + 1], frags[c2s + 2], frags[c2s + 3],
3779 frags[c2s + 4], frags[c2s + 5]];
3780 id = idByCurve(test, curve, PATH_QUAD);
3781 }
3782 break;
caryclark1049f122015-04-20 08:31:59 -07003783 case 7:
3784 drawConicWithQuads(frags[c2s], frags[c2s + 1], frags[c2s + 2], frags[c2s + 3],
3785 frags[c2s + 4], frags[c2s + 5], frags[c2s + 6]);
3786 if (draw_id) {
3787 curve = [frags[c2s], frags[c2s + 1], frags[c2s + 2], frags[c2s + 3],
3788 frags[c2s + 4], frags[c2s + 5], frags[c2s + 6]];
3789 id = idByCurve(test, curve, PATH_CONIC);
3790 }
3791 break;
caryclarkdac1d172014-06-17 05:15:38 -07003792 case 8:
3793 drawCubic(frags[c2s], frags[c2s + 1], frags[c2s + 2], frags[c2s + 3],
3794 frags[c2s + 4], frags[c2s + 5], frags[c2s + 6], frags[c2s + 7]);
3795 if (draw_id) {
3796 curve = [frags[c2s], frags[c2s + 1], frags[c2s + 2], frags[c2s + 3],
3797 frags[c2s + 4], frags[c2s + 5], frags[c2s + 6], frags[c2s + 7]];
3798 id = idByCurve(test, curve, PATH_CUBIC);
3799 }
3800 break;
3801 }
3802 if (id >= 0) {
3803 drawID(curve, id);
3804 }
3805 }
3806 if (collect_bounds) {
3807 break;
3808 }
caryclark54359292015-03-26 07:52:43 -07003809 if (draw_intersection != 3 || step_limit == 0 || tIndex >= lastSect) {
3810 for (var idx = 0; idx < f.length; idx += 4) {
caryclarkdac1d172014-06-17 05:15:38 -07003811 drawPoint(frags[f[idx]], frags[f[idx + 1]], true);
3812 }
3813 }
3814 if (!draw_intersectT) {
3815 break;
3816 }
3817 ctx.fillStyle = "red";
caryclark54359292015-03-26 07:52:43 -07003818 if (draw_intersection != 3 || step_limit == 0 || tIndex >= lastSect) {
3819 for (var idx = 0; idx < f.length; idx += 4) {
caryclarkdac1d172014-06-17 05:15:38 -07003820 drawTAtPointUp(frags[f[idx]], frags[f[idx + 1]], frags[f[idx + 2]]);
3821 drawTAtPointDown(frags[f[idx]], frags[f[idx + 1]], frags[f[idx + 3]]);
3822 }
3823 }
3824 break;
3825 case REC_TYPE_SORT:
3826 if (!draw_sort || (step_limit > 0 && tIndex < lastSort)) {
3827 continue;
3828 }
3829 ctx.lineWidth = 3;
3830 ctx.strokeStyle = "rgba(127,127,0, 0.5)";
3831 focus_enabled = true;
3832 switch (fragType) {
3833 case SORT_UNARY:
3834 case SORT_BINARY:
3835 var curve = curvePartialByID(test, frags[0], frags[6], frags[8]);
3836 drawCurve(curve);
3837 break;
3838 default:
3839 console.log("unknown REC_TYPE_SORT frag type: " + fragType);
3840 throw "stop execution";
3841 }
3842 break;
caryclark03b03ca2015-04-23 09:13:37 -07003843 case REC_TYPE_TOP:
3844 if (!draw_top || (step_limit > 0 && tIndex < lastTop)) {
3845 continue;
3846 }
3847 ctx.lineWidth = 3;
3848 ctx.strokeStyle = "rgba(127,127,0, 0.5)";
3849 focus_enabled = true;
3850 {
3851 var curve = curvePartialByID(test, frags[0], frags[1], frags[2]);
3852 drawCurve(curve);
3853 var type = PATH_LINE + (curve.length / 2 - 2);
3854 var mid = pointAtT(curve, type, 0.5);
3855 var d = dxy_at_t(curve, type, 0.5);
3856 drawArrow(mid.x, mid.y, d.x, d.y, 0.3);
3857 }
3858 break;
caryclarkdac1d172014-06-17 05:15:38 -07003859 case REC_TYPE_MARK:
3860 if (!draw_mark || (step_limit > 0 && tIndex < lastMark)) {
3861 continue;
3862 }
3863 ctx.lineWidth = 3;
3864 ctx.strokeStyle = fragType >= MARK_DONE_LINE ?
3865 "rgba(127,0,127, 0.5)" : "rgba(127,127,0, 0.5)";
3866 focus_enabled = true;
3867 switch (fragType) {
3868 case MARK_LINE:
3869 case MARK_DONE_LINE:
3870 case MARK_UNSORTABLE_LINE:
3871 case MARK_SIMPLE_LINE:
3872 case MARK_SIMPLE_DONE_LINE:
3873 case MARK_DONE_UNARY_LINE:
3874 drawLinePartial(frags[1], frags[2], frags[3], frags[4],
3875 frags[5], frags[9]);
3876 if (draw_id) {
3877 drawLinePartialID(frags[0], frags[1], frags[2], frags[3], frags[4],
3878 frags[5], frags[9]);
3879 }
3880 break;
3881 case MARK_QUAD:
3882 case MARK_DONE_QUAD:
3883 case MARK_UNSORTABLE_QUAD:
3884 case MARK_SIMPLE_QUAD:
3885 case MARK_SIMPLE_DONE_QUAD:
3886 case MARK_DONE_UNARY_QUAD:
3887 drawQuadPartial(frags[1], frags[2], frags[3], frags[4],
3888 frags[5], frags[6], frags[7], frags[11]);
3889 if (draw_id) {
3890 drawQuadPartialID(frags[0], frags[1], frags[2], frags[3], frags[4],
3891 frags[5], frags[6], frags[7], frags[11]);
3892 }
3893 break;
3894 case MARK_CUBIC:
3895 case MARK_DONE_CUBIC:
3896 case MARK_UNSORTABLE_CUBIC:
3897 case MARK_SIMPLE_CUBIC:
3898 case MARK_SIMPLE_DONE_CUBIC:
3899 case MARK_DONE_UNARY_CUBIC:
3900 drawCubicPartial(frags[1], frags[2], frags[3], frags[4],
3901 frags[5], frags[6], frags[7], frags[8], frags[9], frags[13]);
3902 if (draw_id) {
3903 drawCubicPartialID(frags[0], frags[1], frags[2], frags[3], frags[4],
3904 frags[5], frags[6], frags[7], frags[8], frags[9], frags[13]);
3905 }
3906 break;
3907 case MARK_ANGLE_LAST:
3908 // FIXME: ignored for now
3909 break;
3910 default:
3911 console.log("unknown REC_TYPE_MARK frag type: " + fragType);
3912 throw "stop execution";
3913 }
3914 break;
3915 default:
3916 continue;
3917 }
3918 }
3919 switch (recType) {
3920 case REC_TYPE_SORT:
3921 if (!draw_sort || (step_limit > 0 && tIndex < lastSort)) {
3922 break;
3923 }
3924 var angles = []; // use tangent lines to describe arcs
3925 var windFrom = [];
3926 var windTo = [];
3927 var opp = [];
3928 var minXY = Number.MAX_VALUE;
3929 var partial;
3930 focus_enabled = true;
3931 var someUnsortable = false;
3932 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2) {
3933 var fragType = records[recordIndex];
3934 var frags = records[recordIndex + 1];
3935 var unsortable = (fragType == SORT_UNARY && frags[14]) ||
3936 (fragType == SORT_BINARY && frags[16]);
3937 someUnsortable |= unsortable;
3938 switch (fragType) {
3939 case SORT_UNARY:
3940 case SORT_BINARY:
3941 partial = curvePartialByID(test, frags[0], frags[6], frags[8]);
3942 break;
3943 default:
3944 console.log("unknown REC_TYPE_SORT frag type: " + fragType);
3945 throw "stop execution";
3946 }
3947 var dx = boundsWidth(partial);
3948 var dy = boundsHeight(partial);
3949 minXY = Math.min(minXY, dx * dx + dy * dy);
3950 if (collect_bounds) {
3951 continue;
3952 }
3953 angles.push(tangent(partial));
3954 var from = frags[12];
3955 var to = frags[12];
3956 var sgn = frags[10];
3957 if (sgn < 0) {
3958 from -= frags[11];
3959 } else if (sgn > 0) {
3960 to -= frags[11];
3961 }
3962 windFrom.push(from + (unsortable ? "!" : ""));
3963 windTo.push(to + (unsortable ? "!" : ""));
3964 opp.push(fragType == SORT_BINARY);
3965 if (draw_sort == 1) {
3966 drawOrder(partial, frags[12]);
3967 } else {
3968 drawOrder(partial, (recordIndex / 2) + 1);
3969 }
3970 }
3971 var radius = Math.sqrt(minXY) / 2 * scale;
3972 radius = Math.min(50, radius);
3973 var scaledRadius = radius / scale;
3974 var centerX = partial[0];
3975 var centerY = partial[1];
3976 if (collect_bounds) {
3977 if (focus_enabled) {
3978 focusXmin = Math.min(focusXmin, centerX - scaledRadius);
3979 focusYmin = Math.min(focusYmin, centerY - scaledRadius);
3980 focusXmax = Math.max(focusXmax, centerX + scaledRadius);
3981 focusYmax = Math.max(focusYmax, centerY + scaledRadius);
3982 }
3983 break;
3984 }
3985 break;
3986 default:
3987 break;
3988 }
3989 }
3990 if (collect_bounds) {
3991 return;
3992 }
3993 if (draw_log && logStart >= 0) {
3994 ctx.font = "normal 10px Arial";
3995 ctx.textAlign = "left";
3996 ctx.beginPath();
3997 var top = screenHeight - 20 - (logRange + 2) * 10;
3998 ctx.rect(50, top, screenWidth - 100, (logRange + 2) * 10);
3999 ctx.fillStyle = "white";
4000 ctx.fill();
4001 ctx.fillStyle = "rgba(0,0,0, 0.5)";
4002 if (logStart > 0) {
4003 ctx.fillText(lines[logStart - 1], 50, top + 8);
4004 }
4005 ctx.fillStyle = "black";
4006 for (var idx = 0; idx < logRange; ++idx) {
4007 ctx.fillText(lines[logStart + idx], 50, top + 18 + 10 * idx);
4008 }
4009 ctx.fillStyle = "rgba(0,0,0, 0.5)";
4010 if (logStart + logRange < lines.length) {
4011 ctx.fillText(lines[logStart + logRange], 50, top + 18 + 10 * logRange);
4012 }
4013 }
4014 if (draw_legend) {
4015 var pos = 0;
caryclark624637c2015-05-11 07:21:27 -07004016 var drawSomething = draw_add | draw_active | draw_angle | draw_coincidence | draw_sort | draw_mark;
caryclarkdac1d172014-06-17 05:15:38 -07004017 // drawBox(pos++, "yellow", "black", opLetter, true, '');
4018 drawBox(pos++, "rgba(0,0,255, 0.3)", "black", draw_intersection > 1 ? sectCount : sectMax2, draw_intersection, intersectionKey);
4019 drawBox(pos++, "rgba(0,0,255, 0.3)", "black", draw_add ? addCount : addMax, draw_add, addKey);
4020 drawBox(pos++, "rgba(0,0,255, 0.3)", "black", draw_active ? activeCount : activeMax, draw_active, activeKey);
4021 drawBox(pos++, "rgba(127,127,0, 0.3)", "black", draw_angle ? angleCount : angleMax, draw_angle, angleKey);
caryclark624637c2015-05-11 07:21:27 -07004022 drawBox(pos++, "rgba(127,127,0, 0.3)", "black", draw_coincidence ? coinCount : coinMax, draw_coincidence, coincidenceKey);
caryclarkdac1d172014-06-17 05:15:38 -07004023 drawBox(pos++, "rgba(127,127,0, 0.3)", "black", draw_op ? opCount : opMax, draw_op, opKey);
4024 drawBox(pos++, "rgba(127,127,0, 0.3)", "black", draw_sort ? sortCount : sortMax, draw_sort, sortKey);
caryclark03b03ca2015-04-23 09:13:37 -07004025 drawBox(pos++, "rgba(127,127,0, 0.3)", "black", draw_top ? topCount : topMax, draw_top, topKey);
caryclarkdac1d172014-06-17 05:15:38 -07004026 drawBox(pos++, "rgba(127,0,127, 0.3)", "black", draw_mark ? markCount : markMax, draw_mark, markKey);
caryclark55888e42016-07-18 10:01:36 -07004027 drawBox(pos++, "black", "white",
caryclark26ad22a2015-10-16 09:03:38 -07004028 (new Array('P', 'P1', 'P2', 'P', 'p', 'p1', 'p2'))[draw_path], draw_path != 0, pathKey);
caryclarkdac1d172014-06-17 05:15:38 -07004029 drawBox(pos++, "rgba(0,63,0, 0.7)", "white",
4030 (new Array('Q', 'Q', 'C', 'QC', 'Qc', 'Cq'))[draw_computed],
4031 draw_computed != 0, computedKey);
4032 drawBox(pos++, "green", "black", step_limit, drawSomething, '');
4033 drawBox(pos++, "green", "black", stepMax, drawSomething, '');
4034 drawBox(pos++, "rgba(255,0,0, 0.6)", "black", lastIndex, drawSomething & draw_log, '');
4035 drawBox(pos++, "rgba(255,0,0, 0.6)", "black", test.length - 1, drawSomething & draw_log, '');
4036 if (curve_t) {
4037 drawCurveTControl();
4038 }
4039 ctx.font = "normal 20px Arial";
4040 ctx.fillStyle = "rgba(0,0,0, 0.3)";
4041 ctx.textAlign = "right";
4042 ctx.fillText(scale.toFixed(decimal_places) + 'x' , screenWidth - 10, screenHeight - 5);
4043 }
4044 if (draw_hints) {
4045 ctx.font = "normal 10px Arial";
4046 ctx.fillStyle = "rgba(0,0,0, 0.5)";
4047 ctx.textAlign = "right";
4048 var y = 4;
4049 ctx.fillText("control lines : " + controlLinesKey, ctx.screenWidthwidth - 10, pos * 50 + y++ * 10);
4050 ctx.fillText("curve t : " + curveTKey, screenWidth - 10, pos * 50 + y++ * 10);
4051 ctx.fillText("deriviatives : " + deriviativesKey, screenWidth - 10, pos * 50 + y++ * 10);
4052 ctx.fillText("intersect t : " + intersectTKey, screenWidth - 10, pos * 50 + y++ * 10);
caryclarkdac1d172014-06-17 05:15:38 -07004053 ctx.fillText("log : " + logKey, screenWidth - 10, pos * 50 + y++ * 10);
4054 ctx.fillText("log curve : " + logCurvesKey, screenWidth - 10, pos * 50 + y++ * 10);
4055 ctx.fillText("mid point : " + midpointKey, screenWidth - 10, pos * 50 + y++ * 10);
4056 ctx.fillText("points : " + ptsKey, screenWidth - 10, pos * 50 + y++ * 10);
4057 ctx.fillText("sequence : " + sequenceKey, screenWidth - 10, pos * 50 + y++ * 10);
4058 ctx.fillText("xy : " + xyKey, screenWidth - 10, pos * 50 + y++ * 10);
4059 }
4060}
4061
4062function drawBox(y, backC, foreC, str, enable, label) {
4063 ctx.beginPath();
4064 ctx.fillStyle = backC;
4065 ctx.rect(screenWidth - 40, y * 50 + 10, 40, 30);
4066 ctx.fill();
4067 ctx.font = "normal 16px Arial";
4068 ctx.fillStyle = foreC;
4069 ctx.textAlign = "center";
4070 ctx.fillText(str, screenWidth - 20, y * 50 + 32);
4071 if (!enable) {
4072 ctx.fillStyle = "rgba(255,255,255, 0.5)";
4073 ctx.fill();
4074 }
4075 if (label != '') {
4076 ctx.font = "normal 9px Arial";
4077 ctx.fillStyle = "black";
4078 ctx.fillText(label, screenWidth - 47, y * 50 + 40);
4079 }
4080}
4081
4082function drawCurveTControl() {
4083 ctx.lineWidth = 2;
4084 ctx.strokeStyle = "rgba(0,0,0, 0.3)";
4085 ctx.beginPath();
4086 ctx.rect(screenWidth - 80, 40, 28, screenHeight - 80);
4087 ctx.stroke();
4088 var ty = 40 + curveT * (screenHeight - 80);
4089 ctx.beginPath();
4090 ctx.moveTo(screenWidth - 80, ty);
4091 ctx.lineTo(screenWidth - 85, ty - 5);
4092 ctx.lineTo(screenWidth - 85, ty + 5);
4093 ctx.lineTo(screenWidth - 80, ty);
4094 ctx.fillStyle = "rgba(0,0,0, 0.6)";
4095 ctx.fill();
4096 var num = curveT.toFixed(decimal_places);
4097 ctx.font = "normal 10px Arial";
4098 ctx.textAlign = "left";
4099 ctx.fillText(num, screenWidth - 78, ty);
4100}
4101
4102function ptInTControl() {
4103 var e = window.event;
caryclark55888e42016-07-18 10:01:36 -07004104 var tgt = e.target || e.srcElement;
caryclarkdac1d172014-06-17 05:15:38 -07004105 var left = tgt.offsetLeft;
4106 var top = tgt.offsetTop;
4107 var x = (e.clientX - left);
4108 var y = (e.clientY - top);
4109 if (x < screenWidth - 80 || x > screenWidth - 50) {
4110 return false;
4111 }
4112 if (y < 40 || y > screenHeight - 80) {
4113 return false;
4114 }
4115 curveT = (y - 40) / (screenHeight - 120);
4116 if (curveT < 0 || curveT > 1) {
4117 throw "stop execution";
4118 }
4119 return true;
4120}
4121
4122function drawTop() {
4123 if (tests[testIndex] == null) {
4124 var str = testDivs[testIndex].textContent;
4125 parse_all(str);
4126 var title = testDivs[testIndex].id.toString();
4127 testTitles[testIndex] = title;
4128 }
4129 init(tests[testIndex]);
4130 redraw();
4131}
4132
4133function redraw() {
4134 if (focus_on_selection) {
4135 collect_bounds = true;
4136 draw(tests[testIndex], testLines[testIndex], testTitles[testIndex]);
4137 collect_bounds = false;
4138 if (focusXmin < focusXmax && focusYmin < focusYmax) {
4139 setScale(focusXmin, focusXmax, focusYmin, focusYmax);
4140 }
4141 }
4142 ctx.beginPath();
4143 ctx.fillStyle = "white";
4144 ctx.rect(0, 0, screenWidth, screenHeight);
4145 ctx.fill();
4146 draw(tests[testIndex], testLines[testIndex], testTitles[testIndex]);
4147}
4148
4149function dumpCurvePartial(test, id, t0, t1) {
4150 var curve = curveByID(test, id);
4151 var name = ["line", "quad", "cubic"][curve.length / 2 - 2];
4152 console.log("id=" + id + " " + name + "=" + curveToString(curve)
4153 + " t0=" + t0 + " t1=" + t1
4154 + " partial=" + curveToString(curvePartialByID(test, id, t0, t1)));
4155}
4156
4157function dumpAngleTest(test, id, t0, t1) {
4158 var curve = curveByID(test, id);
caryclark55888e42016-07-18 10:01:36 -07004159 console.log(" { {" + curveToString(curve) + "}, "
caryclarkdac1d172014-06-17 05:15:38 -07004160 + curve.length / 2 + ", " + t0 + ", " + t1 + ", {} }, //");
4161}
4162
4163function dumpLogToConsole() {
4164 if (logStart < 0) {
4165 return;
4166 }
4167 var test = tests[testIndex];
4168 var recType = REC_TYPE_UNKNOWN;
4169 var records;
4170 for (var index = 0; index < test.length; index += 3) {
4171 var lastLineNo = test[index + 1];
4172 if (lastLineNo >= logStart && lastLineNo < logStart + logRange) {
4173 recType = test[index];
4174 records = test[index + 2];
4175 break;
4176 }
4177 }
4178 if (recType == REC_TYPE_UNKNOWN) {
4179 return;
4180 }
4181 var lines = testLines[testIndex];
4182 for (var idx = 0; idx < logRange; ++idx) {
4183 var line = lines[logStart + idx];
4184 console.log(line);
4185 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2) {
4186 var fragType = records[recordIndex];
4187 var frags = records[recordIndex + 1];
4188 if (recType == REC_TYPE_ANGLE && fragType == ANGLE_AFTER) {
caryclarkdac1d172014-06-17 05:15:38 -07004189 dumpCurvePartial(test, frags[0], frags[4], frags[5]);
4190 dumpCurvePartial(test, frags[6], frags[10], frags[11]);
4191 dumpCurvePartial(test, frags[12], frags[16], frags[17]);
4192 console.log("\nstatic IntersectData intersectDataSet[] = { //");
4193 dumpAngleTest(test, frags[0], frags[4], frags[5]);
4194 dumpAngleTest(test, frags[6], frags[10], frags[11]);
4195 dumpAngleTest(test, frags[12], frags[16], frags[17]);
4196 console.log("}; //");
4197 }
4198 }
4199 }
4200}
4201
4202var activeKey = 'a';
4203var pathKey = 'b';
4204var pathBackKey = 'B';
4205var centerKey = 'c';
caryclark624637c2015-05-11 07:21:27 -07004206var coincidenceKey = 'C';
caryclarkdac1d172014-06-17 05:15:38 -07004207var addKey = 'd';
4208var deriviativesKey = 'f';
4209var angleKey = 'g';
4210var angleBackKey = 'G';
caryclarkdac1d172014-06-17 05:15:38 -07004211var intersectionKey = 'i';
4212var intersectionBackKey = 'I';
4213var sequenceKey = 'j';
4214var midpointKey = 'k';
4215var logKey = 'l';
4216var logToConsoleKey = 'L';
4217var markKey = 'm';
4218var sortKey = 'o';
4219var opKey = 'p';
4220var opBackKey = 'P';
4221var computedKey = 'q';
4222var computedBackKey = 'Q';
4223var stepKey = 's';
4224var stepBackKey = 'S';
4225var intersectTKey = 't';
caryclark03b03ca2015-04-23 09:13:37 -07004226var topKey = 'T';
caryclarkdac1d172014-06-17 05:15:38 -07004227var curveTKey = 'u';
4228var controlLinesBackKey = 'V';
4229var controlLinesKey = 'v';
4230var ptsKey = 'x';
4231var xyKey = 'y';
4232var logCurvesKey = 'z';
4233var focusKey = '`';
4234var idKey = '.';
4235var retinaKey = '\\';
4236
4237function doKeyPress(evt) {
4238 var char = String.fromCharCode(evt.charCode);
4239 var focusWasOn = false;
4240 switch (char) {
4241 case '0':
4242 case '1':
4243 case '2':
4244 case '3':
4245 case '4':
4246 case '5':
4247 case '6':
4248 case '7':
4249 case '8':
4250 case '9':
4251 decimal_places = char - '0';
4252 redraw();
4253 break;
4254 case activeKey:
4255 draw_active ^= true;
caryclark55888e42016-07-18 10:01:36 -07004256 redraw();
caryclarkdac1d172014-06-17 05:15:38 -07004257 break;
4258 case addKey:
4259 draw_add ^= true;
caryclark55888e42016-07-18 10:01:36 -07004260 redraw();
caryclarkdac1d172014-06-17 05:15:38 -07004261 break;
4262 case angleKey:
caryclark54359292015-03-26 07:52:43 -07004263 draw_angle = (draw_angle + 1) % 4;
caryclarkdac1d172014-06-17 05:15:38 -07004264 redraw();
4265 break;
4266 case angleBackKey:
4267 draw_angle = (draw_angle + 2) % 3;
4268 redraw();
4269 break;
4270 case centerKey:
4271 setScale(xmin, xmax, ymin, ymax);
caryclark55888e42016-07-18 10:01:36 -07004272 redraw();
caryclarkdac1d172014-06-17 05:15:38 -07004273 break;
caryclark624637c2015-05-11 07:21:27 -07004274 case coincidenceKey:
4275 draw_coincidence ^= true;
4276 redraw();
4277 break;
caryclarkdac1d172014-06-17 05:15:38 -07004278 case controlLinesBackKey:
4279 control_lines = (control_lines + 3) % 4;
caryclark55888e42016-07-18 10:01:36 -07004280 redraw();
caryclarkdac1d172014-06-17 05:15:38 -07004281 break;
4282 case controlLinesKey:
4283 control_lines = (control_lines + 1) % 4;
caryclark55888e42016-07-18 10:01:36 -07004284 redraw();
caryclarkdac1d172014-06-17 05:15:38 -07004285 break;
4286 case computedBackKey:
4287 draw_computed = (draw_computed + 5) % 6;
caryclark55888e42016-07-18 10:01:36 -07004288 redraw();
caryclarkdac1d172014-06-17 05:15:38 -07004289 break;
4290 case computedKey:
4291 draw_computed = (draw_computed + 1) % 6;
caryclark55888e42016-07-18 10:01:36 -07004292 redraw();
caryclarkdac1d172014-06-17 05:15:38 -07004293 break;
4294 case curveTKey:
4295 curve_t ^= true;
4296 if (curve_t) {
4297 draw_legend = true;
4298 }
4299 redraw();
4300 break;
4301 case deriviativesKey:
4302 draw_deriviatives = (draw_deriviatives + 1) % 3;
4303 redraw();
4304 break;
4305 case focusKey:
4306 focus_on_selection ^= true;
4307 setScale(xmin, xmax, ymin, ymax);
4308 redraw();
4309 break;
caryclarkdac1d172014-06-17 05:15:38 -07004310 case idKey:
4311 draw_id ^= true;
4312 redraw();
4313 break;
4314 case intersectionBackKey:
4315 draw_intersection = (draw_intersection + 3) % 4;
caryclark55888e42016-07-18 10:01:36 -07004316 redraw();
caryclarkdac1d172014-06-17 05:15:38 -07004317 break;
4318 case intersectionKey:
4319 draw_intersection = (draw_intersection + 1) % 4;
caryclark55888e42016-07-18 10:01:36 -07004320 redraw();
caryclarkdac1d172014-06-17 05:15:38 -07004321 break;
4322 case intersectTKey:
4323 draw_intersectT ^= true;
4324 redraw();
4325 break;
4326 case logCurvesKey:
4327 logCurves(tests[testIndex]);
4328 break;
4329 case logKey:
4330 draw_log ^= true;
4331 redraw();
4332 break;
4333 case logToConsoleKey:
4334 if (draw_log) {
4335 dumpLogToConsole();
4336 }
4337 break;
4338 case markKey:
4339 draw_mark ^= true;
4340 redraw();
4341 break;
4342 case midpointKey:
4343 draw_midpoint ^= true;
4344 redraw();
4345 break;
4346 case opKey:
4347 draw_op = (draw_op + 1) % 3;
4348 redraw();
4349 break;
4350 case opBackKey:
4351 draw_op = (draw_op + 2) % 3;
4352 redraw();
4353 break;
4354 case pathKey:
caryclark26ad22a2015-10-16 09:03:38 -07004355 draw_path = (draw_path + 1) % (4 + (hasAlignedPath ? 3 : 0));
caryclark55888e42016-07-18 10:01:36 -07004356 redraw();
caryclarkdac1d172014-06-17 05:15:38 -07004357 break;
4358 case pathBackKey:
caryclark26ad22a2015-10-16 09:03:38 -07004359 draw_path = (draw_path + 3 + (hasAlignedPath ? 3 : 0)) % (4 + (hasAlignedPath ? 3 : 0));
caryclark55888e42016-07-18 10:01:36 -07004360 redraw();
caryclarkdac1d172014-06-17 05:15:38 -07004361 break;
4362 case ptsKey:
4363 pt_labels = (pt_labels + 1) % 3;
4364 redraw();
4365 break;
4366 case retinaKey:
4367 retina_scale ^= true;
4368 drawTop();
4369 break;
4370 case sequenceKey:
4371 draw_sequence ^= true;
4372 redraw();
4373 break;
4374 case sortKey:
4375 draw_sort = (draw_sort + 1) % 3;
4376 drawTop();
4377 break;
4378 case stepKey:
4379 step_limit++;
4380 if (step_limit > stepMax) {
4381 step_limit = stepMax;
4382 }
4383 redraw();
4384 break;
4385 case stepBackKey:
4386 step_limit--;
4387 if (step_limit < 0) {
4388 step_limit = 0;
4389 }
4390 redraw();
4391 break;
caryclark03b03ca2015-04-23 09:13:37 -07004392 case topKey:
4393 draw_top ^= true;
4394 redraw();
4395 break;
caryclarkdac1d172014-06-17 05:15:38 -07004396 case xyKey:
4397 debug_xy = (debug_xy + 1) % 3;
4398 redraw();
4399 break;
4400 case '-':
4401 focusWasOn = focus_on_selection;
4402 if (focusWasOn) {
4403 focus_on_selection = false;
4404 scale /= 1.2;
4405 } else {
4406 scale /= 2;
4407 calcLeftTop();
4408 }
4409 redraw();
4410 focus_on_selection = focusWasOn;
4411 break;
4412 case '=':
4413 case '+':
4414 focusWasOn = focus_on_selection;
4415 if (focusWasOn) {
4416 focus_on_selection = false;
4417 scale *= 1.2;
4418 } else {
4419 scale *= 2;
4420 calcLeftTop();
4421 }
4422 redraw();
4423 focus_on_selection = focusWasOn;
4424 break;
4425 case '?':
4426 draw_hints ^= true;
4427 if (draw_hints && !draw_legend) {
4428 draw_legend = true;
4429 }
4430 redraw();
4431 break;
4432 case '/':
4433 draw_legend ^= true;
4434 redraw();
4435 break;
4436 }
4437}
4438
4439function doKeyDown(evt) {
4440 var char = evt.keyCode;
4441 var preventDefault = false;
4442 switch (char) {
4443 case 37: // left arrow
4444 if (evt.shiftKey) {
4445 testIndex -= 9;
4446 }
4447 if (--testIndex < 0)
4448 testIndex = tests.length - 1;
4449 drawTop();
4450 preventDefault = true;
4451 break;
4452 case 39: // right arrow
4453 if (evt.shiftKey) {
4454 testIndex += 9;
4455 }
4456 if (++testIndex >= tests.length)
4457 testIndex = 0;
4458 drawTop();
4459 preventDefault = true;
4460 break;
4461 }
4462 if (preventDefault) {
4463 evt.preventDefault();
4464 return false;
4465 }
4466 return true;
4467}
4468
4469(function() {
4470 var hidden = "hidden";
4471
4472 // Standards:
4473 if (hidden in document)
4474 document.addEventListener("visibilitychange", onchange);
4475 else if ((hidden = "mozHidden") in document)
4476 document.addEventListener("mozvisibilitychange", onchange);
4477 else if ((hidden = "webkitHidden") in document)
4478 document.addEventListener("webkitvisibilitychange", onchange);
4479 else if ((hidden = "msHidden") in document)
4480 document.addEventListener("msvisibilitychange", onchange);
4481 // IE 9 and lower:
4482 else if ('onfocusin' in document)
4483 document.onfocusin = document.onfocusout = onchange;
4484 // All others:
4485 else
caryclark55888e42016-07-18 10:01:36 -07004486 window.onpageshow = window.onpagehide
caryclarkdac1d172014-06-17 05:15:38 -07004487 = window.onfocus = window.onblur = onchange;
4488
4489 function onchange (evt) {
4490 var v = 'visible', h = 'hidden',
caryclark55888e42016-07-18 10:01:36 -07004491 evtMap = {
4492 focus:v, focusin:v, pageshow:v, blur:h, focusout:h, pagehide:h
caryclarkdac1d172014-06-17 05:15:38 -07004493 };
4494
4495 evt = evt || window.event;
4496 if (evt.type in evtMap)
4497 document.body.className = evtMap[evt.type];
caryclark55888e42016-07-18 10:01:36 -07004498 else
caryclarkdac1d172014-06-17 05:15:38 -07004499 document.body.className = this[hidden] ? "hidden" : "visible";
4500 }
4501})();
4502
4503function calcXY() {
4504 var e = window.event;
caryclark55888e42016-07-18 10:01:36 -07004505 var tgt = e.target || e.srcElement;
caryclarkdac1d172014-06-17 05:15:38 -07004506 var left = tgt.offsetLeft;
4507 var top = tgt.offsetTop;
4508 mouseX = (e.clientX - left) / scale + srcLeft;
4509 mouseY = (e.clientY - top) / scale + srcTop;
4510}
4511
4512function calcLeftTop() {
4513 srcLeft = mouseX - screenWidth / 2 / scale;
4514 srcTop = mouseY - screenHeight / 2 / scale;
4515}
4516
4517var disableClick = false;
4518
4519function handleMouseClick() {
4520 if (disableClick) {
4521 return;
4522 }
4523 if (!curve_t || !ptInTControl()) {
4524 calcXY();
4525 calcLeftTop();
4526 }
4527 redraw();
4528// if (!curve_t || !ptInTControl()) {
4529// mouseX = screenWidth / 2 / scale + srcLeft;
4530// mouseY = screenHeight / 2 / scale + srcTop;
4531// }
4532}
4533
4534function handleMouseOver() {
4535 calcXY();
4536 if (debug_xy != 2) {
4537 return;
4538 }
4539 var num = mouseX.toFixed(decimal_places) + ", " + mouseY.toFixed(decimal_places);
4540 ctx.beginPath();
4541 ctx.rect(300,100,num.length * 6,10);
4542 ctx.fillStyle="white";
4543 ctx.fill();
4544 ctx.font = "normal 10px Arial";
4545 ctx.fillStyle="black";
4546 ctx.textAlign = "left";
4547 ctx.fillText(num, 300, 108);
4548}
4549
4550function start() {
4551 for (var i = 0; i < testDivs.length; ++i) {
4552 tests[i] = null;
4553 }
4554 testIndex = 0;
4555 drawTop();
4556 window.addEventListener('keypress', doKeyPress, true);
4557 window.addEventListener('keydown', doKeyDown, true);
4558 window.onresize = function() {
4559 drawTop();
4560 }
4561 /*
4562 window.onpagehide = function() {
4563 disableClick = true;
4564 }
4565 */
4566 window.onpageshow = function () {
4567 disableClick = false;
4568 }
4569}
4570
4571</script>
4572</head>
4573
4574<body onLoad="start();">
4575<canvas id="canvas" width="750" height="500"
4576 onmousemove="handleMouseOver()"
4577 onclick="handleMouseClick()"
4578 ></canvas >
4579</body>
4580</html>