Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: tools/pathops_visualizer.htm

Issue 272153002: fix bugs found by computing flat clips in 800K skps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix maybe-uninitialized error in unbuntu Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/pathops_sorter.htm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <div height="0" hidden="true">
4 <div id="rects4">
5 RunTestSet [rects4]
6
7 {{0,0}, {1,0}},
8 {{1,0}, {1,1}},
9 {{1,1}, {0,1}},
10 {{0,1}, {0,0}},
11 {{0,0}, {2,0}},
12 {{2,0}, {2,2}},
13 {{2,2}, {0,2}},
14 {{0,2}, {0,0}},
15 op difference
16 {{0,0}, {2,0}},
17 {{2,0}, {2,2}},
18 {{2,2}, {0,2}},
19 {{0,2}, {0,0}},
20 {{0,0}, {3,0}},
21 {{3,0}, {3,3}},
22 {{3,3}, {0,3}},
23 {{0,3}, {0,0}},
24 debugShowLineIntersection wtTs[0]=0 {{1,0}, {1,1}} {{1,0}} wnTs[0]=1 {{0,0}, {1, 0}}
25 debugShowLineIntersection wtTs[0]=1 {{0,1}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {1, 0}}
26 debugShowLineIntersection wtTs[0]=0 {{1,1}, {0,1}} {{1,1}} wnTs[0]=1 {{1,0}, {1, 1}}
27 debugShowLineIntersection wtTs[0]=0 {{0,1}, {0,0}} {{0,1}} wnTs[0]=1 {{1,1}, {0, 1}}
28 debugShowLineIntersection wtTs[0]=0 {{0,0}, {2,0}} {{0,0}} wtTs[1]=0.5 {{1,0}} w nTs[0]=0 {{0,0}, {1,0}} wnTs[1]=1
29 debugShowLineIntersection wtTs[0]=1 {{0,2}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {1, 0}}
30 debugShowLineIntersection wtTs[0]=0.5 {{0,0}, {2,0}} {{1,0}} wnTs[0]=0 {{1,0}, { 1,1}}
31 debugShowLineIntersection wtTs[0]=0.5 {{0,2}, {0,0}} {{0,1}} wnTs[0]=1 {{1,1}, { 0,1}}
32 debugShowLineIntersection wtTs[0]=0 {{0,0}, {2,0}} {{0,0}} wnTs[0]=1 {{0,1}, {0, 0}}
33 debugShowLineIntersection wtTs[0]=0.5 {{0,2}, {0,0}} {{0,1}} wtTs[1]=1 {{0,0}} w nTs[0]=0 {{0,1}, {0,0}} wnTs[1]=1
34 debugShowLineIntersection wtTs[0]=0 {{0,0}, {2,0}} {{0,0}} wtTs[1]=0.5 {{1,0}} w nTs[0]=0 {{0,0}, {1,0}} wnTs[1]=1
35 debugShowLineIntersection wtTs[0]=1 {{0,2}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {1, 0}}
36 debugShowLineIntersection wtTs[0]=0.5 {{0,0}, {2,0}} {{1,0}} wnTs[0]=0 {{1,0}, { 1,1}}
37 debugShowLineIntersection wtTs[0]=0.5 {{0,2}, {0,0}} {{0,1}} wnTs[0]=1 {{1,1}, { 0,1}}
38 debugShowLineIntersection wtTs[0]=0 {{0,0}, {2,0}} {{0,0}} wnTs[0]=1 {{0,1}, {0, 0}}
39 debugShowLineIntersection wtTs[0]=0.5 {{0,2}, {0,0}} {{0,1}} wtTs[1]=1 {{0,0}} w nTs[0]=0 {{0,1}, {0,0}} wnTs[1]=1
40 debugShowLineIntersection wtTs[0]=0 {{0,0}, {3,0}} {{0,0}} wtTs[1]=0.333333333 { {1,0}} wnTs[0]=0 {{0,0}, {1,0}} wnTs[1]=1
41 debugShowLineIntersection wtTs[0]=1 {{0,3}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {1, 0}}
42 debugShowLineIntersection wtTs[0]=0.333333333 {{0,0}, {3,0}} {{1,0}} wnTs[0]=0 { {1,0}, {1,1}}
43 debugShowLineIntersection wtTs[0]=0.666666667 {{0,3}, {0,0}} {{0,1}} wnTs[0]=1 { {1,1}, {0,1}}
44 debugShowLineIntersection wtTs[0]=0 {{0,0}, {3,0}} {{0,0}} wnTs[0]=1 {{0,1}, {0, 0}}
45 debugShowLineIntersection wtTs[0]=0.666666667 {{0,3}, {0,0}} {{0,1}} wtTs[1]=1 { {0,0}} wnTs[0]=0 {{0,1}, {0,0}} wnTs[1]=1
46 debugShowLineIntersection wtTs[0]=0 {{2,0}, {2,2}} {{2,0}} wnTs[0]=1 {{0,0}, {2, 0}}
47 debugShowLineIntersection wtTs[0]=1 {{0,2}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {2, 0}}
48 debugShowLineIntersection wtTs[0]=0 {{2,2}, {0,2}} {{2,2}} wnTs[0]=1 {{2,0}, {2, 2}}
49 debugShowLineIntersection wtTs[0]=0 {{0,2}, {0,0}} {{0,2}} wnTs[0]=1 {{2,2}, {0, 2}}
50 debugShowLineIntersection wtTs[0]=0 {{0,0}, {2,0}} {{0,0}} wtTs[1]=1 {{2,0}} wnT s[0]=0 {{0,0}, {2,0}} wnTs[1]=1
51 debugShowLineIntersection wtTs[0]=0 {{2,0}, {2,2}} {{2,0}} wnTs[0]=1 {{0,0}, {2, 0}}
52 debugShowLineIntersection wtTs[0]=1 {{0,2}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {2, 0}}
53 debugShowLineIntersection wtTs[0]=1 {{0,0}, {2,0}} {{2,0}} wnTs[0]=0 {{2,0}, {2, 2}}
54 debugShowLineIntersection wtTs[0]=0 {{2,0}, {2,2}} {{2,0}} wtTs[1]=1 {{2,2}} wnT s[0]=0 {{2,0}, {2,2}} wnTs[1]=1
55 debugShowLineIntersection wtTs[0]=0 {{2,2}, {0,2}} {{2,2}} wnTs[0]=1 {{2,0}, {2, 2}}
56 debugShowLineIntersection wtTs[0]=1 {{2,0}, {2,2}} {{2,2}} wnTs[0]=0 {{2,2}, {0, 2}}
57 debugShowLineIntersection wtTs[0]=0 {{2,2}, {0,2}} {{2,2}} wtTs[1]=1 {{0,2}} wnT s[0]=0 {{2,2}, {0,2}} wnTs[1]=1
58 debugShowLineIntersection wtTs[0]=0 {{0,2}, {0,0}} {{0,2}} wnTs[0]=1 {{2,2}, {0, 2}}
59 debugShowLineIntersection wtTs[0]=0 {{0,0}, {2,0}} {{0,0}} wnTs[0]=1 {{0,2}, {0, 0}}
60 debugShowLineIntersection wtTs[0]=1 {{2,2}, {0,2}} {{0,2}} wnTs[0]=0 {{0,2}, {0, 0}}
61 debugShowLineIntersection wtTs[0]=0 {{0,2}, {0,0}} {{0,2}} wtTs[1]=1 {{0,0}} wnT s[0]=0 {{0,2}, {0,0}} wnTs[1]=1
62 debugShowLineIntersection wtTs[0]=0 {{0,0}, {3,0}} {{0,0}} wtTs[1]=0.666666667 { {2,0}} wnTs[0]=0 {{0,0}, {2,0}} wnTs[1]=1
63 debugShowLineIntersection wtTs[0]=1 {{0,3}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {2, 0}}
64 debugShowLineIntersection wtTs[0]=0.666666667 {{0,0}, {3,0}} {{2,0}} wnTs[0]=0 { {2,0}, {2,2}}
65 debugShowLineIntersection wtTs[0]=0.333333333 {{0,3}, {0,0}} {{0,2}} wnTs[0]=1 { {2,2}, {0,2}}
66 debugShowLineIntersection wtTs[0]=0 {{0,0}, {3,0}} {{0,0}} wnTs[0]=1 {{0,2}, {0, 0}}
67 debugShowLineIntersection wtTs[0]=0.333333333 {{0,3}, {0,0}} {{0,2}} wtTs[1]=1 { {0,0}} wnTs[0]=0 {{0,2}, {0,0}} wnTs[1]=1
68 debugShowLineIntersection wtTs[0]=0 {{2,0}, {2,2}} {{2,0}} wnTs[0]=1 {{0,0}, {2, 0}}
69 debugShowLineIntersection wtTs[0]=1 {{0,2}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {2, 0}}
70 debugShowLineIntersection wtTs[0]=0 {{2,2}, {0,2}} {{2,2}} wnTs[0]=1 {{2,0}, {2, 2}}
71 debugShowLineIntersection wtTs[0]=0 {{0,2}, {0,0}} {{0,2}} wnTs[0]=1 {{2,2}, {0, 2}}
72 debugShowLineIntersection wtTs[0]=0 {{0,0}, {3,0}} {{0,0}} wtTs[1]=0.666666667 { {2,0}} wnTs[0]=0 {{0,0}, {2,0}} wnTs[1]=1
73 debugShowLineIntersection wtTs[0]=1 {{0,3}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {2, 0}}
74 debugShowLineIntersection wtTs[0]=0.666666667 {{0,0}, {3,0}} {{2,0}} wnTs[0]=0 { {2,0}, {2,2}}
75 debugShowLineIntersection wtTs[0]=0.333333333 {{0,3}, {0,0}} {{0,2}} wnTs[0]=1 { {2,2}, {0,2}}
76 debugShowLineIntersection wtTs[0]=0 {{0,0}, {3,0}} {{0,0}} wnTs[0]=1 {{0,2}, {0, 0}}
77 debugShowLineIntersection wtTs[0]=0.333333333 {{0,3}, {0,0}} {{0,2}} wtTs[1]=1 { {0,0}} wnTs[0]=0 {{0,2}, {0,0}} wnTs[1]=1
78 debugShowLineIntersection wtTs[0]=0 {{3,0}, {3,3}} {{3,0}} wnTs[0]=1 {{0,0}, {3, 0}}
79 debugShowLineIntersection wtTs[0]=1 {{0,3}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {3, 0}}
80 debugShowLineIntersection wtTs[0]=0 {{3,3}, {0,3}} {{3,3}} wnTs[0]=1 {{3,0}, {3, 3}}
81 debugShowLineIntersection wtTs[0]=0 {{0,3}, {0,0}} {{0,3}} wnTs[0]=1 {{3,3}, {0, 3}}
82 SkOpSegment::debugShowTs - id=0 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=1 t=1 1,0 w=1 o =0]
83 SkOpSegment::debugShowTs o id=4 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=1 t=0.5 1,0 w=1 o=0] [o=9,5 t=1 2,0 w=1 o=0]
84 SkOpSegment::addTPair addTPair this=4 0.5 other=0 1
85 SkOpSegment::debugShowTs + id=0 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=4,1 t=1 1,0 w=1 o=0]
86 SkOpSegment::debugShowTs o id=4 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0]
87 SkOpSegment::debugShowTs - id=3 [o=2 t=0 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o= 0]
88 SkOpSegment::debugShowTs o id=7 [o=10,6 t=0 0,2 w=1 o=0] [o=2 t=0.5 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
89 SkOpSegment::addTPair addTPair this=3 0 other=7 0.5
90 SkOpSegment::debugShowTs + id=3 [o=7,2 t=0 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
91 SkOpSegment::debugShowTs o id=7 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o= 0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
92 SkOpSegment::debugShowTs - id=0 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=4,1 t=1 1,0 w=1 o=0]
93 SkOpSegment::debugShowTs o id=8 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=1 t=0.5 1,0 w=1 o=0] [o=9,5 t=1 2,0 w=1 o=0] operand
94 SkOpSegment::addTPair addTPair this=8 0.5 other=0 1
95 SkOpSegment::debugShowTs + id=0 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=8,4,1 t=1 1,0 w =1 o=0]
96 SkOpSegment::debugShowTs o id=8 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0] operand
97 SkOpSegment::debugShowTs - id=3 [o=7,2 t=0 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
98 SkOpSegment::debugShowTs o id=11 [o=10,6 t=0 0,2 w=1 o=0] [o=2 t=0.5 0,1 w=1 o=0 ] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
99 SkOpSegment::addTPair addTPair this=3 0 other=11 0.5
100 SkOpSegment::debugShowTs + id=3 [o=11,7,2 t=0 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w =1 o=0]
101 SkOpSegment::debugShowTs o id=11 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o =0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
102 SkOpSegment::debugShowTs - id=0 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=8,4,1 t=1 1,0 w =1 o=0]
103 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=1 t=0.333 1,0 w=1 o=0] [o=9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
104 SkOpSegment::addTPair addTPair this=12 0.333333333 other=0 1
105 SkOpSegment::debugShowTs + id=0 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=12,8,4,1 t=1 1, 0 w=1 o=0]
106 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.333 1, 0 w=1 o=0] [o=9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
107 SkOpSegment::debugShowTs - id=3 [o=11,7,2 t=0 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w =1 o=0]
108 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=10,6 t=0.333 0,2 w=1 o=0] [o=2 t=0.667 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
109 SkOpSegment::addTPair addTPair this=3 0 other=15 0.666666667
110 SkOpSegment::debugShowTs + id=3 [o=15,11,7,2 t=0 0,1 w=1 o=0] [o=12,8,4,0 t=1 0, 0 w=1 o=0]
111 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=10,6 t=0.333 0,2 w=1 o=0] [o=3,2 t=0.667 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
112 SkOpSegment::debugShowTs - id=4 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0]
113 SkOpSegment::debugShowTs o id=8 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0] operand
114 SkOpSegment::debugShowTs + id=4 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0]
115 SkOpSegment::debugShowTs o id=8 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0] operand
116 SkOpSegment::debugShowTs - id=5 [o=12,8,4 t=0 2,0 w=1 o=0] [o=10,6 t=1 2,2 w=1 o =0]
117 SkOpSegment::debugShowTs o id=9 [o=12,8,4 t=0 2,0 w=1 o=0] [o=10,6 t=1 2,2 w=1 o =0] operand
118 SkOpSegment::debugShowTs + id=5 [o=12,8,4 t=0 2,0 w=1 o=0] [o=10,6 t=1 2,2 w=1 o =0]
119 SkOpSegment::debugShowTs o id=9 [o=12,8,4 t=0 2,0 w=1 o=0] [o=10,6 t=1 2,2 w=1 o =0] operand
120 SkOpSegment::debugShowTs - id=6 [o=9,5 t=0 2,2 w=1 o=0] [o=15,11,7 t=1 0,2 w=1 o =0]
121 SkOpSegment::debugShowTs o id=10 [o=9,5 t=0 2,2 w=1 o=0] [o=15,11,7 t=1 0,2 w=1 o=0] operand
122 SkOpSegment::debugShowTs + id=6 [o=9,5 t=0 2,2 w=1 o=0] [o=15,11,7 t=1 0,2 w=1 o =0]
123 SkOpSegment::debugShowTs o id=10 [o=9,5 t=0 2,2 w=1 o=0] [o=15,11,7 t=1 0,2 w=1 o=0] operand
124 SkOpSegment::debugShowTs - id=7 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o= 0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
125 SkOpSegment::debugShowTs o id=11 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o =0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
126 SkOpSegment::debugShowTs + id=7 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o= 0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
127 SkOpSegment::debugShowTs o id=11 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o =0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
128 SkOpSegment::debugShowTs - id=4 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0]
129 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.333 1, 0 w=1 o=0] [o=9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
130 SkOpSegment::addTPair addTPair this=12 0.666666667 other=4 1
131 SkOpSegment::debugShowTs + id=4 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=12,9,5 t=1 2,0 w=1 o=0]
132 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.333 1, 0 w=1 o=0] [o=4,9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
133 SkOpSegment::debugShowTs - id=7 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o= 0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
134 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=10,6 t=0.333 0,2 w=1 o=0] [o=3,2 t=0.667 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
135 SkOpSegment::addTPair addTPair this=7 0 other=15 0.333333333
136 SkOpSegment::debugShowTs + id=7 [o=15,10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
137 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=7,10,6 t=0.333 0,2 w= 1 o=0] [o=3,2 t=0.667 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
138 SkOpSegment::debugShowTs - id=8 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0] operand
139 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.333 1, 0 w=1 o=0] [o=4,9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
140 SkOpSegment::addTPair addTPair this=12 0.666666667 other=8 1
141 SkOpSegment::debugShowTs + id=8 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=12,9,5 t=1 2,0 w=1 o=0] operand
142 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.333 1, 0 w=1 o=0] [o=8,4,9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
143 SkOpSegment::debugShowTs - id=11 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o =0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
144 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=7,10,6 t=0.333 0,2 w= 1 o=0] [o=3,2 t=0.667 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
145 SkOpSegment::addTPair addTPair this=11 0 other=15 0.333333333
146 SkOpSegment::debugShowTs + id=11 [o=15,10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w= 1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
147 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=11,7,10,6 t=0.333 0,2 w=1 o=0] [o=3,2 t=0.667 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
148 SkOpContour::calcCoincidentWinding count=6
149 SkOpSegment::debugShowTs p id=0 [o=15,11,7,3 t=0 0,0 w=0 o=0] [o=12,8,4,1 t=1 1, 0 w=1 o=0] done
150 SkOpSegment::debugShowTs o id=4 [o=15,11,7,3 t=0 0,0 w=0 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=12,9,5 t=1 2,0 w=1 o=0]
151 SkOpSegment::debugShowTs p id=3 [o=15,11,7,2 t=0 0,1 w=0 o=0] [o=12,8,4,0 t=1 0, 0 w=1 o=0] done
152 SkOpSegment::debugShowTs o id=7 [o=15,10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=0 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
153 SkOpContour::calcCoincidentWinding count=6
154 SkOpSegment::debugShowTs p id=4 [o=15,11,7,3 t=0 0,0 w=0 o=0] [o=0,1 t=0.5 1,0 w =1 o=1] [o=12,9,5 t=1 2,0 w=1 o=0]
155 SkOpSegment::debugShowTs o id=8 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =0 o=0] [o=12,9,5 t=1 2,0 w=1 o=0] operand
156 SkOpSegment::debugShowTs p id=5 [o=12,8,4 t=0 2,0 w=1 o=1] [o=10,6 t=1 2,2 w=1 o =0]
157 SkOpSegment::debugShowTs o id=9 [o=12,8,4 t=0 2,0 w=0 o=0] [o=10,6 t=1 2,2 w=1 o =0] operand done
158 SkOpSegment::debugShowTs p id=6 [o=9,5 t=0 2,2 w=1 o=1] [o=15,11,7 t=1 0,2 w=1 o =0]
159 SkOpSegment::debugShowTs o id=10 [o=9,5 t=0 2,2 w=0 o=0] [o=15,11,7 t=1 0,2 w=1 o=0] operand done
160 SkOpSegment::debugShowTs p id=7 [o=15,10,6 t=0 0,2 w=1 o=1] [o=3,2 t=0.5 0,1 w=0 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
161 SkOpSegment::debugShowTs o id=11 [o=15,10,6 t=0 0,2 w=0 o=0] [o=3,2 t=0.5 0,1 w= 1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
162 SkOpSegment::debugShowTs p id=4 [o=15,11,7,3 t=0 0,0 w=0 o=0] [o=0,1 t=0.5 1,0 w =1 o=2] [o=12,9,5 t=1 2,0 w=1 o=0]
163 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.333 1, 0 w=0 o=0] [o=8,4,9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
164 SkOpSegment::debugShowTs p id=7 [o=15,10,6 t=0 0,2 w=1 o=2] [o=3,2 t=0.5 0,1 w=0 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
165 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=11,7,10,6 t=0.333 0,2 w=0 o=0] [o=3,2 t=0.667 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
166 SkOpContour::calcCoincidentWinding count=2
167 SkOpSegment::debugShowTs p id=8 [o=15,11,7,3 t=0 0,0 w=2 o=0] [o=0,1 t=0.5 1,0 w =0 o=0] [o=12,9,5 t=1 2,0 w=1 o=0] operand
168 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=0 o=0] [o=0,1 t=0.333 1, 0 w=0 o=0] [o=8,4,9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
169 SkOpSegment::debugShowTs p id=11 [o=15,10,6 t=0 0,2 w=0 o=0] [o=3,2 t=0.5 0,1 w= 2 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
170 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=11,7,10,6 t=0.333 0,2 w=0 o=0] [o=3,2 t=0.667 0,1 w=0 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
171 SkOpSegment::addTPair addTPair this=12 0.333333333 other=8 0.5
172 SkOpSegment::addTPair addTPair this=12 0.333333333 other=4 0.5
173 SkOpSegment::addTPair addTPair duplicate this=8 0.5 other=12 0.333333333
174 SkOpSegment::addTPair addTPair this=8 0.5 other=4 0.5
175 SkOpSegment::addTPair addTPair duplicate this=4 0.5 other=8 0.5
176 SkOpSegment::addTPair addTPair duplicate this=4 0.5 other=12 0.333333333
177 SkOpSegment::addTPair addTPair this=15 0.666666667 other=11 0.5
178 SkOpSegment::addTPair addTPair this=15 0.666666667 other=7 0.5
179 SkOpSegment::addTPair addTPair duplicate this=11 0.5 other=15 0.666666667
180 SkOpSegment::addTPair addTPair this=11 0.5 other=7 0.5
181 SkOpSegment::addTPair addTPair duplicate this=7 0.5 other=11 0.5
182 SkOpSegment::addTPair addTPair duplicate this=7 0.5 other=15 0.666666667
183 SkOpSegment::addTPair addTPair this=4 1 other=8 1
184 SkOpSegment::addTPair addTPair this=5 0 other=9 0
185 SkOpSegment::addTPair addTPair duplicate this=5 0 other=9 0
186 SkOpSegment::addTPair addTPair duplicate this=5 0 other=9 0
187 SkOpSegment::addTPair addTPair this=6 1 other=10 1
188 SkOpSegment::addTPair addTPair this=7 0 other=11 0
189 SkOpSegment::addTPair addTPair duplicate this=7 0 other=11 0
190 SkOpSegment::addTPair addTPair duplicate this=7 0 other=11 0
191 SkOpContour::joinCoincidence count=6
192 SkOpContour::joinCoincidence count=6
193 SkOpContour::joinCoincidence count=2
194 SkOpSegment::sortAngles [1] tStart=0 [1]
195 SkOpAngle::after [1/1] 23/23 tStart=0 tEnd=1 < [4/1] 31/31 tStart=0.5 tEnd=1 < [ 8/2] 15/15 tStart=0.5 tEnd=0 T 4
196 SkOpSegment::sortAngles [2] tStart=1 [2]
197 SkOpAngle::after [2/1] 31/31 tStart=1 tEnd=0 < [7/2] 23/23 tStart=0.5 tEnd=0 < [ 11/1] 7/7 tStart=0.5 tEnd=1 F 4
198 SkOpSegment::sortAngles [4] tStart=1 [9]
199 SkOpAngle::after [4/2] 15/15 tStart=1 tEnd=0.5 < [5/1] 23/23 tStart=0 tEnd=1 < [ 12/1] 31/31 tStart=0.666666667 tEnd=1 T 4
200 SkOpSegment::sortAngles [5] tStart=1 [5]
201 SkOpSegment::sortAngles [6] tStart=1 [3]
202 SkOpAngle::after [6/2] 31/31 tStart=1 tEnd=0 < [7/1] 7/7 tStart=0 tEnd=0.5 < [15 /1] 23/23 tStart=0.333333333 tEnd=0 T 4
203 SkOpSegment::sortAngles [8] tStart=0 [1]
204 SkOpSegment::debugShowActiveSpans id=1 (1,0 1,1) t=0 (1,0) tEnd=1 other=12 other T=0.333333333 otherIndex=7 windSum=? windValue=1 oppValue=0
205 SkOpSegment::debugShowActiveSpans id=2 (1,1 0,1) t=0 (1,1) tEnd=1 other=1 otherT =1 otherIndex=4 windSum=? windValue=1 oppValue=0
206 SkOpSegment::debugShowActiveSpans id=4 (0,0 2,0) t=0.5 (1,0) tEnd=1 other=8 othe rT=0.5 otherIndex=4 windSum=? windValue=1 oppValue=2
207 SkOpSegment::debugShowActiveSpans id=5 (2,0 2,2) t=0 (2,0) tEnd=1 other=9 otherT =0 otherIndex=0 windSum=? windValue=1 oppValue=1
208 SkOpSegment::debugShowActiveSpans id=6 (2,2 0,2) t=0 (2,2) tEnd=1 other=9 otherT =1 otherIndex=5 windSum=? windValue=1 oppValue=1
209 SkOpSegment::debugShowActiveSpans id=7 (0,2 0,0) t=0 (0,2) tEnd=0.5 other=11 oth erT=0 otherIndex=0 windSum=? windValue=1 oppValue=2
210 SkOpSegment::debugShowActiveSpans id=8 (0,0 2,0) t=0 (0,0) tEnd=0.5 other=15 oth erT=1 otherIndex=10 windSum=? windValue=2 oppValue=0
211 SkOpSegment::debugShowActiveSpans id=11 (0,2 0,0) t=0.5 (0,1) tEnd=1 other=7 oth erT=0.5 otherIndex=4 windSum=? windValue=2 oppValue=0
212 SkOpSegment::debugShowActiveSpans id=12 (0,0 3,0) t=0.666666667 (2,0) tEnd=1 oth er=8 otherT=1 otherIndex=9 windSum=? windValue=1 oppValue=0
213 SkOpSegment::debugShowActiveSpans id=13 (3,0 3,3) t=0 (3,0) tEnd=1 other=12 othe rT=1 otherIndex=12 windSum=? windValue=1 oppValue=0
214 SkOpSegment::debugShowActiveSpans id=14 (3,3 0,3) t=0 (3,3) tEnd=1 other=13 othe rT=1 otherIndex=1 windSum=? windValue=1 oppValue=0
215 SkOpSegment::debugShowActiveSpans id=15 (0,3 0,0) t=0 (0,3) tEnd=0.333333333 oth er=14 otherT=1 otherIndex=1 windSum=? windValue=1 oppValue=0
216 SkOpSegment::findTop
217 SkOpAngle::dumpOne [11/2] next=8/1 sect=23/23 s=1 [11] e=0.5 [7] sgn=1 windVal= 2 windSum=? operand
218 SkOpAngle::dumpOne [8/1] next=11/2 sect=31/31 s=0 [0] e=0.5 [4] sgn=-1 windVal= 2 windSum=? operand stop
219 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [6] (0,1) tEnd=0.5 newWindSum=-2 newOppSum=0 oppSum=? windSum=? windValue=2 oppValue=0
220 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [5] (0,1) tEnd=0.5 newWindSum=-2 newOppSum=0 oppSum=? windSum=? windValue=2 oppValue=0
221 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [4] (0,1) tEnd=0.5 newWindSum=-2 newOppSum=0 oppSum=? windSum=? windValue=2 oppValue=0
222 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [7] (0,1) tEnd=1 newWindSum=-2 ne wOppSum=0 oppSum=? windSum=? windValue=2 oppValue=0
223 SkOpSegment::nextChase mismatched signs
224 SkOpSegment::markWinding id=8 (0,0 2,0) t=0 [0] (0,0) tEnd=0 newWindSum=-2 newOp pSum=0 oppSum=? windSum=? windValue=2 oppValue=0
225 SkOpSegment::markWinding id=8 (0,0 2,0) t=0 [1] (0,0) tEnd=0 newWindSum=-2 newOp pSum=0 oppSum=? windSum=? windValue=2 oppValue=0
226 SkOpSegment::markWinding id=8 (0,0 2,0) t=0 [2] (0,0) tEnd=0 newWindSum=-2 newOp pSum=0 oppSum=? windSum=? windValue=2 oppValue=0
227 SkOpSegment::markWinding id=8 (0,0 2,0) t=0 [3] (0,0) tEnd=0.5 newWindSum=-2 new OppSum=0 oppSum=? windSum=? windValue=2 oppValue=0
228 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [6] (0,1) tEnd=0.5 newWindSum=-2 newOppSum=0 oppSum=0 windSum=-2 windValue=2 oppValue=0
229 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [5] (0,1) tEnd=0.5 newWindSum=-2 newOppSum=0 oppSum=0 windSum=-2 windValue=2 oppValue=0
230 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [4] (0,1) tEnd=0.5 newWindSum=-2 newOppSum=0 oppSum=0 windSum=-2 windValue=2 oppValue=0
231 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [7] (0,1) tEnd=1 newWindSum=-2 ne wOppSum=0 oppSum=0 windSum=-2 windValue=2 oppValue=0
232 SkOpSegment::activeOp id=11 t=0.5 tEnd=1 op=diff miFrom=0 miTo=0 suFrom=1 suTo=0 result=0
233 SkOpSegment::markDoneBinary id=11 (0,2 0,0) t=0.5 [6] (0,1) tEnd=0.5 newWindSum= -2 newOppSum=0 oppSum=0 windSum=-2 windValue=2 oppValue=0
234 SkOpSegment::markDoneBinary id=11 (0,2 0,0) t=0.5 [5] (0,1) tEnd=0.5 newWindSum= -2 newOppSum=0 oppSum=0 windSum=-2 windValue=2 oppValue=0
235 SkOpSegment::markDoneBinary id=11 (0,2 0,0) t=0.5 [4] (0,1) tEnd=0.5 newWindSum= -2 newOppSum=0 oppSum=0 windSum=-2 windValue=2 oppValue=0
236 SkOpSegment::markDoneBinary id=11 (0,2 0,0) t=0.5 [7] (0,1) tEnd=1 newWindSum=-2 newOppSum=0 oppSum=0 windSum=-2 windValue=2 oppValue=0
237 SkOpSegment::nextChase mismatched signs
238 SkOpSegment::markDoneBinary id=8 (0,0 2,0) t=0 [0] (0,0) tEnd=0 newWindSum=-2 ne wOppSum=0 oppSum=0 windSum=-2 windValue=2 oppValue=0
239 SkOpSegment::markDoneBinary id=8 (0,0 2,0) t=0 [1] (0,0) tEnd=0 newWindSum=-2 ne wOppSum=0 oppSum=0 windSum=-2 windValue=2 oppValue=0
240 SkOpSegment::markDoneBinary id=8 (0,0 2,0) t=0 [2] (0,0) tEnd=0 newWindSum=-2 ne wOppSum=0 oppSum=0 windSum=-2 windValue=2 oppValue=0
241 SkOpSegment::markDoneBinary id=8 (0,0 2,0) t=0 [3] (0,0) tEnd=0.5 newWindSum=-2 newOppSum=0 oppSum=0 windSum=-2 windValue=2 oppValue=0
242 bridgeOp chase.append id=8 windSum=-2147483647 small=0
243 SkOpSegment::markWinding id=1 (1,0 1,1) t=0 [0] (1,0) tEnd=0 newWindSum=1 newOpp Sum=-2 oppSum=? windSum=? windValue=1 oppValue=0
244 SkOpSegment::markWinding id=1 (1,0 1,1) t=0 [1] (1,0) tEnd=0 newWindSum=1 newOpp Sum=-2 oppSum=? windSum=? windValue=1 oppValue=0
245 SkOpSegment::markWinding id=1 (1,0 1,1) t=0 [2] (1,0) tEnd=0 newWindSum=1 newOpp Sum=-2 oppSum=? windSum=? windValue=1 oppValue=0
246 SkOpSegment::markWinding id=1 (1,0 1,1) t=0 [3] (1,0) tEnd=1 newWindSum=1 newOpp Sum=-2 oppSum=? windSum=? windValue=1 oppValue=0
247 SkOpSegment::markWinding id=2 (1,1 0,1) t=0 [0] (1,1) tEnd=1 newWindSum=1 newOpp Sum=-2 oppSum=? windSum=? windValue=1 oppValue=0
248 SkOpSegment::markAngle last id=2 windSum=? small=0
249 SkOpSegment::markWinding id=4 (0,0 2,0) t=0.5 [4] (1,0) tEnd=0.5 newWindSum=2 ne wOppSum=-2 oppSum=? windSum=? windValue=1 oppValue=2
250 SkOpSegment::markWinding id=4 (0,0 2,0) t=0.5 [5] (1,0) tEnd=0.5 newWindSum=2 ne wOppSum=-2 oppSum=? windSum=? windValue=1 oppValue=2
251 SkOpSegment::markWinding id=4 (0,0 2,0) t=0.5 [6] (1,0) tEnd=0.5 newWindSum=2 ne wOppSum=-2 oppSum=? windSum=? windValue=1 oppValue=2
252 SkOpSegment::markWinding id=4 (0,0 2,0) t=0.5 [7] (1,0) tEnd=1 newWindSum=2 newO ppSum=-2 oppSum=? windSum=? windValue=1 oppValue=2
253 SkOpSegment::markAngle last id=4 windSum=? small=0
254 SkOpSegment::debugShowActiveSpans id=1 (1,0 1,1) t=0 (1,0) tEnd=1 other=12 other T=0.333333333 otherIndex=7 windSum=1 windValue=1 oppValue=0
255 SkOpSegment::debugShowActiveSpans id=2 (1,1 0,1) t=0 (1,1) tEnd=1 other=1 otherT =1 otherIndex=4 windSum=1 windValue=1 oppValue=0
256 SkOpSegment::debugShowActiveSpans id=4 (0,0 2,0) t=0.5 (1,0) tEnd=1 other=8 othe rT=0.5 otherIndex=4 windSum=2 windValue=1 oppValue=2
257 SkOpSegment::debugShowActiveSpans id=5 (2,0 2,2) t=0 (2,0) tEnd=1 other=9 otherT =0 otherIndex=0 windSum=? windValue=1 oppValue=1
258 SkOpSegment::debugShowActiveSpans id=6 (2,2 0,2) t=0 (2,2) tEnd=1 other=9 otherT =1 otherIndex=5 windSum=? windValue=1 oppValue=1
259 SkOpSegment::debugShowActiveSpans id=7 (0,2 0,0) t=0 (0,2) tEnd=0.5 other=11 oth erT=0 otherIndex=0 windSum=? windValue=1 oppValue=2
260 SkOpSegment::debugShowActiveSpans id=12 (0,0 3,0) t=0.666666667 (2,0) tEnd=1 oth er=8 otherT=1 otherIndex=9 windSum=? windValue=1 oppValue=0
261 SkOpSegment::debugShowActiveSpans id=13 (3,0 3,3) t=0 (3,0) tEnd=1 other=12 othe rT=1 otherIndex=12 windSum=? windValue=1 oppValue=0
262 SkOpSegment::debugShowActiveSpans id=14 (3,3 0,3) t=0 (3,3) tEnd=1 other=13 othe rT=1 otherIndex=1 windSum=? windValue=1 oppValue=0
263 SkOpSegment::debugShowActiveSpans id=15 (0,3 0,0) t=0 (0,3) tEnd=0.333333333 oth er=14 otherT=1 otherIndex=1 windSum=? windValue=1 oppValue=0
264 SkOpSegment::activeOp id=1 t=0 tEnd=1 op=diff miFrom=0 miTo=1 suFrom=1 suTo=1 re sult=0
265 SkOpSegment::markDoneBinary id=1 (1,0 1,1) t=0 [0] (1,0) tEnd=0 newWindSum=1 new OppSum=-2 oppSum=-2 windSum=1 windValue=1 oppValue=0
266 SkOpSegment::markDoneBinary id=1 (1,0 1,1) t=0 [1] (1,0) tEnd=0 newWindSum=1 new OppSum=-2 oppSum=-2 windSum=1 windValue=1 oppValue=0
267 SkOpSegment::markDoneBinary id=1 (1,0 1,1) t=0 [2] (1,0) tEnd=0 newWindSum=1 new OppSum=-2 oppSum=-2 windSum=1 windValue=1 oppValue=0
268 SkOpSegment::markDoneBinary id=1 (1,0 1,1) t=0 [3] (1,0) tEnd=1 newWindSum=1 new OppSum=-2 oppSum=-2 windSum=1 windValue=1 oppValue=0
269 SkOpSegment::markDoneBinary id=2 (1,1 0,1) t=0 [0] (1,1) tEnd=1 newWindSum=1 new OppSum=-2 oppSum=-2 windSum=1 windValue=1 oppValue=0
270 bridgeOp chase.append id=2 windSum=-2147483647 small=0
271 SkOpSegment::markWinding id=7 (0,2 0,0) t=0 [0] (0,2) tEnd=0 newWindSum=-1 newOp pSum=-2 oppSum=? windSum=? windValue=1 oppValue=2
272 SkOpSegment::markWinding id=7 (0,2 0,0) t=0 [1] (0,2) tEnd=0 newWindSum=-1 newOp pSum=-2 oppSum=? windSum=? windValue=1 oppValue=2
273 SkOpSegment::markWinding id=7 (0,2 0,0) t=0 [2] (0,2) tEnd=0 newWindSum=-1 newOp pSum=-2 oppSum=? windSum=? windValue=1 oppValue=2
274 SkOpSegment::markWinding id=7 (0,2 0,0) t=0 [3] (0,2) tEnd=0.5 newWindSum=-1 new OppSum=-2 oppSum=? windSum=? windValue=1 oppValue=2
275 SkOpSegment::markAngle last id=7 windSum=-1 small=0
276 SkOpSegment::debugShowActiveSpans id=4 (0,0 2,0) t=0.5 (1,0) tEnd=1 other=8 othe rT=0.5 otherIndex=4 windSum=2 windValue=1 oppValue=2
277 SkOpSegment::debugShowActiveSpans id=5 (2,0 2,2) t=0 (2,0) tEnd=1 other=9 otherT =0 otherIndex=0 windSum=? windValue=1 oppValue=1
278 SkOpSegment::debugShowActiveSpans id=6 (2,2 0,2) t=0 (2,2) tEnd=1 other=9 otherT =1 otherIndex=5 windSum=? windValue=1 oppValue=1
279 SkOpSegment::debugShowActiveSpans id=7 (0,2 0,0) t=0 (0,2) tEnd=0.5 other=11 oth erT=0 otherIndex=0 windSum=-1 windValue=1 oppValue=2
280 SkOpSegment::debugShowActiveSpans id=12 (0,0 3,0) t=0.666666667 (2,0) tEnd=1 oth er=8 otherT=1 otherIndex=9 windSum=? windValue=1 oppValue=0
281 SkOpSegment::debugShowActiveSpans id=13 (3,0 3,3) t=0 (3,0) tEnd=1 other=12 othe rT=1 otherIndex=12 windSum=? windValue=1 oppValue=0
282 SkOpSegment::debugShowActiveSpans id=14 (3,3 0,3) t=0 (3,3) tEnd=1 other=13 othe rT=1 otherIndex=1 windSum=? windValue=1 oppValue=0
283 SkOpSegment::debugShowActiveSpans id=15 (0,3 0,0) t=0 (0,3) tEnd=0.333333333 oth er=14 otherT=1 otherIndex=1 windSum=? windValue=1 oppValue=0
284 SkOpSegment::activeOp id=7 t=0.5 tEnd=0 op=diff miFrom=0 miTo=1 suFrom=0 suTo=1 result=0
285 SkOpSegment::markDoneBinary id=7 (0,2 0,0) t=0 [0] (0,2) tEnd=0 newWindSum=-1 ne wOppSum=-2 oppSum=-2 windSum=-1 windValue=1 oppValue=2
286 SkOpSegment::markDoneBinary id=7 (0,2 0,0) t=0 [1] (0,2) tEnd=0 newWindSum=-1 ne wOppSum=-2 oppSum=-2 windSum=-1 windValue=1 oppValue=2
287 SkOpSegment::markDoneBinary id=7 (0,2 0,0) t=0 [2] (0,2) tEnd=0 newWindSum=-1 ne wOppSum=-2 oppSum=-2 windSum=-1 windValue=1 oppValue=2
288 SkOpSegment::markDoneBinary id=7 (0,2 0,0) t=0 [3] (0,2) tEnd=0.5 newWindSum=-1 newOppSum=-2 oppSum=-2 windSum=-1 windValue=1 oppValue=2
289 bridgeOp chase.append id=7 windSum=-1 small=0
290 SkOpSegment::markWinding id=15 (0,3 0,0) t=0 [0] (0,3) tEnd=0.333333333 newWindS um=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
291 SkOpSegment::markWinding id=14 (3,3 0,3) t=0 [0] (3,3) tEnd=1 newWindSum=-1 newO ppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
292 SkOpSegment::markWinding id=13 (3,0 3,3) t=0 [0] (3,0) tEnd=1 newWindSum=-1 newO ppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
293 SkOpSegment::markWinding id=12 (0,0 3,0) t=0.666666667 [10] (2,0) tEnd=0.6666666 67 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
294 SkOpSegment::markWinding id=12 (0,0 3,0) t=0.666666667 [9] (2,0) tEnd=0.66666666 7 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
295 SkOpSegment::markWinding id=12 (0,0 3,0) t=0.666666667 [8] (2,0) tEnd=0.66666666 7 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
296 SkOpSegment::markWinding id=12 (0,0 3,0) t=0.666666667 [11] (2,0) tEnd=1 newWind Sum=-1 newOppSum=0 oppSum=? windSum=? windValue=1 oppValue=0
297 SkOpSegment::markAngle last id=12 windSum=-1 small=0
298 SkOpSegment::markWinding id=6 (2,2 0,2) t=0 [0] (2,2) tEnd=0 newWindSum=-1 newOp pSum=-2 oppSum=? windSum=? windValue=1 oppValue=1
299 SkOpSegment::markWinding id=6 (2,2 0,2) t=0 [1] (2,2) tEnd=1 newWindSum=-1 newOp pSum=-2 oppSum=? windSum=? windValue=1 oppValue=1
300 SkOpSegment::nextChase mismatched signs
301 SkOpSegment::markAngle last id=6 windSum=-1 small=0
302 SkOpSegment::debugShowActiveSpans id=4 (0,0 2,0) t=0.5 (1,0) tEnd=1 other=8 othe rT=0.5 otherIndex=4 windSum=2 windValue=1 oppValue=2
303 SkOpSegment::debugShowActiveSpans id=5 (2,0 2,2) t=0 (2,0) tEnd=1 other=9 otherT =0 otherIndex=0 windSum=? windValue=1 oppValue=1
304 SkOpSegment::debugShowActiveSpans id=6 (2,2 0,2) t=0 (2,2) tEnd=1 other=9 otherT =1 otherIndex=5 windSum=-1 windValue=1 oppValue=1
305 SkOpSegment::debugShowActiveSpans id=12 (0,0 3,0) t=0.666666667 (2,0) tEnd=1 oth er=8 otherT=1 otherIndex=9 windSum=-1 windValue=1 oppValue=0
306 SkOpSegment::debugShowActiveSpans id=13 (3,0 3,3) t=0 (3,0) tEnd=1 other=12 othe rT=1 otherIndex=12 windSum=-1 windValue=1 oppValue=0
307 SkOpSegment::debugShowActiveSpans id=14 (3,3 0,3) t=0 (3,3) tEnd=1 other=13 othe rT=1 otherIndex=1 windSum=-1 windValue=1 oppValue=0
308 SkOpSegment::debugShowActiveSpans id=15 (0,3 0,0) t=0 (0,3) tEnd=0.333333333 oth er=14 otherT=1 otherIndex=1 windSum=-1 windValue=1 oppValue=0
309 SkOpSegment::activeOp id=15 t=0.333333333 tEnd=0 op=diff miFrom=0 miTo=0 suFrom= 0 suTo=1 result=0
310 SkOpSegment::markDoneBinary id=15 (0,3 0,0) t=0 [0] (0,3) tEnd=0.333333333 newWi ndSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
311 SkOpSegment::markDoneBinary id=14 (3,3 0,3) t=0 [0] (3,3) tEnd=1 newWindSum=-1 n ewOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
312 SkOpSegment::markDoneBinary id=13 (3,0 3,3) t=0 [0] (3,0) tEnd=1 newWindSum=-1 n ewOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
313 SkOpSegment::markDoneBinary id=12 (0,0 3,0) t=0.666666667 [10] (2,0) tEnd=0.6666 66667 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
314 SkOpSegment::markDoneBinary id=12 (0,0 3,0) t=0.666666667 [9] (2,0) tEnd=0.66666 6667 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
315 SkOpSegment::markDoneBinary id=12 (0,0 3,0) t=0.666666667 [8] (2,0) tEnd=0.66666 6667 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
316 SkOpSegment::markDoneBinary id=12 (0,0 3,0) t=0.666666667 [11] (2,0) tEnd=1 newW indSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1 oppValue=0
317 bridgeOp chase.append id=12 windSum=-1 small=0
318 SkOpSegment::debugShowActiveSpans id=4 (0,0 2,0) t=0.5 (1,0) tEnd=1 other=8 othe rT=0.5 otherIndex=4 windSum=2 windValue=1 oppValue=2
319 SkOpSegment::debugShowActiveSpans id=5 (2,0 2,2) t=0 (2,0) tEnd=1 other=9 otherT =0 otherIndex=0 windSum=? windValue=1 oppValue=1
320 SkOpSegment::debugShowActiveSpans id=6 (2,2 0,2) t=0 (2,2) tEnd=1 other=9 otherT =1 otherIndex=5 windSum=-1 windValue=1 oppValue=1
321 SkOpSegment::activeOp id=4 t=1 tEnd=0.5 op=diff miFrom=0 miTo=1 suFrom=0 suTo=1 result=0
322 SkOpSegment::markDoneBinary id=4 (0,0 2,0) t=0.5 [6] (1,0) tEnd=0.5 newWindSum=2 newOppSum=-2 oppSum=-2 windSum=2 windValue=1 oppValue=2
323 SkOpSegment::markDoneBinary id=4 (0,0 2,0) t=0.5 [5] (1,0) tEnd=0.5 newWindSum=2 newOppSum=-2 oppSum=-2 windSum=2 windValue=1 oppValue=2
324 SkOpSegment::markDoneBinary id=4 (0,0 2,0) t=0.5 [4] (1,0) tEnd=0.5 newWindSum=2 newOppSum=-2 oppSum=-2 windSum=2 windValue=1 oppValue=2
325 SkOpSegment::markDoneBinary id=4 (0,0 2,0) t=0.5 [7] (1,0) tEnd=1 newWindSum=2 n ewOppSum=-2 oppSum=-2 windSum=2 windValue=1 oppValue=2
326 bridgeOp chase.append id=4 windSum=2 small=0
327 SkOpSegment::markWinding id=5 (2,0 2,2) t=0 [0] (2,0) tEnd=0 newWindSum=2 newOpp Sum=-2 oppSum=? windSum=? windValue=1 oppValue=1
328 SkOpSegment::markWinding id=5 (2,0 2,2) t=0 [1] (2,0) tEnd=0 newWindSum=2 newOpp Sum=-2 oppSum=? windSum=? windValue=1 oppValue=1
329 SkOpSegment::markWinding id=5 (2,0 2,2) t=0 [2] (2,0) tEnd=0 newWindSum=2 newOpp Sum=-2 oppSum=? windSum=? windValue=1 oppValue=1
330 SkOpSegment::markWinding id=5 (2,0 2,2) t=0 [3] (2,0) tEnd=1 newWindSum=2 newOpp Sum=-2 oppSum=? windSum=? windValue=1 oppValue=1
331 SkOpSegment::nextChase mismatched signs
332 </div>
333
334 <div id="refRects4">
335 RunTestSet [rects4]
336
337 {{0,0}, {1,0}},
338 {{1,0}, {1,1}},
339 {{1,1}, {0,1}},
340 {{0,1}, {0,0}},
341 {{0,0}, {2,0}},
342 {{2,0}, {2,2}},
343 {{2,2}, {0,2}},
344 {{0,2}, {0,0}},
345 op difference
346 {{0,0}, {2,0}},
347 {{2,0}, {2,2}},
348 {{2,2}, {0,2}},
349 {{0,2}, {0,0}},
350 {{0,0}, {3,0}},
351 {{3,0}, {3,3}},
352 {{3,3}, {0,3}},
353 {{0,3}, {0,0}},
354 debugShowLineIntersection wtTs[0]=0 {{1,0}, {1,1}} {{1,0}} wnTs[0]=1 {{0,0}, {1, 0}}
355 debugShowLineIntersection wtTs[0]=1 {{0,1}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {1, 0}}
356 debugShowLineIntersection wtTs[0]=0 {{1,1}, {0,1}} {{1,1}} wnTs[0]=1 {{1,0}, {1, 1}}
357 debugShowLineIntersection wtTs[0]=0 {{0,1}, {0,0}} {{0,1}} wnTs[0]=1 {{1,1}, {0, 1}}
358 debugShowLineIntersection wtTs[0]=0 {{0,0}, {2,0}} {{0,0}} wtTs[1]=0.5 {{1,0}} w nTs[0]=0 {{0,0}, {1,0}} wnTs[1]=1
359 debugShowLineIntersection wtTs[0]=1 {{0,2}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {1, 0}}
360 debugShowLineIntersection wtTs[0]=0.5 {{0,0}, {2,0}} {{1,0}} wnTs[0]=0 {{1,0}, { 1,1}}
361 debugShowLineIntersection wtTs[0]=0.5 {{0,2}, {0,0}} {{0,1}} wnTs[0]=1 {{1,1}, { 0,1}}
362 debugShowLineIntersection wtTs[0]=0 {{0,0}, {2,0}} {{0,0}} wnTs[0]=1 {{0,1}, {0, 0}}
363 debugShowLineIntersection wtTs[0]=0.5 {{0,2}, {0,0}} {{0,1}} wtTs[1]=1 {{0,0}} w nTs[0]=0 {{0,1}, {0,0}} wnTs[1]=1
364 debugShowLineIntersection wtTs[0]=0 {{0,0}, {2,0}} {{0,0}} wtTs[1]=0.5 {{1,0}} w nTs[0]=0 {{0,0}, {1,0}} wnTs[1]=1
365 debugShowLineIntersection wtTs[0]=1 {{0,2}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {1, 0}}
366 debugShowLineIntersection wtTs[0]=0.5 {{0,0}, {2,0}} {{1,0}} wnTs[0]=0 {{1,0}, { 1,1}}
367 debugShowLineIntersection wtTs[0]=0.5 {{0,2}, {0,0}} {{0,1}} wnTs[0]=1 {{1,1}, { 0,1}}
368 debugShowLineIntersection wtTs[0]=0 {{0,0}, {2,0}} {{0,0}} wnTs[0]=1 {{0,1}, {0, 0}}
369 debugShowLineIntersection wtTs[0]=0.5 {{0,2}, {0,0}} {{0,1}} wtTs[1]=1 {{0,0}} w nTs[0]=0 {{0,1}, {0,0}} wnTs[1]=1
370 debugShowLineIntersection wtTs[0]=0 {{0,0}, {3,0}} {{0,0}} wtTs[1]=0.333333333 { {1,0}} wnTs[0]=0 {{0,0}, {1,0}} wnTs[1]=1
371 debugShowLineIntersection wtTs[0]=1 {{0,3}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {1, 0}}
372 debugShowLineIntersection wtTs[0]=0.333333333 {{0,0}, {3,0}} {{1,0}} wnTs[0]=0 { {1,0}, {1,1}}
373 debugShowLineIntersection wtTs[0]=0.666666667 {{0,3}, {0,0}} {{0,1}} wnTs[0]=1 { {1,1}, {0,1}}
374 debugShowLineIntersection wtTs[0]=0 {{0,0}, {3,0}} {{0,0}} wnTs[0]=1 {{0,1}, {0, 0}}
375 debugShowLineIntersection wtTs[0]=0.666666667 {{0,3}, {0,0}} {{0,1}} wtTs[1]=1 { {0,0}} wnTs[0]=0 {{0,1}, {0,0}} wnTs[1]=1
376 debugShowLineIntersection wtTs[0]=0 {{2,0}, {2,2}} {{2,0}} wnTs[0]=1 {{0,0}, {2, 0}}
377 debugShowLineIntersection wtTs[0]=1 {{0,2}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {2, 0}}
378 debugShowLineIntersection wtTs[0]=0 {{2,2}, {0,2}} {{2,2}} wnTs[0]=1 {{2,0}, {2, 2}}
379 debugShowLineIntersection wtTs[0]=0 {{0,2}, {0,0}} {{0,2}} wnTs[0]=1 {{2,2}, {0, 2}}
380 debugShowLineIntersection wtTs[0]=0 {{0,0}, {2,0}} {{0,0}} wtTs[1]=1 {{2,0}} wnT s[0]=0 {{0,0}, {2,0}} wnTs[1]=1
381 debugShowLineIntersection wtTs[0]=0 {{2,0}, {2,2}} {{2,0}} wnTs[0]=1 {{0,0}, {2, 0}}
382 debugShowLineIntersection wtTs[0]=1 {{0,2}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {2, 0}}
383 debugShowLineIntersection wtTs[0]=1 {{0,0}, {2,0}} {{2,0}} wnTs[0]=0 {{2,0}, {2, 2}}
384 debugShowLineIntersection wtTs[0]=0 {{2,0}, {2,2}} {{2,0}} wtTs[1]=1 {{2,2}} wnT s[0]=0 {{2,0}, {2,2}} wnTs[1]=1
385 debugShowLineIntersection wtTs[0]=0 {{2,2}, {0,2}} {{2,2}} wnTs[0]=1 {{2,0}, {2, 2}}
386 debugShowLineIntersection wtTs[0]=1 {{2,0}, {2,2}} {{2,2}} wnTs[0]=0 {{2,2}, {0, 2}}
387 debugShowLineIntersection wtTs[0]=0 {{2,2}, {0,2}} {{2,2}} wtTs[1]=1 {{0,2}} wnT s[0]=0 {{2,2}, {0,2}} wnTs[1]=1
388 debugShowLineIntersection wtTs[0]=0 {{0,2}, {0,0}} {{0,2}} wnTs[0]=1 {{2,2}, {0, 2}}
389 debugShowLineIntersection wtTs[0]=0 {{0,0}, {2,0}} {{0,0}} wnTs[0]=1 {{0,2}, {0, 0}}
390 debugShowLineIntersection wtTs[0]=1 {{2,2}, {0,2}} {{0,2}} wnTs[0]=0 {{0,2}, {0, 0}}
391 debugShowLineIntersection wtTs[0]=0 {{0,2}, {0,0}} {{0,2}} wtTs[1]=1 {{0,0}} wnT s[0]=0 {{0,2}, {0,0}} wnTs[1]=1
392 debugShowLineIntersection wtTs[0]=0 {{0,0}, {3,0}} {{0,0}} wtTs[1]=0.666666667 { {2,0}} wnTs[0]=0 {{0,0}, {2,0}} wnTs[1]=1
393 debugShowLineIntersection wtTs[0]=1 {{0,3}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {2, 0}}
394 debugShowLineIntersection wtTs[0]=0.666666667 {{0,0}, {3,0}} {{2,0}} wnTs[0]=0 { {2,0}, {2,2}}
395 debugShowLineIntersection wtTs[0]=0.333333333 {{0,3}, {0,0}} {{0,2}} wnTs[0]=1 { {2,2}, {0,2}}
396 debugShowLineIntersection wtTs[0]=0 {{0,0}, {3,0}} {{0,0}} wnTs[0]=1 {{0,2}, {0, 0}}
397 debugShowLineIntersection wtTs[0]=0.333333333 {{0,3}, {0,0}} {{0,2}} wtTs[1]=1 { {0,0}} wnTs[0]=0 {{0,2}, {0,0}} wnTs[1]=1
398 debugShowLineIntersection wtTs[0]=0 {{2,0}, {2,2}} {{2,0}} wnTs[0]=1 {{0,0}, {2, 0}}
399 debugShowLineIntersection wtTs[0]=1 {{0,2}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {2, 0}}
400 debugShowLineIntersection wtTs[0]=0 {{2,2}, {0,2}} {{2,2}} wnTs[0]=1 {{2,0}, {2, 2}}
401 debugShowLineIntersection wtTs[0]=0 {{0,2}, {0,0}} {{0,2}} wnTs[0]=1 {{2,2}, {0, 2}}
402 debugShowLineIntersection wtTs[0]=0 {{0,0}, {3,0}} {{0,0}} wtTs[1]=0.666666667 { {2,0}} wnTs[0]=0 {{0,0}, {2,0}} wnTs[1]=1
403 debugShowLineIntersection wtTs[0]=1 {{0,3}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {2, 0}}
404 debugShowLineIntersection wtTs[0]=0.666666667 {{0,0}, {3,0}} {{2,0}} wnTs[0]=0 { {2,0}, {2,2}}
405 debugShowLineIntersection wtTs[0]=0.333333333 {{0,3}, {0,0}} {{0,2}} wnTs[0]=1 { {2,2}, {0,2}}
406 debugShowLineIntersection wtTs[0]=0 {{0,0}, {3,0}} {{0,0}} wnTs[0]=1 {{0,2}, {0, 0}}
407 debugShowLineIntersection wtTs[0]=0.333333333 {{0,3}, {0,0}} {{0,2}} wtTs[1]=1 { {0,0}} wnTs[0]=0 {{0,2}, {0,0}} wnTs[1]=1
408 debugShowLineIntersection wtTs[0]=0 {{3,0}, {3,3}} {{3,0}} wnTs[0]=1 {{0,0}, {3, 0}}
409 debugShowLineIntersection wtTs[0]=1 {{0,3}, {0,0}} {{0,0}} wnTs[0]=0 {{0,0}, {3, 0}}
410 debugShowLineIntersection wtTs[0]=0 {{3,3}, {0,3}} {{3,3}} wnTs[0]=1 {{3,0}, {3, 3}}
411 debugShowLineIntersection wtTs[0]=0 {{0,3}, {0,0}} {{0,3}} wnTs[0]=1 {{3,3}, {0, 3}}
412 SkOpSegment::debugShowTs - id=0 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=1 t=1 1,0 w=1 o =0]
413 SkOpSegment::debugShowTs o id=4 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=1 t=0.5 1,0 w=1 o=0] [o=9,5 t=1 2,0 w=1 o=0]
414 SkOpSegment::addTPair addTPair this=4 0.5 other=0 1
415 SkOpSegment::debugShowTs + id=0 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=4,1 t=1 1,0 w=1 o=0]
416 SkOpSegment::debugShowTs o id=4 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0]
417 SkOpSegment::debugShowTs - id=3 [o=2 t=0 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o= 0]
418 SkOpSegment::debugShowTs o id=7 [o=10,6 t=0 0,2 w=1 o=0] [o=2 t=0.5 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
419 SkOpSegment::addTPair addTPair this=3 0 other=7 0.5
420 SkOpSegment::debugShowTs + id=3 [o=7,2 t=0 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
421 SkOpSegment::debugShowTs o id=7 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o= 0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
422 SkOpSegment::debugShowTs - id=0 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=4,1 t=1 1,0 w=1 o=0]
423 SkOpSegment::debugShowTs o id=8 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=1 t=0.5 1,0 w=1 o=0] [o=9,5 t=1 2,0 w=1 o=0] operand
424 SkOpSegment::addTPair addTPair this=8 0.5 other=0 1
425 SkOpSegment::debugShowTs + id=0 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=8,4,1 t=1 1,0 w =1 o=0]
426 SkOpSegment::debugShowTs o id=8 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0] operand
427 SkOpSegment::debugShowTs - id=3 [o=7,2 t=0 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
428 SkOpSegment::debugShowTs o id=11 [o=10,6 t=0 0,2 w=1 o=0] [o=2 t=0.5 0,1 w=1 o=0 ] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
429 SkOpSegment::addTPair addTPair this=3 0 other=11 0.5
430 SkOpSegment::debugShowTs + id=3 [o=11,7,2 t=0 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w =1 o=0]
431 SkOpSegment::debugShowTs o id=11 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o =0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
432 SkOpSegment::debugShowTs - id=0 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=8,4,1 t=1 1,0 w =1 o=0]
433 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=1 t=0.333 1,0 w=1 o=0] [o=9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
434 SkOpSegment::addTPair addTPair this=12 0.333333333 other=0 1
435 SkOpSegment::debugShowTs + id=0 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=12,8,4,1 t=1 1, 0 w=1 o=0]
436 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.333 1, 0 w=1 o=0] [o=9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
437 SkOpSegment::debugShowTs - id=3 [o=11,7,2 t=0 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w =1 o=0]
438 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=10,6 t=0.333 0,2 w=1 o=0] [o=2 t=0.667 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
439 SkOpSegment::addTPair addTPair this=3 0 other=15 0.666666667
440 SkOpSegment::debugShowTs + id=3 [o=15,11,7,2 t=0 0,1 w=1 o=0] [o=12,8,4,0 t=1 0, 0 w=1 o=0]
441 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=10,6 t=0.333 0,2 w=1 o=0] [o=3,2 t=0.667 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
442 SkOpSegment::debugShowTs - id=4 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0]
443 SkOpSegment::debugShowTs o id=8 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0] operand
444 SkOpSegment::debugShowTs + id=4 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0]
445 SkOpSegment::debugShowTs o id=8 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0] operand
446 SkOpSegment::debugShowTs - id=5 [o=12,8,4 t=0 2,0 w=1 o=0] [o=10,6 t=1 2,2 w=1 o =0]
447 SkOpSegment::debugShowTs o id=9 [o=12,8,4 t=0 2,0 w=1 o=0] [o=10,6 t=1 2,2 w=1 o =0] operand
448 SkOpSegment::debugShowTs + id=5 [o=12,8,4 t=0 2,0 w=1 o=0] [o=10,6 t=1 2,2 w=1 o =0]
449 SkOpSegment::debugShowTs o id=9 [o=12,8,4 t=0 2,0 w=1 o=0] [o=10,6 t=1 2,2 w=1 o =0] operand
450 SkOpSegment::debugShowTs - id=6 [o=9,5 t=0 2,2 w=1 o=0] [o=15,11,7 t=1 0,2 w=1 o =0]
451 SkOpSegment::debugShowTs o id=10 [o=9,5 t=0 2,2 w=1 o=0] [o=15,11,7 t=1 0,2 w=1 o=0] operand
452 SkOpSegment::debugShowTs + id=6 [o=9,5 t=0 2,2 w=1 o=0] [o=15,11,7 t=1 0,2 w=1 o =0]
453 SkOpSegment::debugShowTs o id=10 [o=9,5 t=0 2,2 w=1 o=0] [o=15,11,7 t=1 0,2 w=1 o=0] operand
454 SkOpSegment::debugShowTs - id=7 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o= 0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
455 SkOpSegment::debugShowTs o id=11 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o =0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
456 SkOpSegment::debugShowTs + id=7 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o= 0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
457 SkOpSegment::debugShowTs o id=11 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o =0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
458 SkOpSegment::debugShowTs - id=4 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0]
459 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.333 1, 0 w=1 o=0] [o=9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
460 SkOpSegment::addTPair addTPair this=12 0.666666667 other=4 1
461 SkOpSegment::debugShowTs + id=4 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=12,9,5 t=1 2,0 w=1 o=0]
462 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.333 1, 0 w=1 o=0] [o=4,9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
463 SkOpSegment::debugShowTs - id=7 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o= 0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
464 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=10,6 t=0.333 0,2 w=1 o=0] [o=3,2 t=0.667 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
465 SkOpSegment::addTPair addTPair this=7 0 other=15 0.333333333
466 SkOpSegment::debugShowTs + id=7 [o=15,10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
467 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=7,10,6 t=0.333 0,2 w= 1 o=0] [o=3,2 t=0.667 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
468 SkOpSegment::debugShowTs - id=8 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=9,5 t=1 2,0 w=1 o=0] operand
469 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.333 1, 0 w=1 o=0] [o=4,9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
470 SkOpSegment::addTPair addTPair this=12 0.666666667 other=8 1
471 SkOpSegment::debugShowTs + id=8 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=12,9,5 t=1 2,0 w=1 o=0] operand
472 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.333 1, 0 w=1 o=0] [o=8,4,9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
473 SkOpSegment::debugShowTs - id=11 [o=10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=1 o =0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
474 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=7,10,6 t=0.333 0,2 w= 1 o=0] [o=3,2 t=0.667 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
475 SkOpSegment::addTPair addTPair this=11 0 other=15 0.333333333
476 SkOpSegment::debugShowTs + id=11 [o=15,10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w= 1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
477 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=11,7,10,6 t=0.333 0,2 w=1 o=0] [o=3,2 t=0.667 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
478 SkOpContour::calcCoincidentWinding count=6
479 SkOpSegment::debugShowTs p id=0 [o=15,11,7,3 t=0 0,0 w=0 o=0] [o=12,8,4,1 t=1 1, 0 w=1 o=0] done
480 SkOpSegment::debugShowTs o id=4 [o=15,11,7,3 t=0 0,0 w=0 o=0] [o=0,1 t=0.5 1,0 w =1 o=0] [o=12,9,5 t=1 2,0 w=1 o=0]
481 SkOpSegment::debugShowTs p id=3 [o=15,11,7,2 t=0 0,1 w=0 o=0] [o=12,8,4,0 t=1 0, 0 w=1 o=0] done
482 SkOpSegment::debugShowTs o id=7 [o=15,10,6 t=0 0,2 w=1 o=0] [o=3,2 t=0.5 0,1 w=0 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
483 SkOpContour::calcCoincidentWinding count=6
484 SkOpSegment::debugShowTs p id=4 [o=15,11,7,3 t=0 0,0 w=0 o=0] [o=0,1 t=0.5 1,0 w =1 o=1] [o=12,9,5 t=1 2,0 w=1 o=0]
485 SkOpSegment::debugShowTs o id=8 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.5 1,0 w =0 o=0] [o=12,9,5 t=1 2,0 w=1 o=0] operand
486 SkOpSegment::debugShowTs p id=5 [o=12,8,4 t=0 2,0 w=1 o=1] [o=10,6 t=1 2,2 w=1 o =0]
487 SkOpSegment::debugShowTs o id=9 [o=12,8,4 t=0 2,0 w=0 o=0] [o=10,6 t=1 2,2 w=1 o =0] operand done
488 SkOpSegment::debugShowTs p id=6 [o=9,5 t=0 2,2 w=1 o=1] [o=15,11,7 t=1 0,2 w=1 o =0]
489 SkOpSegment::debugShowTs o id=10 [o=9,5 t=0 2,2 w=0 o=0] [o=15,11,7 t=1 0,2 w=1 o=0] operand done
490 SkOpSegment::debugShowTs p id=7 [o=15,10,6 t=0 0,2 w=1 o=1] [o=3,2 t=0.5 0,1 w=0 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
491 SkOpSegment::debugShowTs o id=11 [o=15,10,6 t=0 0,2 w=0 o=0] [o=3,2 t=0.5 0,1 w= 1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
492 SkOpSegment::debugShowTs p id=4 [o=15,11,7,3 t=0 0,0 w=0 o=0] [o=0,1 t=0.5 1,0 w =1 o=2] [o=12,9,5 t=1 2,0 w=1 o=0]
493 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=1 o=0] [o=0,1 t=0.333 1, 0 w=0 o=0] [o=8,4,9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
494 SkOpSegment::debugShowTs p id=7 [o=15,10,6 t=0 0,2 w=1 o=2] [o=3,2 t=0.5 0,1 w=0 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0]
495 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=11,7,10,6 t=0.333 0,2 w=0 o=0] [o=3,2 t=0.667 0,1 w=1 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
496 SkOpContour::calcCoincidentWinding count=2
497 SkOpSegment::debugShowTs p id=8 [o=15,11,7,3 t=0 0,0 w=2 o=0] [o=0,1 t=0.5 1,0 w =0 o=0] [o=12,9,5 t=1 2,0 w=1 o=0] operand
498 SkOpSegment::debugShowTs o id=12 [o=15,11,7,3 t=0 0,0 w=0 o=0] [o=0,1 t=0.333 1, 0 w=0 o=0] [o=8,4,9,5 t=0.667 2,0 w=1 o=0] [o=13 t=1 3,0 w=1 o=0] operand
499 SkOpSegment::debugShowTs p id=11 [o=15,10,6 t=0 0,2 w=0 o=0] [o=3,2 t=0.5 0,1 w= 2 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
500 SkOpSegment::debugShowTs o id=15 [o=14 t=0 0,3 w=1 o=0] [o=11,7,10,6 t=0.333 0,2 w=0 o=0] [o=3,2 t=0.667 0,1 w=0 o=0] [o=12,8,4,0 t=1 0,0 w=1 o=0] operand
501 SkOpSegment::addTPair addTPair this=12 0.333333333 other=8 0.5
502 SkOpSegment::addTPair addTPair this=12 0.333333333 other=4 0.5
503 SkOpSegment::addTPair addTPair duplicate this=8 0.5 other=12 0.333333333
504 SkOpSegment::addTPair addTPair this=8 0.5 other=4 0.5
505 SkOpSegment::addTPair addTPair duplicate this=4 0.5 other=8 0.5
506 SkOpSegment::addTPair addTPair duplicate this=4 0.5 other=12 0.333333333
507 SkOpSegment::addTPair addTPair this=15 0.666666667 other=11 0.5
508 SkOpSegment::addTPair addTPair this=15 0.666666667 other=7 0.5
509 SkOpSegment::addTPair addTPair duplicate this=11 0.5 other=15 0.666666667
510 SkOpSegment::addTPair addTPair this=11 0.5 other=7 0.5
511 SkOpSegment::addTPair addTPair duplicate this=7 0.5 other=11 0.5
512 SkOpSegment::addTPair addTPair duplicate this=7 0.5 other=15 0.666666667
513 SkOpSegment::addTPair addTPair this=4 1 other=8 1
514 SkOpSegment::addTPair addTPair this=5 0 other=9 0
515 SkOpSegment::addTPair addTPair duplicate this=5 0 other=9 0
516 SkOpSegment::addTPair addTPair duplicate this=5 0 other=9 0
517 SkOpSegment::addTPair addTPair this=6 1 other=10 1
518 SkOpSegment::addTPair addTPair this=7 0 other=11 0
519 SkOpSegment::addTPair addTPair duplicate this=7 0 other=11 0
520 SkOpSegment::addTPair addTPair duplicate this=7 0 other=11 0
521 SkOpContour::joinCoincidence count=6
522 SkOpContour::joinCoincidence count=6
523 SkOpContour::joinCoincidence count=2
524 SkOpSegment::sortAngles [1] tStart=0 [1]
525 SkOpAngle::after [1/0] 23/23 tStart=0 tEnd=1 < [4/0] 31/31 tStart=0.5 tEnd=1 < [ 8/1] 15/15 tStart=0.5 tEnd=0 T 4
526 SkOpSegment::sortAngles [2] tStart=1 [2]
527 SkOpAngle::after [2/0] 31/31 tStart=1 tEnd=0 < [7/1] 23/23 tStart=0.5 tEnd=0 < [ 11/0] 7/7 tStart=0.5 tEnd=1 F 4
528 SkOpSegment::sortAngles [4] tStart=1 [9]
529 SkOpAngle::after [4/1] 15/15 tStart=1 tEnd=0.5 < [5/0] 23/23 tStart=0 tEnd=1 < [ 12/0] 31/31 tStart=0.666666667 tEnd=1 T 4
530 SkOpSegment::sortAngles [5] tStart=1 [5]
531 SkOpSegment::sortAngles [6] tStart=1 [3]
532 SkOpAngle::after [6/1] 31/31 tStart=1 tEnd=0 < [7/0] 7/7 tStart=0 tEnd=0.5 < [15 /0] 23/23 tStart=0.333333333 tEnd=0 T 4
533 SkOpSegment::sortAngles [8] tStart=0 [1]
534 SkOpSegment::debugShowActiveSpans id=1 (1,0 1,1) t=0 (1,0) tEnd=1 other=12 other T=0.333333333 otherIndex=7 windSum=? windValue=1 oppValue=0
535 SkOpSegment::debugShowActiveSpans id=2 (1,1 0,1) t=0 (1,1) tEnd=1 other=1 otherT =1 otherIndex=4 windSum=? windValue=1 oppValue=0
536 SkOpSegment::debugShowActiveSpans id=4 (0,0 2,0) t=0.5 (1,0) tEnd=1 other=8 othe rT=0.5 otherIndex=4 windSum=? windValue=1 oppValue=2
537 SkOpSegment::debugShowActiveSpans id=5 (2,0 2,2) t=0 (2,0) tEnd=1 other=9 otherT =0 otherIndex=0 windSum=? windValue=1 oppValue=1
538 SkOpSegment::debugShowActiveSpans id=6 (2,2 0,2) t=0 (2,2) tEnd=1 other=9 otherT =1 otherIndex=5 windSum=? windValue=1 oppValue=1
539 SkOpSegment::debugShowActiveSpans id=7 (0,2 0,0) t=0 (0,2) tEnd=0.5 other=11 oth erT=0 otherIndex=0 windSum=? windValue=1 oppValue=2
540 SkOpSegment::debugShowActiveSpans id=8 (0,0 2,0) t=0 (0,0) tEnd=0.5 other=15 oth erT=1 otherIndex=10 windSum=? windValue=2 oppValue=0
541 SkOpSegment::debugShowActiveSpans id=11 (0,2 0,0) t=0.5 (0,1) tEnd=1 other=7 oth erT=0.5 otherIndex=4 windSum=? windValue=2 oppValue=0
542 SkOpSegment::debugShowActiveSpans id=12 (0,0 3,0) t=0.666666667 (2,0) tEnd=1 oth er=8 otherT=1 otherIndex=9 windSum=? windValue=1 oppValue=0
543 SkOpSegment::debugShowActiveSpans id=13 (3,0 3,3) t=0 (3,0) tEnd=1 other=12 othe rT=1 otherIndex=12 windSum=? windValue=1 oppValue=0
544 SkOpSegment::debugShowActiveSpans id=14 (3,3 0,3) t=0 (3,3) tEnd=1 other=13 othe rT=1 otherIndex=1 windSum=? windValue=1 oppValue=0
545 SkOpSegment::debugShowActiveSpans id=15 (0,3 0,0) t=0 (0,3) tEnd=0.333333333 oth er=14 otherT=1 otherIndex=1 windSum=? windValue=1 oppValue=0
546 SkOpSegment::findTop
547 SkOpAngle::debugOne [11/1] next=8/0 sect=23/23 s=1 [11] e=0.5 [7] sgn=1 windVal =2 windSum=? operand
548 SkOpAngle::debugOne [8/0] next=11/1 sect=31/31 s=0 [0] e=0.5 [4] sgn=-1 windVal =2 windSum=? operand stop
549 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [6] (0,1) tEnd=0.5 newWindSum=-2 newOppSum=0 oppSum=? windSum=? windValue=2
550 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [5] (0,1) tEnd=0.5 newWindSum=-2 newOppSum=0 oppSum=? windSum=? windValue=2
551 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [4] (0,1) tEnd=0.5 newWindSum=-2 newOppSum=0 oppSum=? windSum=? windValue=2
552 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [7] (0,1) tEnd=1 newWindSum=-2 ne wOppSum=0 oppSum=? windSum=? windValue=2
553 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [6] (0,1) tEnd=0.5 newWindSum=-2 newOppSum=0 oppSum=0 windSum=-2 windValue=2
554 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [5] (0,1) tEnd=0.5 newWindSum=-2 newOppSum=0 oppSum=0 windSum=-2 windValue=2
555 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [4] (0,1) tEnd=0.5 newWindSum=-2 newOppSum=0 oppSum=0 windSum=-2 windValue=2
556 SkOpSegment::markWinding id=11 (0,2 0,0) t=0.5 [7] (0,1) tEnd=1 newWindSum=-2 ne wOppSum=0 oppSum=0 windSum=-2 windValue=2
557 SkOpSegment::activeOp op=diff miFrom=0 miTo=0 suFrom=1 suTo=0 result=0
558 SkOpSegment::markDoneBinary id=11 (0,2 0,0) t=0.5 [6] (0,1) tEnd=0.5 newWindSum= -2 newOppSum=0 oppSum=0 windSum=-2 windValue=2
559 SkOpSegment::markDoneBinary id=11 (0,2 0,0) t=0.5 [5] (0,1) tEnd=0.5 newWindSum= -2 newOppSum=0 oppSum=0 windSum=-2 windValue=2
560 SkOpSegment::markDoneBinary id=11 (0,2 0,0) t=0.5 [4] (0,1) tEnd=0.5 newWindSum= -2 newOppSum=0 oppSum=0 windSum=-2 windValue=2
561 SkOpSegment::markDoneBinary id=11 (0,2 0,0) t=0.5 [7] (0,1) tEnd=1 newWindSum=-2 newOppSum=0 oppSum=0 windSum=-2 windValue=2
562 SkOpSegment::markWinding id=8 (0,0 2,0) t=0 [0] (0,0) tEnd=0 newWindSum=-2 newOp pSum=0 oppSum=? windSum=? windValue=2
563 SkOpSegment::markWinding id=8 (0,0 2,0) t=0 [1] (0,0) tEnd=0 newWindSum=-2 newOp pSum=0 oppSum=? windSum=? windValue=2
564 SkOpSegment::markWinding id=8 (0,0 2,0) t=0 [2] (0,0) tEnd=0 newWindSum=-2 newOp pSum=0 oppSum=? windSum=? windValue=2
565 SkOpSegment::markWinding id=8 (0,0 2,0) t=0 [3] (0,0) tEnd=0.5 newWindSum=-2 new OppSum=0 oppSum=? windSum=? windValue=2
566 SkOpSegment::markAngle last id=8 windSum=? small=0
567 SkOpSegment::debugShowActiveSpans id=1 (1,0 1,1) t=0 (1,0) tEnd=1 other=12 other T=0.333333333 otherIndex=7 windSum=? windValue=1 oppValue=0
568 SkOpSegment::debugShowActiveSpans id=2 (1,1 0,1) t=0 (1,1) tEnd=1 other=1 otherT =1 otherIndex=4 windSum=? windValue=1 oppValue=0
569 SkOpSegment::debugShowActiveSpans id=4 (0,0 2,0) t=0.5 (1,0) tEnd=1 other=8 othe rT=0.5 otherIndex=4 windSum=? windValue=1 oppValue=2
570 SkOpSegment::debugShowActiveSpans id=5 (2,0 2,2) t=0 (2,0) tEnd=1 other=9 otherT =0 otherIndex=0 windSum=? windValue=1 oppValue=1
571 SkOpSegment::debugShowActiveSpans id=6 (2,2 0,2) t=0 (2,2) tEnd=1 other=9 otherT =1 otherIndex=5 windSum=? windValue=1 oppValue=1
572 SkOpSegment::debugShowActiveSpans id=7 (0,2 0,0) t=0 (0,2) tEnd=0.5 other=11 oth erT=0 otherIndex=0 windSum=? windValue=1 oppValue=2
573 SkOpSegment::debugShowActiveSpans id=8 (0,0 2,0) t=0 (0,0) tEnd=0.5 other=15 oth erT=1 otherIndex=10 windSum=-2 windValue=2 oppValue=0
574 SkOpSegment::debugShowActiveSpans id=12 (0,0 3,0) t=0.666666667 (2,0) tEnd=1 oth er=8 otherT=1 otherIndex=9 windSum=? windValue=1 oppValue=0
575 SkOpSegment::debugShowActiveSpans id=13 (3,0 3,3) t=0 (3,0) tEnd=1 other=12 othe rT=1 otherIndex=12 windSum=? windValue=1 oppValue=0
576 SkOpSegment::debugShowActiveSpans id=14 (3,3 0,3) t=0 (3,3) tEnd=1 other=13 othe rT=1 otherIndex=1 windSum=? windValue=1 oppValue=0
577 SkOpSegment::debugShowActiveSpans id=15 (0,3 0,0) t=0 (0,3) tEnd=0.333333333 oth er=14 otherT=1 otherIndex=1 windSum=? windValue=1 oppValue=0
578 SkOpSegment::activeOp op=diff miFrom=0 miTo=0 suFrom=1 suTo=0 result=0
579 SkOpSegment::markDoneBinary id=8 (0,0 2,0) t=0 [0] (0,0) tEnd=0 newWindSum=-2 ne wOppSum=0 oppSum=0 windSum=-2 windValue=2
580 SkOpSegment::markDoneBinary id=8 (0,0 2,0) t=0 [1] (0,0) tEnd=0 newWindSum=-2 ne wOppSum=0 oppSum=0 windSum=-2 windValue=2
581 SkOpSegment::markDoneBinary id=8 (0,0 2,0) t=0 [2] (0,0) tEnd=0 newWindSum=-2 ne wOppSum=0 oppSum=0 windSum=-2 windValue=2
582 SkOpSegment::markDoneBinary id=8 (0,0 2,0) t=0 [3] (0,0) tEnd=0.5 newWindSum=-2 newOppSum=0 oppSum=0 windSum=-2 windValue=2
583 SkOpSegment::markWinding id=1 (1,0 1,1) t=0 [0] (1,0) tEnd=0 newWindSum=1 newOpp Sum=-2 oppSum=? windSum=? windValue=1
584 SkOpSegment::markWinding id=1 (1,0 1,1) t=0 [1] (1,0) tEnd=0 newWindSum=1 newOpp Sum=-2 oppSum=? windSum=? windValue=1
585 SkOpSegment::markWinding id=1 (1,0 1,1) t=0 [2] (1,0) tEnd=0 newWindSum=1 newOpp Sum=-2 oppSum=? windSum=? windValue=1
586 SkOpSegment::markWinding id=1 (1,0 1,1) t=0 [3] (1,0) tEnd=1 newWindSum=1 newOpp Sum=-2 oppSum=? windSum=? windValue=1
587 SkOpSegment::markWinding id=2 (1,1 0,1) t=0 [0] (1,1) tEnd=1 newWindSum=1 newOpp Sum=-2 oppSum=? windSum=? windValue=1
588 SkOpSegment::markAngle last id=2 windSum=? small=0
589 SkOpSegment::markWinding id=4 (0,0 2,0) t=0.5 [4] (1,0) tEnd=0.5 newWindSum=2 ne wOppSum=-2 oppSum=? windSum=? windValue=1
590 SkOpSegment::markWinding id=4 (0,0 2,0) t=0.5 [5] (1,0) tEnd=0.5 newWindSum=2 ne wOppSum=-2 oppSum=? windSum=? windValue=1
591 SkOpSegment::markWinding id=4 (0,0 2,0) t=0.5 [6] (1,0) tEnd=0.5 newWindSum=2 ne wOppSum=-2 oppSum=? windSum=? windValue=1
592 SkOpSegment::markWinding id=4 (0,0 2,0) t=0.5 [7] (1,0) tEnd=1 newWindSum=2 newO ppSum=-2 oppSum=? windSum=? windValue=1
593 SkOpSegment::markAngle last id=4 windSum=? small=0
594 SkOpSegment::debugShowActiveSpans id=1 (1,0 1,1) t=0 (1,0) tEnd=1 other=12 other T=0.333333333 otherIndex=7 windSum=1 windValue=1 oppValue=0
595 SkOpSegment::debugShowActiveSpans id=2 (1,1 0,1) t=0 (1,1) tEnd=1 other=1 otherT =1 otherIndex=4 windSum=1 windValue=1 oppValue=0
596 SkOpSegment::debugShowActiveSpans id=4 (0,0 2,0) t=0.5 (1,0) tEnd=1 other=8 othe rT=0.5 otherIndex=4 windSum=2 windValue=1 oppValue=2
597 SkOpSegment::debugShowActiveSpans id=5 (2,0 2,2) t=0 (2,0) tEnd=1 other=9 otherT =0 otherIndex=0 windSum=? windValue=1 oppValue=1
598 SkOpSegment::debugShowActiveSpans id=6 (2,2 0,2) t=0 (2,2) tEnd=1 other=9 otherT =1 otherIndex=5 windSum=? windValue=1 oppValue=1
599 SkOpSegment::debugShowActiveSpans id=7 (0,2 0,0) t=0 (0,2) tEnd=0.5 other=11 oth erT=0 otherIndex=0 windSum=? windValue=1 oppValue=2
600 SkOpSegment::debugShowActiveSpans id=12 (0,0 3,0) t=0.666666667 (2,0) tEnd=1 oth er=8 otherT=1 otherIndex=9 windSum=? windValue=1 oppValue=0
601 SkOpSegment::debugShowActiveSpans id=13 (3,0 3,3) t=0 (3,0) tEnd=1 other=12 othe rT=1 otherIndex=12 windSum=? windValue=1 oppValue=0
602 SkOpSegment::debugShowActiveSpans id=14 (3,3 0,3) t=0 (3,3) tEnd=1 other=13 othe rT=1 otherIndex=1 windSum=? windValue=1 oppValue=0
603 SkOpSegment::debugShowActiveSpans id=15 (0,3 0,0) t=0 (0,3) tEnd=0.333333333 oth er=14 otherT=1 otherIndex=1 windSum=? windValue=1 oppValue=0
604 SkOpSegment::activeOp op=diff miFrom=0 miTo=1 suFrom=1 suTo=1 result=0
605 SkOpSegment::markDoneBinary id=1 (1,0 1,1) t=0 [0] (1,0) tEnd=0 newWindSum=1 new OppSum=-2 oppSum=-2 windSum=1 windValue=1
606 SkOpSegment::markDoneBinary id=1 (1,0 1,1) t=0 [1] (1,0) tEnd=0 newWindSum=1 new OppSum=-2 oppSum=-2 windSum=1 windValue=1
607 SkOpSegment::markDoneBinary id=1 (1,0 1,1) t=0 [2] (1,0) tEnd=0 newWindSum=1 new OppSum=-2 oppSum=-2 windSum=1 windValue=1
608 SkOpSegment::markDoneBinary id=1 (1,0 1,1) t=0 [3] (1,0) tEnd=1 newWindSum=1 new OppSum=-2 oppSum=-2 windSum=1 windValue=1
609 SkOpSegment::markDoneBinary id=2 (1,1 0,1) t=0 [0] (1,1) tEnd=1 newWindSum=1 new OppSum=-2 oppSum=-2 windSum=1 windValue=1
610 SkOpSegment::markWinding id=7 (0,2 0,0) t=0 [0] (0,2) tEnd=0 newWindSum=-1 newOp pSum=-2 oppSum=? windSum=? windValue=1
611 SkOpSegment::markWinding id=7 (0,2 0,0) t=0 [1] (0,2) tEnd=0 newWindSum=-1 newOp pSum=-2 oppSum=? windSum=? windValue=1
612 SkOpSegment::markWinding id=7 (0,2 0,0) t=0 [2] (0,2) tEnd=0 newWindSum=-1 newOp pSum=-2 oppSum=? windSum=? windValue=1
613 SkOpSegment::markWinding id=7 (0,2 0,0) t=0 [3] (0,2) tEnd=0.5 newWindSum=-1 new OppSum=-2 oppSum=? windSum=? windValue=1
614 SkOpSegment::markAngle last id=7 windSum=-1 small=0
615 SkOpSegment::debugShowActiveSpans id=4 (0,0 2,0) t=0.5 (1,0) tEnd=1 other=8 othe rT=0.5 otherIndex=4 windSum=2 windValue=1 oppValue=2
616 SkOpSegment::debugShowActiveSpans id=5 (2,0 2,2) t=0 (2,0) tEnd=1 other=9 otherT =0 otherIndex=0 windSum=? windValue=1 oppValue=1
617 SkOpSegment::debugShowActiveSpans id=6 (2,2 0,2) t=0 (2,2) tEnd=1 other=9 otherT =1 otherIndex=5 windSum=? windValue=1 oppValue=1
618 SkOpSegment::debugShowActiveSpans id=7 (0,2 0,0) t=0 (0,2) tEnd=0.5 other=11 oth erT=0 otherIndex=0 windSum=-1 windValue=1 oppValue=2
619 SkOpSegment::debugShowActiveSpans id=12 (0,0 3,0) t=0.666666667 (2,0) tEnd=1 oth er=8 otherT=1 otherIndex=9 windSum=? windValue=1 oppValue=0
620 SkOpSegment::debugShowActiveSpans id=13 (3,0 3,3) t=0 (3,0) tEnd=1 other=12 othe rT=1 otherIndex=12 windSum=? windValue=1 oppValue=0
621 SkOpSegment::debugShowActiveSpans id=14 (3,3 0,3) t=0 (3,3) tEnd=1 other=13 othe rT=1 otherIndex=1 windSum=? windValue=1 oppValue=0
622 SkOpSegment::debugShowActiveSpans id=15 (0,3 0,0) t=0 (0,3) tEnd=0.333333333 oth er=14 otherT=1 otherIndex=1 windSum=? windValue=1 oppValue=0
623 SkOpSegment::activeOp op=diff miFrom=0 miTo=1 suFrom=0 suTo=1 result=0
624 SkOpSegment::markDoneBinary id=7 (0,2 0,0) t=0 [0] (0,2) tEnd=0 newWindSum=-1 ne wOppSum=-2 oppSum=-2 windSum=-1 windValue=1
625 SkOpSegment::markDoneBinary id=7 (0,2 0,0) t=0 [1] (0,2) tEnd=0 newWindSum=-1 ne wOppSum=-2 oppSum=-2 windSum=-1 windValue=1
626 SkOpSegment::markDoneBinary id=7 (0,2 0,0) t=0 [2] (0,2) tEnd=0 newWindSum=-1 ne wOppSum=-2 oppSum=-2 windSum=-1 windValue=1
627 SkOpSegment::markDoneBinary id=7 (0,2 0,0) t=0 [3] (0,2) tEnd=0.5 newWindSum=-1 newOppSum=-2 oppSum=-2 windSum=-1 windValue=1
628 SkOpSegment::markWinding id=15 (0,3 0,0) t=0 [0] (0,3) tEnd=0.333333333 newWindS um=-1 newOppSum=0 oppSum=? windSum=? windValue=1
629 SkOpSegment::markWinding id=14 (3,3 0,3) t=0 [0] (3,3) tEnd=1 newWindSum=-1 newO ppSum=0 oppSum=? windSum=? windValue=1
630 SkOpSegment::markWinding id=13 (3,0 3,3) t=0 [0] (3,0) tEnd=1 newWindSum=-1 newO ppSum=0 oppSum=? windSum=? windValue=1
631 SkOpSegment::markWinding id=12 (0,0 3,0) t=0.666666667 [10] (2,0) tEnd=0.6666666 67 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1
632 SkOpSegment::markWinding id=12 (0,0 3,0) t=0.666666667 [9] (2,0) tEnd=0.66666666 7 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1
633 SkOpSegment::markWinding id=12 (0,0 3,0) t=0.666666667 [8] (2,0) tEnd=0.66666666 7 newWindSum=-1 newOppSum=0 oppSum=? windSum=? windValue=1
634 SkOpSegment::markWinding id=12 (0,0 3,0) t=0.666666667 [11] (2,0) tEnd=1 newWind Sum=-1 newOppSum=0 oppSum=? windSum=? windValue=1
635 SkOpSegment::markAngle last id=12 windSum=-1 small=0
636 SkOpSegment::markWinding id=6 (2,2 0,2) t=0 [0] (2,2) tEnd=0 newWindSum=-1 newOp pSum=-2 oppSum=? windSum=? windValue=1
637 SkOpSegment::markWinding id=6 (2,2 0,2) t=0 [1] (2,2) tEnd=1 newWindSum=-1 newOp pSum=-2 oppSum=? windSum=? windValue=1
638 SkOpSegment::markAngle last id=6 windSum=-1 small=0
639 SkOpSegment::debugShowActiveSpans id=4 (0,0 2,0) t=0.5 (1,0) tEnd=1 other=8 othe rT=0.5 otherIndex=4 windSum=2 windValue=1 oppValue=2
640 SkOpSegment::debugShowActiveSpans id=5 (2,0 2,2) t=0 (2,0) tEnd=1 other=9 otherT =0 otherIndex=0 windSum=? windValue=1 oppValue=1
641 SkOpSegment::debugShowActiveSpans id=6 (2,2 0,2) t=0 (2,2) tEnd=1 other=9 otherT =1 otherIndex=5 windSum=-1 windValue=1 oppValue=1
642 SkOpSegment::debugShowActiveSpans id=12 (0,0 3,0) t=0.666666667 (2,0) tEnd=1 oth er=8 otherT=1 otherIndex=9 windSum=-1 windValue=1 oppValue=0
643 SkOpSegment::debugShowActiveSpans id=13 (3,0 3,3) t=0 (3,0) tEnd=1 other=12 othe rT=1 otherIndex=12 windSum=-1 windValue=1 oppValue=0
644 SkOpSegment::debugShowActiveSpans id=14 (3,3 0,3) t=0 (3,3) tEnd=1 other=13 othe rT=1 otherIndex=1 windSum=-1 windValue=1 oppValue=0
645 SkOpSegment::debugShowActiveSpans id=15 (0,3 0,0) t=0 (0,3) tEnd=0.333333333 oth er=14 otherT=1 otherIndex=1 windSum=-1 windValue=1 oppValue=0
646 SkOpSegment::activeOp op=diff miFrom=0 miTo=0 suFrom=0 suTo=1 result=0
647 SkOpSegment::markDoneBinary id=15 (0,3 0,0) t=0 [0] (0,3) tEnd=0.333333333 newWi ndSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1
648 SkOpSegment::markDoneBinary id=14 (3,3 0,3) t=0 [0] (3,3) tEnd=1 newWindSum=-1 n ewOppSum=0 oppSum=0 windSum=-1 windValue=1
649 SkOpSegment::markDoneBinary id=13 (3,0 3,3) t=0 [0] (3,0) tEnd=1 newWindSum=-1 n ewOppSum=0 oppSum=0 windSum=-1 windValue=1
650 SkOpSegment::markDoneBinary id=12 (0,0 3,0) t=0.666666667 [10] (2,0) tEnd=0.6666 66667 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1
651 SkOpSegment::markDoneBinary id=12 (0,0 3,0) t=0.666666667 [9] (2,0) tEnd=0.66666 6667 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1
652 SkOpSegment::markDoneBinary id=12 (0,0 3,0) t=0.666666667 [8] (2,0) tEnd=0.66666 6667 newWindSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1
653 SkOpSegment::markDoneBinary id=12 (0,0 3,0) t=0.666666667 [11] (2,0) tEnd=1 newW indSum=-1 newOppSum=0 oppSum=0 windSum=-1 windValue=1
654 SkOpSegment::debugShowActiveSpans id=4 (0,0 2,0) t=0.5 (1,0) tEnd=1 other=8 othe rT=0.5 otherIndex=4 windSum=2 windValue=1 oppValue=2
655 SkOpSegment::debugShowActiveSpans id=5 (2,0 2,2) t=0 (2,0) tEnd=1 other=9 otherT =0 otherIndex=0 windSum=? windValue=1 oppValue=1
656 SkOpSegment::debugShowActiveSpans id=6 (2,2 0,2) t=0 (2,2) tEnd=1 other=9 otherT =1 otherIndex=5 windSum=-1 windValue=1 oppValue=1
657 SkOpSegment::activeOp op=diff miFrom=0 miTo=1 suFrom=0 suTo=1 result=0
658 SkOpSegment::markDoneBinary id=4 (0,0 2,0) t=0.5 [6] (1,0) tEnd=0.5 newWindSum=2 newOppSum=-2 oppSum=-2 windSum=2 windValue=1
659 SkOpSegment::markDoneBinary id=4 (0,0 2,0) t=0.5 [5] (1,0) tEnd=0.5 newWindSum=2 newOppSum=-2 oppSum=-2 windSum=2 windValue=1
660 SkOpSegment::markDoneBinary id=4 (0,0 2,0) t=0.5 [4] (1,0) tEnd=0.5 newWindSum=2 newOppSum=-2 oppSum=-2 windSum=2 windValue=1
661 SkOpSegment::markDoneBinary id=4 (0,0 2,0) t=0.5 [7] (1,0) tEnd=1 newWindSum=2 n ewOppSum=-2 oppSum=-2 windSum=2 windValue=1
662 SkOpSegment::markWinding id=5 (2,0 2,2) t=0 [0] (2,0) tEnd=0 newWindSum=2 newOpp Sum=-2 oppSum=? windSum=? windValue=1
663 SkOpSegment::markWinding id=5 (2,0 2,2) t=0 [1] (2,0) tEnd=0 newWindSum=2 newOpp Sum=-2 oppSum=? windSum=? windValue=1
664 SkOpSegment::markWinding id=5 (2,0 2,2) t=0 [2] (2,0) tEnd=0 newWindSum=2 newOpp Sum=-2 oppSum=? windSum=? windValue=1
665 SkOpSegment::markWinding id=5 (2,0 2,2) t=0 [3] (2,0) tEnd=1 newWindSum=2 newOpp Sum=-2 oppSum=? windSum=? windValue=1
666 SkOpSegment::markAngle last id=5 windSum=? small=0
667 SkOpSegment::debugShowActiveSpans id=5 (2,0 2,2) t=0 (2,0) tEnd=1 other=9 otherT =0 otherIndex=0 windSum=2 windValue=1 oppValue=1
668 SkOpSegment::debugShowActiveSpans id=6 (2,2 0,2) t=0 (2,2) tEnd=1 other=9 otherT =1 otherIndex=5 windSum=-1 windValue=1 oppValue=1
669 SkOpSegment::activeOp op=diff miFrom=1 miTo=0 suFrom=1 suTo=1 result=0
670 SkOpSegment::markDoneBinary id=5 (2,0 2,2) t=0 [0] (2,0) tEnd=0 newWindSum=2 new OppSum=-2 oppSum=-2 windSum=2 windValue=1
671 SkOpSegment::markDoneBinary id=5 (2,0 2,2) t=0 [1] (2,0) tEnd=0 newWindSum=2 new OppSum=-2 oppSum=-2 windSum=2 windValue=1
672 SkOpSegment::markDoneBinary id=5 (2,0 2,2) t=0 [2] (2,0) tEnd=0 newWindSum=2 new OppSum=-2 oppSum=-2 windSum=2 windValue=1
673 SkOpSegment::markDoneBinary id=5 (2,0 2,2) t=0 [3] (2,0) tEnd=1 newWindSum=2 new OppSum=-2 oppSum=-2 windSum=2 windValue=1
674 SkOpSegment::debugShowActiveSpans id=6 (2,2 0,2) t=0 (2,2) tEnd=1 other=9 otherT =1 otherIndex=5 windSum=-1 windValue=1 oppValue=1
675 SkOpSegment::activeOp op=diff miFrom=1 miTo=0 suFrom=1 suTo=1 result=0
676 SkOpSegment::markDoneBinary id=6 (2,2 0,2) t=0 [0] (2,2) tEnd=0 newWindSum=-1 ne wOppSum=-2 oppSum=-2 windSum=-1 windValue=1
677 SkOpSegment::markDoneBinary id=6 (2,2 0,2) t=0 [1] (2,2) tEnd=1 newWindSum=-1 ne wOppSum=-2 oppSum=-2 windSum=-1 windValue=1
678 </div>
679
680 </div>
681
682 <script type="text/javascript">
683
684 var testDivs = [
685 rects4,
686 refRects4,
687 ];
688
689 var decimal_places = 3; // make this 3 to show more precision
690
691 var tests = [];
692 var testLines = [];
693 var testTitles = [];
694 var testIndex = 0;
695 var ctx;
696
697 var xmin, xmax, focusXmin, focusXmax;
698 var ymin, ymax, focusYmin, focusYmax;
699 var scale;
700 var mouseX, mouseY;
701 var srcLeft, srcTop;
702 var screenWidth, screenHeight;
703 var drawnPts, drawnLines, drawnQuads, drawnCubics;
704 var curveT = 0;
705
706 var pt_labels = 2;
707 var collect_bounds = false;
708 var control_lines = 0;
709 var curve_t = false;
710 var debug_xy = 1;
711 var focus_enabled = false;
712 var focus_on_selection = false;
713 var step_limit = 0;
714 var draw_active = false;
715 var draw_add = false;
716 var draw_angle = 0;
717 var draw_deriviatives = 0;
718 var draw_hints = false;
719 var draw_hodo = 0;
720 var draw_id = false;
721 var draw_intersection = 0;
722 var draw_intersectT = false;
723 var draw_legend = true;
724 var draw_log = false;
725 var draw_mark = false;
726 var draw_midpoint = false;
727 var draw_op = 0;
728 var draw_sequence = false;
729 var draw_sort = 0;
730 var draw_path = 3;
731 var draw_computed = 0;
732 var retina_scale = !!window.devicePixelRatio;
733
734 var activeCount = 0;
735 var addCount = 0;
736 var angleCount = 0;
737 var opCount = 0;
738 var sectCount = 0;
739 var sortCount = 0;
740 var markCount = 0;
741 var activeMax = 0;
742 var addMax = 0;
743 var angleMax = 0;
744 var sectMax = 0;
745 var sectMax2 = 0;
746 var sortMax = 0;
747 var markMax = 0;
748 var opMax = 0;
749 var stepMax = 0;
750 var lastIndex = 0;
751 var hasPath = false;
752 var hasComputedPath = false;
753
754 var firstActiveSpan = -1;
755 var logStart = -1;
756 var logRange = 0;
757
758 var SPAN_ID = 0;
759 var SPAN_X1 = SPAN_ID + 1;
760 var SPAN_Y1 = SPAN_X1 + 1;
761 var SPAN_X2 = SPAN_Y1 + 1;
762 var SPAN_Y2 = SPAN_X2 + 1;
763 var SPAN_L_T = SPAN_Y2 + 1;
764 var SPAN_L_TX = SPAN_L_T + 1;
765 var SPAN_L_TY = SPAN_L_TX + 1;
766 var SPAN_L_TEND = SPAN_L_TY + 1;
767 var SPAN_L_OTHER = SPAN_L_TEND + 1;
768 var SPAN_L_OTHERT = SPAN_L_OTHER + 1;
769 var SPAN_L_OTHERI = SPAN_L_OTHERT + 1;
770 var SPAN_L_SUM = SPAN_L_OTHERI + 1;
771 var SPAN_L_VAL = SPAN_L_SUM + 1;
772 var SPAN_L_OPP = SPAN_L_VAL + 1;
773
774 var SPAN_X3 = SPAN_Y2 + 1;
775 var SPAN_Y3 = SPAN_X3 + 1;
776 var SPAN_Q_T = SPAN_Y3 + 1;
777 var SPAN_Q_TX = SPAN_Q_T + 1;
778 var SPAN_Q_TY = SPAN_Q_TX + 1;
779 var SPAN_Q_TEND = SPAN_Q_TY + 1;
780 var SPAN_Q_OTHER = SPAN_Q_TEND + 1;
781 var SPAN_Q_OTHERT = SPAN_Q_OTHER + 1;
782 var SPAN_Q_OTHERI = SPAN_Q_OTHERT + 1;
783 var SPAN_Q_SUM = SPAN_Q_OTHERI + 1;
784 var SPAN_Q_VAL = SPAN_Q_SUM + 1;
785 var SPAN_Q_OPP = SPAN_Q_VAL + 1;
786
787 var SPAN_X4 = SPAN_Y3 + 1;
788 var SPAN_Y4 = SPAN_X4 + 1;
789 var SPAN_C_T = SPAN_Y4 + 1;
790 var SPAN_C_TX = SPAN_C_T + 1;
791 var SPAN_C_TY = SPAN_C_TX + 1;
792 var SPAN_C_TEND = SPAN_C_TY + 1;
793 var SPAN_C_OTHER = SPAN_C_TEND + 1;
794 var SPAN_C_OTHERT = SPAN_C_OTHER + 1;
795 var SPAN_C_OTHERI = SPAN_C_OTHERT + 1;
796 var SPAN_C_SUM = SPAN_C_OTHERI + 1;
797 var SPAN_C_VAL = SPAN_C_SUM + 1;
798 var SPAN_C_OPP = SPAN_C_VAL + 1;
799
800 var ACTIVE_LINE_SPAN = 1;
801 var ACTIVE_QUAD_SPAN = ACTIVE_LINE_SPAN + 1;
802 var ACTIVE_CUBIC_SPAN = ACTIVE_QUAD_SPAN + 1;
803
804 var ADD_MOVETO = ACTIVE_CUBIC_SPAN + 1;
805 var ADD_LINETO = ADD_MOVETO + 1;
806 var ADD_QUADTO = ADD_LINETO + 1;
807 var ADD_CUBICTO = ADD_QUADTO + 1;
808 var ADD_CLOSE = ADD_CUBICTO + 1;
809 var ADD_FILL = ADD_CLOSE + 1;
810
811 var PATH_LINE = ADD_FILL + 1;
812 var PATH_QUAD = PATH_LINE + 1;
813 var PATH_CUBIC = PATH_QUAD + 1;
814
815 var INTERSECT_LINE = PATH_CUBIC + 1;
816 var INTERSECT_LINE_2 = INTERSECT_LINE + 1;
817 var INTERSECT_LINE_NO = INTERSECT_LINE_2 + 1;
818 var INTERSECT_QUAD_LINE = INTERSECT_LINE_NO + 1;
819 var INTERSECT_QUAD_LINE_2 = INTERSECT_QUAD_LINE + 1;
820 var INTERSECT_QUAD_LINE_NO = INTERSECT_QUAD_LINE_2 + 1;
821 var INTERSECT_QUAD = INTERSECT_QUAD_LINE_NO + 1;
822 var INTERSECT_QUAD_2 = INTERSECT_QUAD + 1;
823 var INTERSECT_QUAD_NO = INTERSECT_QUAD_2 + 1;
824 var INTERSECT_SELF_CUBIC = INTERSECT_QUAD_NO + 1;
825 var INTERSECT_SELF_CUBIC_NO = INTERSECT_SELF_CUBIC + 1;
826 var INTERSECT_CUBIC_LINE = INTERSECT_SELF_CUBIC_NO + 1;
827 var INTERSECT_CUBIC_LINE_2 = INTERSECT_CUBIC_LINE + 1;
828 var INTERSECT_CUBIC_LINE_3 = INTERSECT_CUBIC_LINE_2 + 1;
829 var INTERSECT_CUBIC_LINE_NO = INTERSECT_CUBIC_LINE_3 + 1;
830 var INTERSECT_CUBIC_QUAD = INTERSECT_CUBIC_LINE_NO + 1;
831 var INTERSECT_CUBIC_QUAD_2 = INTERSECT_CUBIC_QUAD + 1;
832 var INTERSECT_CUBIC_QUAD_3 = INTERSECT_CUBIC_QUAD_2 + 1;
833 var INTERSECT_CUBIC_QUAD_4 = INTERSECT_CUBIC_QUAD_3 + 1;
834 var INTERSECT_CUBIC_QUAD_NO = INTERSECT_CUBIC_QUAD_4 + 1;
835 var INTERSECT_CUBIC = INTERSECT_CUBIC_QUAD_NO + 1;
836 var INTERSECT_CUBIC_2 = INTERSECT_CUBIC + 1;
837 var INTERSECT_CUBIC_3 = INTERSECT_CUBIC_2 + 1;
838 var INTERSECT_CUBIC_4 = INTERSECT_CUBIC_3 + 1;
839 // FIXME: add cubic 5- 9
840 var INTERSECT_CUBIC_NO = INTERSECT_CUBIC_4 + 1;
841
842 var SORT_UNARY = INTERSECT_CUBIC_NO + 1;
843 var SORT_BINARY = SORT_UNARY + 1;
844
845 var OP_DIFFERENCE = SORT_BINARY + 1;
846 var OP_INTERSECT = OP_DIFFERENCE + 1;
847 var OP_UNION = OP_INTERSECT + 1;
848 var OP_XOR = OP_UNION + 1;
849
850 var MARK_LINE = OP_XOR + 1;
851 var MARK_QUAD = MARK_LINE + 1;
852 var MARK_CUBIC = MARK_QUAD + 1;
853 var MARK_DONE_LINE = MARK_CUBIC + 1;
854 var MARK_DONE_QUAD = MARK_DONE_LINE + 1;
855 var MARK_DONE_CUBIC = MARK_DONE_QUAD + 1;
856 var MARK_UNSORTABLE_LINE = MARK_DONE_CUBIC + 1;
857 var MARK_UNSORTABLE_QUAD = MARK_UNSORTABLE_LINE + 1;
858 var MARK_UNSORTABLE_CUBIC = MARK_UNSORTABLE_QUAD + 1;
859 var MARK_SIMPLE_LINE = MARK_UNSORTABLE_CUBIC + 1;
860 var MARK_SIMPLE_QUAD = MARK_SIMPLE_LINE + 1;
861 var MARK_SIMPLE_CUBIC = MARK_SIMPLE_QUAD + 1;
862 var MARK_SIMPLE_DONE_LINE = MARK_SIMPLE_CUBIC + 1;
863 var MARK_SIMPLE_DONE_QUAD = MARK_SIMPLE_DONE_LINE + 1;
864 var MARK_SIMPLE_DONE_CUBIC = MARK_SIMPLE_DONE_QUAD + 1;
865 var MARK_DONE_UNARY_LINE = MARK_SIMPLE_DONE_CUBIC + 1;
866 var MARK_DONE_UNARY_QUAD = MARK_DONE_UNARY_LINE + 1;
867 var MARK_DONE_UNARY_CUBIC = MARK_DONE_UNARY_QUAD + 1;
868 var MARK_ANGLE_LAST = MARK_DONE_UNARY_CUBIC + 1;
869
870 var COMPUTED_SET_1 = MARK_ANGLE_LAST + 1;
871 var COMPUTED_SET_2 = COMPUTED_SET_1 + 1;
872
873 var ANGLE_AFTER = COMPUTED_SET_2;
874 var ANGLE_AFTER2 = ANGLE_AFTER + 1;
875
876 var ACTIVE_OP = ANGLE_AFTER2 + 1;
877
878 var FRAG_TYPE_LAST = ACTIVE_OP;
879
880 var REC_TYPE_UNKNOWN = -1;
881 var REC_TYPE_PATH = 0;
882 var REC_TYPE_SECT = 1;
883 var REC_TYPE_ACTIVE = 2;
884 var REC_TYPE_ADD = 3;
885 var REC_TYPE_SORT = 4;
886 var REC_TYPE_OP = 5;
887 var REC_TYPE_MARK = 6;
888 var REC_TYPE_COMPUTED = 7;
889 var REC_TYPE_COIN = 8;
890 var REC_TYPE_ANGLE = 9;
891 var REC_TYPE_ACTIVE_OP = 10;
892 var REC_TYPE_LAST = REC_TYPE_ACTIVE_OP;
893
894 function strs_to_nums(strs) {
895 var result = [];
896 for (var idx = 1; idx < strs.length; ++idx) {
897 var str = strs[idx];
898 var num = parseFloat(str);
899 if (isNaN(num)) {
900 result.push(str);
901 } else {
902 result.push(num);
903 }
904 }
905 return result;
906 }
907
908 function filter_str_by(id, str, regex, array) {
909 if (regex.test(str)) {
910 var strs = regex.exec(str);
911 var result = strs_to_nums(strs);
912 array.push(id);
913 array.push(result);
914 return true;
915 }
916 return false;
917 }
918
919 function construct_regexp2(pattern) {
920 var escape = pattern.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
921 escape = escape.replace(/UNSORTABLE/g, "\\*\\*\\* UNSORTABLE \\*\\*\\*");
922 escape = escape.replace(/CUBIC_VAL/g, "\\(P_VAL P_VAL P_VAL P_VAL\\)");
923 escape = escape.replace(/QUAD_VAL/g, "\\(P_VAL P_VAL P_VAL\\)");
924 escape = escape.replace(/LINE_VAL/g, "\\(P_VAL P_VAL\\)");
925 escape = escape.replace(/FILL_TYPE/g, "SkPath::k[a-zA-Z]+_FillType");
926 escape = escape.replace(/PT_VAL/g, "\\(P_VAL\\)");
927 escape = escape.replace(/P_VAL/g, "(-?\\d+\\.?\\d*(?:e-?\\d+)?)[Ff]?, ?(-?\\ d+\\.?\\d*(?:e-?\\d+)?)[Ff]?");
928 escape = escape.replace(/T_VAL/g, "(-?\\d+\\.?\\d*(?:e-?\\d+)?)");
929 escape = escape.replace(/PATH/g, "pathB?");
930 escape = escape.replace(/IDX/g, "(\\d+)");
931 escape = escape.replace(/NUM/g, "(-?\\d+)");
932 escape = escape.replace(/OPT/g, "(\\?|-?\\d+)");
933 return new RegExp(escape, 'i');
934 }
935
936 function construct_regexp2c(pattern) {
937 var escape = pattern.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
938 escape = escape.replace(/UNSORTABLE/g, "\\*\\*\\* UNSORTABLE \\*\\*\\*");
939 escape = escape.replace(/CUBIC_VAL/g, "(?:\\$\\d = )?\\{\\{P_VAL\\}, \\{P_VA L\\}, \\{P_VAL\\}, \\{P_VAL\\}\\}");
940 escape = escape.replace(/QUAD_VAL/g, "(?:\\$\\d = )?\\{\\{P_VAL\\}, \\{P_VAL \\}, \\{P_VAL\\}\\}");
941 escape = escape.replace(/LINE_VAL/g, "(?:\\$\\d = )?\\{\\{P_VAL\\}, \\{P_VAL \\}\\}");
942 escape = escape.replace(/FILL_TYPE/g, "SkPath::k[a-zA-Z]+_FillType");
943 escape = escape.replace(/PT_VAL/g, "\\{\\{P_VAL\\}\\}");
944 escape = escape.replace(/P_VAL/g, "(?:f?[xX] = )?(-?\\d+\\.?\\d*(?:e-?\\d+)? )[Ff]?,(?: f?[yY] = )?(-?\\d+\\.?\\d*(?:e-?\\d+)?)[Ff]?");
945 escape = escape.replace(/T_VAL/g, "(-?\\d+\\.?\\d*(?:e-?\\d+)?)");
946 escape = escape.replace(/OPER/g, "[a-z]+");
947 escape = escape.replace(/PATH/g, "pathB?");
948 escape = escape.replace(/T_F/g, "([TF])");
949 escape = escape.replace(/IDX/g, "(\\d+)");
950 escape = escape.replace(/NUM/g, "(-?\\d+)");
951 escape = escape.replace(/OPT/g, "(\\?|-?\\d+)");
952 return new RegExp(escape, 'i');
953 }
954
955 function match_regexp(str, lineNo, array, id, pattern) {
956 var regex = construct_regexp2(pattern);
957 if (filter_str_by(id, str, regex, array)) {
958 return true;
959 }
960 regex = construct_regexp2c(pattern);
961 return filter_str_by(id, str, regex, array);
962 }
963
964 function endsWith(str, suffix) {
965 return str.indexOf(suffix, str.length - suffix.length) !== -1;
966 }
967
968 function parse_all(test) {
969 var lines = test.match(/[^\r\n]+/g);
970 var records = []; // a rec can be the original paths, a set of intersections , a set of active spans, a sort, or a path add
971 var record = [];
972 var recType = REC_TYPE_UNKNOWN;
973 var lastLineNo;
974 var moveX, moveY;
975 for (var lineNo = 0; lineNo < lines.length; ++lineNo) {
976 var line = lines[lineNo];
977 if (line.length == 0) {
978 continue;
979 }
980 var opStart = "SkOpSegment::";
981 if (line.lastIndexOf(opStart, 0) === 0) {
982 line = line.substr(opStart.length);
983 }
984 var angleStart = "SkOpAngle::";
985 if (line.lastIndexOf(angleStart, 0) === 0) {
986 line = line.substr(angleStart.length);
987 }
988 var type = line.lastIndexOf("debugShowActiveSpans", 0) === 0 ? REC_TYPE_ ACTIVE
989 : line.lastIndexOf("debugShowTs", 0) === 0 ? REC_TYPE_COIN
990 : line.lastIndexOf("debugShow", 0) === 0 ? REC_TYPE_SECT
991 : line.lastIndexOf("activeOp", 0) === 0 ? REC_TYPE_ACTIVE_OP
992 : line.lastIndexOf("computed", 0) === 0 ? REC_TYPE_COMPUTED
993 : line.lastIndexOf("debugOne", 0) === 0 ? REC_TYPE_SORT
994 : line.lastIndexOf("dumpOne", 0) === 0 ? REC_TYPE_SORT
995 : line.lastIndexOf("pathB.", 0) === 0 ? REC_TYPE_ADD
996 : line.lastIndexOf("path.", 0) === 0 ? REC_TYPE_ADD
997 : line.lastIndexOf("after", 0) === 0 ? REC_TYPE_ANGLE
998 : line.lastIndexOf("mark", 0) === 0 ? REC_TYPE_MARK
999 : line.lastIndexOf(" {{", 0) === 0 ? REC_TYPE_COMPUTED
1000 : line.lastIndexOf("{{", 0) === 0 ? REC_TYPE_PATH
1001 : line.lastIndexOf("op", 0) === 0 ? REC_TYPE_OP
1002 : line.lastIndexOf("$", 0) === 0 ? REC_TYPE_PATH
1003 : REC_TYPE_UNKNOWN;
1004 if (recType != type || recType == REC_TYPE_ADD || recType == REC_TYPE_SE CT
1005 || recType == REC_TYPE_ACTIVE_OP || recType == REC_TYPE_ANGLE) {
1006 if (recType != REC_TYPE_UNKNOWN) {
1007 records.push(recType);
1008 records.push(lastLineNo);
1009 records.push(record);
1010 }
1011 record = [];
1012 recType = type;
1013 lastLineNo = lineNo;
1014 }
1015 var found = false;
1016 switch (recType) {
1017 case REC_TYPE_ACTIVE:
1018 found = match_regexp(line, lineNo, record, ACTIVE_LINE_SPAN, "de bugShowActiveSpans" +
1019 " id=IDX LINE_VAL t=T_VAL PT_VAL tEnd=T_VAL other=IDX otherT=T_VAL otherIndex=ID X windSum=OPT windValue=IDX oppValue=NUM"
1020 ) || match_regexp(line, lineNo, record, ACTIVE_QUAD_SPAN, "debug ShowActiveSpans" +
1021 " id=IDX QUAD_VAL t=T_VAL PT_VAL tEnd=T_VAL other=IDX otherT=T_VAL otherIndex=ID X windSum=OPT windValue=IDX oppValue=NUM"
1022 ) || match_regexp(line, lineNo, record, ACTIVE_CUBIC_SPAN, "debu gShowActiveSpans" +
1023 " id=IDX CUBIC_VAL t=T_VAL PT_VAL tEnd=T_VAL other=IDX otherT=T_VAL otherIndex=I DX windSum=OPT windValue=IDX oppValue=NUM"
1024 );
1025 break;
1026 case REC_TYPE_ACTIVE_OP:
1027 found = match_regexp(line, lineNo, record, ACTIVE_OP, "activeOp" +
1028 " id=IDX t=T_VAL tEnd=T_VAL op=OPER miFrom=NUM miTo=NUM suFrom=NUM suTo=NUM resu lt=IDX"
1029 );
1030 break;
1031 case REC_TYPE_ADD:
1032 if (match_regexp(line, lineNo, record, ADD_MOVETO, "PATH.moveTo( P_VAL);")) {
1033 moveX = record[1][0];
1034 moveY = record[1][1];
1035 found = true;
1036 } else if (match_regexp(line, lineNo, record, ADD_LINETO, "PATH. lineTo(P_VAL);")) {
1037 record[1].unshift(moveY);
1038 record[1].unshift(moveX);
1039 moveX = record[1][2];
1040 moveY = record[1][3];
1041 found = true;
1042 } else if (match_regexp(line, lineNo, record, ADD_QUADTO, "PATH. quadTo(P_VAL, P_VAL);")) {
1043 record[1].unshift(moveY);
1044 record[1].unshift(moveX);
1045 moveX = record[1][4];
1046 moveY = record[1][5];
1047 found = true;
1048 } else if (match_regexp(line, lineNo, record, ADD_CUBICTO, "PATH .cubicTo(P_VAL, P_VAL, P_VAL);")) {
1049 record[1].unshift(moveY);
1050 record[1].unshift(moveX);
1051 moveX = record[1][6];
1052 moveY = record[1][7];
1053 found = true;
1054 } else if (match_regexp(line, lineNo, record, ADD_FILL, "PATH.se tFillType(FILL_TYPE);")) {
1055 found = true;
1056 } else {
1057 found = match_regexp(line, lineNo, record, ADD_CLOSE, "PATH. close();");
1058 }
1059 break;
1060 case REC_TYPE_ANGLE:
1061 found = match_regexp(line, lineNo, record, ANGLE_AFTER, "after " +
1062 "id=IDX IDX/IDX tStart=T_VAL tEnd=T_VAL < id=IDX IDX/IDX tStart=T_VAL tEnd=T_VAL < id=IDX IDX/IDX tStart=T_VAL tEnd=T_VAL T_F IDX");
1063 if (found) {
1064 break;
1065 }
1066 found = match_regexp(line, lineNo, record, ANGLE_AFTER2, "after " +
1067 "[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");
1068 break;
1069 case REC_TYPE_COIN:
1070 found = true;
1071 break;
1072 case REC_TYPE_COMPUTED:
1073 found = line == "computed quadratics given"
1074 || match_regexp(line, lineNo, record, COMPUTED_SET_1, "compute d quadratics set 1"
1075 ) || match_regexp(line, lineNo, record, COMPUTED_SET_2, "compute d quadratics set 2"
1076 ) || match_regexp(line, lineNo, record, PATH_QUAD, " QUAD_VAL,"
1077 ) || match_regexp(line, lineNo, record, PATH_CUBIC, " CUBIC_VAL ,"
1078 );
1079 break;
1080 case REC_TYPE_PATH:
1081 found = match_regexp(line, lineNo, record, PATH_LINE, "LINE_VAL"
1082 ) || match_regexp(line, lineNo, record, PATH_QUAD, "QUAD_VAL"
1083 ) || match_regexp(line, lineNo, record, PATH_CUBIC, "CUBIC_VAL"
1084 );
1085 break;
1086 case REC_TYPE_SECT:
1087 found = match_regexp(line, lineNo, record, INTERSECT_LINE, "debu gShowLineIntersection" +
1088 " wtTs[0]=T_VAL LINE_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL"
1089 ) || match_regexp(line, lineNo, record, INTERSECT_LINE_2, "debug ShowLineIntersection" +
1090 " wtTs[0]=T_VAL LINE_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL wnTs [1]=T_VAL"
1091 ) || match_regexp(line, lineNo, record, INTERSECT_LINE_NO, "debu gShowLineIntersection" +
1092 " no intersect LINE_VAL LINE_VAL"
1093 ) || match_regexp(line, lineNo, record, INTERSECT_QUAD_LINE, "de bugShowQuadLineIntersection" +
1094 " wtTs[0]=T_VAL QUAD_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL"
1095 ) || match_regexp(line, lineNo, record, INTERSECT_QUAD_LINE_2, " debugShowQuadLineIntersection" +
1096 " wtTs[0]=T_VAL QUAD_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL wnTs [1]=T_VAL"
1097 ) || match_regexp(line, lineNo, record, INTERSECT_QUAD_LINE_NO, "debugShowQuadLineIntersection" +
1098 " no intersect QUAD_VAL LINE_VAL"
1099 ) || match_regexp(line, lineNo, record, INTERSECT_QUAD, "debugSh owQuadIntersection" +
1100 " wtTs[0]=T_VAL QUAD_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL"
1101 ) || match_regexp(line, lineNo, record, INTERSECT_QUAD_2, "debug ShowQuadIntersection" +
1102 " wtTs[0]=T_VAL QUAD_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL wnTs [1]=T_VAL"
1103 ) || match_regexp(line, lineNo, record, INTERSECT_QUAD_NO, "debu gShowQuadIntersection" +
1104 " no intersect QUAD_VAL QUAD_VAL"
1105 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_LINE, "d ebugShowCubicLineIntersection" +
1106 " wtTs[0]=T_VAL CUBIC_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL"
1107 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_LINE_2, "debugShowCubicLineIntersection" +
1108 " wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL LINE_VAL wnT s[1]=T_VAL"
1109 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_LINE_3, "debugShowCubicLineIntersection" +
1110 " 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"
1111 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_LINE_NO, "debugShowCubicLineIntersection" +
1112 " no intersect CUBIC_VAL LINE_VAL"
1113 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD, "d ebugShowCubicQuadIntersection" +
1114 " wtTs[0]=T_VAL CUBIC_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL"
1115 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD_2, "debugShowCubicQuadIntersection" +
1116 " wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL QUAD_VAL wnT s[1]=T_VAL"
1117 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD_3, "debugShowCubicQuadIntersection" +
1118 " 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"
1119 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD_4, "debugShowCubicQuadIntersection" +
1120 " wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wtTs[2]=T_VAL wtTs[3]=T_VA L PT_VAL wnTs[0]=T_VAL QUAD_VAL wnTs[1]=T_VAL wnTs[2]=T_VAL wnTs[3]=T_VAL"
1121 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_QUAD_NO, "debugShowCubicQuadIntersection" +
1122 " no intersect CUBIC_VAL QUAD_VAL"
1123 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC, "debugS howCubicIntersection" +
1124 " wtTs[0]=T_VAL CUBIC_VAL PT_VAL wnTs[0]=T_VAL CUBIC_VAL"
1125 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_2, "debu gShowCubicIntersection" +
1126 " wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL PT_VAL wnTs[0]=T_VAL CUBIC_VAL wn Ts[1]=T_VAL"
1127 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_3, "debu gShowCubicIntersection" +
1128 " 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"
1129 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_4, "debu gShowCubicIntersection" +
1130 " 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_VA L"
1131 ) || match_regexp(line, lineNo, record, INTERSECT_CUBIC_NO, "deb ugShowCubicIntersection" +
1132 " no intersect CUBIC_VAL CUBIC_VAL"
1133 ) || match_regexp(line, lineNo, record, INTERSECT_SELF_CUBIC, "d ebugShowCubicIntersection" +
1134 " wtTs[0]=T_VAL CUBIC_VAL PT_VAL wtTs[1]=T_VAL"
1135 ) || match_regexp(line, lineNo, record, INTERSECT_SELF_CUBIC_NO, "debugShowCubicIntersection" +
1136 " no self intersect CUBIC_VAL"
1137 );
1138 break;
1139 case REC_TYPE_SORT:
1140 var hasDone = / done/.test(line);
1141 var hasUnorderable = / unorderable/.test(line);
1142 var hasSmall = / small/.test(line);
1143 var hasTiny = / tiny/.test(line);
1144 var hasOperand = / operand/.test(line);
1145 var hasStop = / stop/.test(line);
1146 line.replace(/[ a-z]+$/, "");
1147 found = match_regexp(line, lineNo, record, SORT_UNARY, "debugOne " +
1148 " [IDX/IDX] next=IDX/IDX sect=IDX/IDX s=T_VAL [IDX] e=T_VAL [IDX] sgn=NUM windV al=IDX windSum=OPT"
1149 ) || match_regexp(line, lineNo, record, SORT_BINARY, "debugOne" +
1150 " [IDX/IDX] next=IDX/IDX sect=IDX/IDX s=T_VAL [IDX] e=T_VAL [IDX] sgn=NUM windV al=IDX windSum=OPT oppVal=IDX oppSum=OPT"
1151 ) || match_regexp(line, lineNo, record, SORT_UNARY, "dumpOne" +
1152 " [IDX/IDX] next=IDX/IDX sect=NUM/NUM s=T_VAL [IDX] e=T_VAL [IDX] sgn=NUM windV al=IDX windSum=OPT"
1153 ) || match_regexp(line, lineNo, record, SORT_BINARY, "dumpOne" +
1154 " [IDX/IDX] next=IDX/IDX sect=NUM/NUM s=T_VAL [IDX] e=T_VAL [IDX] sgn=NUM windV al=IDX windSum=OPT oppVal=IDX oppSum=OPT"
1155 );
1156 if (found) {
1157 record[1].push(hasDone);
1158 record[1].push(hasUnorderable);
1159 record[1].push(hasSmall);
1160 record[1].push(hasTiny);
1161 record[1].push(hasOperand);
1162 record[1].push(hasStop);
1163 }
1164 break;
1165 case REC_TYPE_MARK:
1166 found = match_regexp(line, lineNo, record, MARK_LINE, "markWindi ng" +
1167 " id=IDX LINE_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM newOppSum=NUM o ppSum=OPT windSum=OPT windValue=IDX"
1168 ) || match_regexp(line, lineNo, record, MARK_QUAD, "markWinding" +
1169 " id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM newOppSum=NUM o ppSum=OPT windSum=OPT windValue=IDX"
1170 ) || match_regexp(line, lineNo, record, MARK_CUBIC, "markWinding " +
1171 " id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM newOppSum=NUM oppSum=OPT windSum=OPT windValue=IDX"
1172 ) || match_regexp(line, lineNo, record, MARK_DONE_LINE, "markDon eBinary" +
1173 " id=IDX LINE_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM newOppSum=NUM o ppSum=OPT windSum=OPT windValue=IDX"
1174 ) || match_regexp(line, lineNo, record, MARK_DONE_QUAD, "markDon eBinary" +
1175 " id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM newOppSum=NUM o ppSum=OPT windSum=OPT windValue=IDX"
1176 ) || match_regexp(line, lineNo, record, MARK_DONE_CUBIC, "markDo neBinary" +
1177 " id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM newOppSum=NUM oppSum=OPT windSum=OPT windValue=IDX"
1178 ) || match_regexp(line, lineNo, record, MARK_UNSORTABLE_LINE, "m arkUnsortable" +
1179 " id=IDX LINE_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT win dValue=IDX"
1180 ) || match_regexp(line, lineNo, record, MARK_UNSORTABLE_QUAD, "m arkUnsortable" +
1181 " id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT win dValue=IDX"
1182 ) || match_regexp(line, lineNo, record, MARK_UNSORTABLE_CUBIC, " markUnsortable" +
1183 " id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT wi ndValue=IDX"
1184 ) || match_regexp(line, lineNo, record, MARK_SIMPLE_LINE, "markW inding" +
1185 " id=IDX LINE_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT win dValue=IDX"
1186 ) || match_regexp(line, lineNo, record, MARK_SIMPLE_QUAD, "markW inding" +
1187 " id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT win dValue=IDX"
1188 ) || match_regexp(line, lineNo, record, MARK_SIMPLE_CUBIC, "mark Winding" +
1189 " id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT wi ndValue=IDX"
1190 ) || match_regexp(line, lineNo, record, MARK_SIMPLE_DONE_LINE, " markDone" +
1191 " id=IDX LINE_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT win dValue=IDX"
1192 ) || match_regexp(line, lineNo, record, MARK_SIMPLE_DONE_QUAD, " markDone" +
1193 " id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT win dValue=IDX"
1194 ) || match_regexp(line, lineNo, record, MARK_SIMPLE_DONE_CUBIC, "markDone" +
1195 " id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT wi ndValue=IDX"
1196 ) || match_regexp(line, lineNo, record, MARK_DONE_UNARY_LINE, "m arkDoneUnary" +
1197 " id=IDX LINE_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT win dValue=IDX"
1198 ) || match_regexp(line, lineNo, record, MARK_DONE_UNARY_QUAD, "m arkDoneUnary" +
1199 " id=IDX QUAD_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT win dValue=IDX"
1200 ) || match_regexp(line, lineNo, record, MARK_DONE_UNARY_CUBIC, " markDoneUnary" +
1201 " id=IDX CUBIC_VAL t=T_VAL [IDX] PT_VAL tEnd=T_VAL newWindSum=NUM windSum=OPT wi ndValue=IDX"
1202 ) || match_regexp(line, lineNo, record, MARK_ANGLE_LAST, "markAn gle" +
1203 " last id=IDX windSum=OPT small=IDX");
1204 break;
1205 case REC_TYPE_OP:
1206 if (line.lastIndexOf("oppSign oppSign=", 0) === 0
1207 || line.lastIndexOf("operator<", 0) === 0) {
1208 found = true;
1209 break;
1210 }
1211 found = match_regexp(line, lineNo, record, OP_DIFFERENCE, "op di fference"
1212 ) || match_regexp(line, lineNo, record, OP_INTERSECT, "op inters ect"
1213 ) || match_regexp(line, lineNo, record, OP_UNION, "op union"
1214 ) || match_regexp(line, lineNo, record, OP_XOR, "op xor"
1215 );
1216 break;
1217 case REC_TYPE_UNKNOWN:
1218 found = true;
1219 break;
1220 }
1221 if (!found) {
1222 console.log(line + " [" + lineNo + "] of type " + type + " not found ");
1223 }
1224 }
1225 if (recType != REC_TYPE_UNKNOWN) {
1226 records.push(recType);
1227 records.push(lastLineNo);
1228 records.push(record);
1229 }
1230 if (records.length >= 1) {
1231 tests[testIndex] = records;
1232 testLines[testIndex] = lines;
1233 }
1234 }
1235
1236 function init(test) {
1237 var canvas = document.getElementById('canvas');
1238 if (!canvas.getContext) return;
1239 ctx = canvas.getContext('2d');
1240 var resScale = retina_scale && window.devicePixelRatio ? window.devicePixelR atio : 1;
1241 var unscaledWidth = window.innerWidth - 20;
1242 var unscaledHeight = window.innerHeight - 20;
1243 screenWidth = unscaledWidth;
1244 screenHeight = unscaledHeight;
1245 canvas.width = unscaledWidth * resScale;
1246 canvas.height = unscaledHeight * resScale;
1247 canvas.style.width = unscaledWidth + 'px';
1248 canvas.style.height = unscaledHeight + 'px';
1249 if (resScale != 1) {
1250 ctx.scale(resScale, resScale);
1251 }
1252 xmin = Infinity;
1253 xmax = -Infinity;
1254 ymin = Infinity;
1255 ymax = -Infinity;
1256 hasPath = hasComputedPath = false;
1257 firstActiveSpan = -1;
1258 for (var tIndex = 0; tIndex < test.length; tIndex += 3) {
1259 var recType = test[tIndex];
1260 if (!typeof recType == 'number' || recType < REC_TYPE_UNKNOWN || recType > REC_TYPE_LAST) {
1261 console.log("unknown rec type: " + recType);
1262 throw "stop execution";
1263 }
1264 var records = test[tIndex + 2];
1265 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2 ) {
1266 var fragType = records[recordIndex];
1267 if (!typeof fragType == 'number' || fragType < 1 || fragType > FRAG_ TYPE_LAST) {
1268 console.log("unknown in range frag type: " + fragType);
1269 throw "stop execution";
1270 }
1271 var frags = records[recordIndex + 1];
1272 var first = 0;
1273 var last = -1;
1274 var first2 = 0;
1275 var last2 = 0;
1276 switch (recType) {
1277 case REC_TYPE_COMPUTED:
1278 if (fragType == COMPUTED_SET_1 || fragType == COMPUTED_SET_2 ) {
1279 break;
1280 }
1281 hasComputedPath = true;
1282 case REC_TYPE_PATH:
1283 switch (fragType) {
1284 case PATH_LINE:
1285 last = 4;
1286 break;
1287 case PATH_QUAD:
1288 last = 6;
1289 break;
1290 case PATH_CUBIC:
1291 last = 8;
1292 break;
1293 default:
1294 console.log("unknown " + (recType == REC_TYPE_PATH ? "REC_TYPE_PATH"
1295 : "REC_TYPE_COMPUTED") + " frag type:" + fra gType);
1296 throw "stop execution";
1297 }
1298 if (recType == REC_TYPE_PATH) {
1299 hasPath = true;
1300 }
1301 break;
1302 case REC_TYPE_ACTIVE:
1303 if (firstActiveSpan < 0) {
1304 firstActiveSpan = tIndex;
1305 }
1306 first = 1;
1307 switch (fragType) {
1308 case ACTIVE_LINE_SPAN:
1309 last = 5;
1310 break;
1311 case ACTIVE_QUAD_SPAN:
1312 last = 7;
1313 break;
1314 case ACTIVE_CUBIC_SPAN:
1315 last = 9;
1316 break;
1317 default:
1318 console.log("unknown REC_TYPE_ACTIVE frag type: " + fragType);
1319 throw "stop execution";
1320 }
1321 break;
1322 case REC_TYPE_ADD:
1323 switch (fragType) {
1324 case ADD_MOVETO:
1325 break;
1326 case ADD_LINETO:
1327 last = 4;
1328 break;
1329 case ADD_QUADTO:
1330 last = 6;
1331 break;
1332 case ADD_CUBICTO:
1333 last = 8;
1334 break;
1335 case ADD_CLOSE:
1336 case ADD_FILL:
1337 break;
1338 default:
1339 console.log("unknown REC_TYPE_ADD frag type: " + fra gType);
1340 throw "stop execution";
1341 }
1342 break;
1343 case REC_TYPE_SECT:
1344 switch (fragType) {
1345 case INTERSECT_LINE:
1346 first = 1; last = 5; first2 = 8; last2 = 12;
1347 break;
1348 case INTERSECT_LINE_2:
1349 first = 1; last = 5; first2 = 11; last2 = 15;
1350 break;
1351 case INTERSECT_LINE_NO:
1352 first = 0; last = 4; first2 = 4; last2 = 8;
1353 break;
1354 case INTERSECT_QUAD_LINE:
1355 first = 1; last = 7; first2 = 10; last2 = 14;
1356 break;
1357 case INTERSECT_QUAD_LINE_2:
1358 first = 1; last = 7; first2 = 13; last2 = 17;
1359 break;
1360 case INTERSECT_QUAD_LINE_NO:
1361 first = 0; last = 6; first2 = 6; last2 = 10;
1362 break;
1363 case INTERSECT_QUAD:
1364 first = 1; last = 7; first2 = 10; last2 = 16;
1365 break;
1366 case INTERSECT_QUAD_2:
1367 first = 1; last = 7; first2 = 13; last2 = 19;
1368 break;
1369 case INTERSECT_QUAD_NO:
1370 first = 0; last = 6; first2 = 6; last2 = 12;
1371 break;
1372 case INTERSECT_SELF_CUBIC:
1373 first = 1; last = 9;
1374 break;
1375 case INTERSECT_SELF_CUBIC_NO:
1376 first = 0; last = 8;
1377 break;
1378 case INTERSECT_CUBIC_LINE:
1379 first = 1; last = 9; first2 = 12; last2 = 16;
1380 break;
1381 case INTERSECT_CUBIC_LINE_2:
1382 first = 1; last = 9; first2 = 15; last2 = 19;
1383 break;
1384 case INTERSECT_CUBIC_LINE_3:
1385 first = 1; last = 9; first2 = 18; last2 = 22;
1386 break;
1387 case INTERSECT_CUBIC_LINE_NO:
1388 first = 0; last = 8; first2 = 8; last2 = 12;
1389 break;
1390 case INTERSECT_CUBIC_QUAD:
1391 first = 1; last = 9; first2 = 12; last2 = 18;
1392 break;
1393 case INTERSECT_CUBIC_QUAD_2:
1394 first = 1; last = 9; first2 = 15; last2 = 21;
1395 break;
1396 case INTERSECT_CUBIC_QUAD_3:
1397 first = 1; last = 9; first2 = 18; last2 = 24;
1398 break;
1399 case INTERSECT_CUBIC_QUAD_4:
1400 first = 1; last = 9; first2 = 21; last2 = 27;
1401 break;
1402 case INTERSECT_CUBIC_QUAD_NO:
1403 first = 0; last = 8; first2 = 8; last2 = 14;
1404 break;
1405 case INTERSECT_CUBIC:
1406 first = 1; last = 9; first2 = 12; last2 = 20;
1407 break;
1408 case INTERSECT_CUBIC_2:
1409 first = 1; last = 9; first2 = 15; last2 = 23;
1410 break;
1411 case INTERSECT_CUBIC_3:
1412 first = 1; last = 9; first2 = 18; last2 = 26;
1413 break;
1414 case INTERSECT_CUBIC_4:
1415 first = 1; last = 9; first2 = 21; last2 = 29;
1416 break;
1417 case INTERSECT_CUBIC_NO:
1418 first = 0; last = 8; first2 = 8; last2 = 16;
1419 break;
1420 default:
1421 console.log("unknown REC_TYPE_SECT frag type: " + fr agType);
1422 throw "stop execution";
1423 }
1424 break;
1425 default:
1426 continue;
1427 }
1428 for (var idx = first; idx < last; idx += 2) {
1429 xmin = Math.min(xmin, frags[idx]);
1430 xmax = Math.max(xmax, frags[idx]);
1431 ymin = Math.min(ymin, frags[idx + 1]);
1432 ymax = Math.max(ymax, frags[idx + 1]);
1433 }
1434 for (var idx = first2; idx < last2; idx += 2) {
1435 xmin = Math.min(xmin, frags[idx]);
1436 xmax = Math.max(xmax, frags[idx]);
1437 ymin = Math.min(ymin, frags[idx + 1]);
1438 ymax = Math.max(ymax, frags[idx + 1]);
1439 }
1440 }
1441 }
1442 var angleBounds = [Infinity, Infinity, -Infinity, -Infinity];
1443 for (var tIndex = 0; tIndex < test.length; tIndex += 3) {
1444 var recType = test[tIndex];
1445 var records = test[tIndex + 2];
1446 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2 ) {
1447 var fragType = records[recordIndex];
1448 var frags = records[recordIndex + 1];
1449 switch (recType) {
1450 case REC_TYPE_ACTIVE_OP:
1451 if (!draw_op) {
1452 break;
1453 }
1454 {
1455 var curve = curvePartialByID(test, frags[0], frags[1], f rags[2]);
1456 curve_extremes(curve, angleBounds);
1457 }
1458 break;
1459 case REC_TYPE_ANGLE:
1460 if (!draw_angle) {
1461 break;
1462 }
1463 if (fragType == ANGLE_AFTER) {
1464 var curve = curvePartialByID(test, frags[0], frags[3], f rags[4]);
1465 curve_extremes(curve, angleBounds);
1466 curve = curvePartialByID(test, frags[5], frags[8], frags [9]);
1467 curve_extremes(curve, angleBounds);
1468 curve = curvePartialByID(test, frags[10], frags[13], fra gs[14]);
1469 } else if (fragType == ANGLE_AFTER2) {
1470 var curve = curvePartialByID(test, frags[0], frags[4], f rags[5]);
1471 curve_extremes(curve, angleBounds);
1472 curve = curvePartialByID(test, frags[6], frags[10], frag s[11]);
1473 curve_extremes(curve, angleBounds);
1474 curve = curvePartialByID(test, frags[12], frags[16], fra gs[17]);
1475 }
1476 break;
1477 case REC_TYPE_SORT:
1478 if (!draw_sort) {
1479 break;
1480 }
1481 if (fragType == SORT_UNARY || fragType == SORT_BINARY) {
1482 var curve = curvePartialByID(test, frags[0], frags[6], f rags[8]);
1483 curve_extremes(curve, angleBounds);
1484 }
1485 break;
1486 }
1487 }
1488 }
1489 xmin = Math.min(xmin, angleBounds[0]);
1490 ymin = Math.min(ymin, angleBounds[1]);
1491 xmax = Math.max(xmax, angleBounds[2]);
1492 ymax = Math.max(ymax, angleBounds[3]);
1493 setScale(xmin, xmax, ymin, ymax);
1494 if (hasPath == false && hasComputedPath == true && !draw_computed) {
1495 draw_computed = 3; // show both quadratics and cubics
1496 }
1497 if (hasPath == true && hasComputedPath == false && draw_computed) {
1498 draw_computed = 0;
1499 }
1500 }
1501
1502 function curveByID(test, id) {
1503 var tIndex = firstActiveSpan;
1504 if (tIndex < 0) {
1505 return [];
1506 }
1507 while (tIndex < test.length) {
1508 var recType = test[tIndex];
1509 if (recType != REC_TYPE_ACTIVE) {
1510 return [];
1511 }
1512 var records = test[tIndex + 2];
1513 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2 ) {
1514 var fragType = records[recordIndex];
1515 var frags = records[recordIndex + 1];
1516 if (frags[0] == id) {
1517 switch (fragType) {
1518 case ACTIVE_LINE_SPAN:
1519 return [frags[1], frags[2], frags[3], frags[4]];
1520 case ACTIVE_QUAD_SPAN:
1521 return [frags[1], frags[2], frags[3], frags[4],
1522 frags[5], frags[6]];
1523 case ACTIVE_CUBIC_SPAN:
1524 return [frags[1], frags[2], frags[3], frags[4],
1525 frags[5], frags[6], frags[7], frags[8]];
1526 }
1527 }
1528 }
1529 tIndex += 3;
1530 }
1531 return [];
1532 }
1533
1534 function curvePartialByID(test, id, t0, t1) {
1535 var tIndex = firstActiveSpan;
1536 if (tIndex < 0) {
1537 return [];
1538 }
1539 while (tIndex < test.length) {
1540 var recType = test[tIndex];
1541 if (recType != REC_TYPE_ACTIVE) {
1542 return [];
1543 }
1544 var records = test[tIndex + 2];
1545 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2 ) {
1546 var fragType = records[recordIndex];
1547 var frags = records[recordIndex + 1];
1548 if (frags[0] == id) {
1549 switch (fragType) {
1550 case ACTIVE_LINE_SPAN:
1551 return linePartial(frags[1], frags[2], frags[3], frags[4 ], t0, t1);
1552 case ACTIVE_QUAD_SPAN:
1553 return quadPartial(frags[1], frags[2], frags[3], frags[4 ],
1554 frags[5], frags[6], t0, t1);
1555 case ACTIVE_CUBIC_SPAN:
1556 return cubicPartial(frags[1], frags[2], frags[3], frags[ 4],
1557 frags[5], frags[6], frags[7], frags[8], t0, t1);
1558 }
1559 }
1560 }
1561 tIndex += 3;
1562 }
1563 return [];
1564 }
1565
1566 function idByCurve(test, frag, type) {
1567 var tIndex = firstActiveSpan;
1568 if (tIndex < 0) {
1569 return -1;
1570 }
1571 while (tIndex < test.length) {
1572 var recType = test[tIndex];
1573 if (recType != REC_TYPE_ACTIVE) {
1574 return -1;
1575 }
1576 var records = test[tIndex + 2];
1577 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2 ) {
1578 var fragType = records[recordIndex];
1579 var frags = records[recordIndex + 1];
1580 switch (fragType) {
1581 case ACTIVE_LINE_SPAN:
1582 if (type != PATH_LINE) {
1583 continue;
1584 }
1585 if (frag[0] != frags[1] || frag[1] != frags[2]
1586 || frag[2] != frags[3] || frag[3] != frags[4]) {
1587 continue;
1588 }
1589 return frags[0];
1590 case ACTIVE_QUAD_SPAN:
1591 if (type != PATH_QUAD) {
1592 continue;
1593 }
1594 if (frag[0] != frags[1] || frag[1] != frags[2]
1595 || frag[2] != frags[3] || frag[3] != frags[4]
1596 || frag[4] != frags[5] || frag[5] != frags[6]) {
1597 continue;
1598 }
1599 return frags[0];
1600 case ACTIVE_CUBIC_SPAN:
1601 if (type != PATH_CUBIC) {
1602 continue;
1603 }
1604 if (frag[0] != frags[1] || frag[1] != frags[2]
1605 || frag[2] != frags[3] || frag[3] != frags[4]
1606 || frag[4] != frags[5] || frag[5] != frags[6]
1607 || frag[6] != frags[7] || frag[7] != frags[8]) {
1608 continue;
1609 }
1610 return frags[0];
1611 }
1612 }
1613 ++tIndex;
1614 }
1615 return -1;
1616 }
1617
1618 function curve_extremes(curve, bounds) {
1619 for (var index = 0; index < curve.length; index += 2) {
1620 var x = curve[index];
1621 var y = curve[index + 1];
1622 bounds[0] = Math.min(bounds[0], x);
1623 bounds[1] = Math.min(bounds[1], y);
1624 bounds[2] = Math.max(bounds[2], x);
1625 bounds[3] = Math.max(bounds[3], y);
1626 }
1627 }
1628
1629 function setScale(x0, x1, y0, y1) {
1630 var srcWidth = x1 - x0;
1631 var srcHeight = y1 - y0;
1632 var usableWidth = screenWidth;
1633 var xDigits = Math.ceil(Math.log(Math.abs(xmax)) / Math.log(10));
1634 var yDigits = Math.ceil(Math.log(Math.abs(ymax)) / Math.log(10));
1635 usableWidth -= (xDigits + yDigits) * 10;
1636 usableWidth -= decimal_places * 10;
1637 if (draw_legend) {
1638 usableWidth -= 40;
1639 }
1640 var hscale = usableWidth / srcWidth;
1641 var vscale = screenHeight / srcHeight;
1642 scale = Math.min(hscale, vscale);
1643 var invScale = 1 / scale;
1644 var sxmin = x0 - invScale * 5;
1645 var symin = y0 - invScale * 10;
1646 var sxmax = x1 + invScale * (6 * decimal_places + 10);
1647 var symax = y1 + invScale * 10;
1648 srcWidth = sxmax - sxmin;
1649 srcHeight = symax - symin;
1650 hscale = usableWidth / srcWidth;
1651 vscale = screenHeight / srcHeight;
1652 scale = Math.min(hscale, vscale);
1653 srcLeft = sxmin;
1654 srcTop = symin;
1655 }
1656
1657 function drawArc(curve, op, from, to) {
1658 var type = PATH_LINE + (curve.length / 2 - 2);
1659 var pt = pointAtT(curve, type, op ? 0.4 : 0.6);
1660 var dy = pt.y - curve[1];
1661 var dx = pt.x - curve[0];
1662 var dist = Math.sqrt(dy * dy + dx * dx);
1663 var _dist = dist * scale;
1664 var angle = Math.atan2(dy, dx);
1665 var _px = (curve[0] - srcLeft) * scale;
1666 var _py = (curve[1] - srcTop) * scale;
1667 var divisor = 4;
1668 var endDist;
1669 do {
1670 var ends = [];
1671 for (var index = -1; index <= 1; index += 2) {
1672 var px = Math.cos(index * Math.PI / divisor);
1673 var py = Math.sin(index * Math.PI / divisor);
1674 ends.push(px);
1675 ends.push(py);
1676 }
1677 var endDx = (ends[2] - ends[0]) * scale * dist;
1678 var endDy = (ends[3] - ends[1]) * scale * dist;
1679 endDist = Math.sqrt(endDx * endDx + endDy * endDy);
1680 if (endDist < 100) {
1681 break;
1682 }
1683 divisor *= 2;
1684 } while (true);
1685 if (endDist < 30) {
1686 return;
1687 }
1688 if (op) {
1689 divisor *= 2;
1690 }
1691 ctx.strokeStyle = op ? "rgba(210,0,45, 0.4)" : "rgba(90,90,90, 0.5)";
1692 ctx.beginPath();
1693 ctx.arc(_px, _py, _dist, angle - Math.PI / divisor, angle + Math.PI / diviso r, false);
1694 ctx.stroke();
1695 var saveAlign = ctx.textAlign;
1696 var saveStyle = ctx.fillStyle;
1697 var saveFont = ctx.font;
1698 ctx.textAlign = "center";
1699 ctx.fillStyle = "black";
1700 ctx.font = "normal 24px Arial";
1701 divisor *= 0.8;
1702 for (var index = -1; index <= 1; index += 2) {
1703 var px = curve[0] + Math.cos(angle + index * Math.PI / divisor) * dist;
1704 var py = curve[1] + Math.sin(angle + index * Math.PI / divisor) * dist;
1705 var _px = (px - srcLeft) * scale;
1706 var _py = (py - srcTop) * scale;
1707 ctx.fillText(index < 0 ? to.toString() : from.toString(), _px, _py + 8);
1708 }
1709 ctx.textAlign = saveAlign;
1710 ctx.fillStyle = saveStyle;
1711 ctx.font = saveFont;
1712 }
1713
1714 function drawPoint(px, py, end) {
1715 for (var pts = 0; pts < drawnPts.length; pts += 2) {
1716 var x = drawnPts[pts];
1717 var y = drawnPts[pts + 1];
1718 if (px == x && py == y) {
1719 return;
1720 }
1721 }
1722 drawnPts.push(px);
1723 drawnPts.push(py);
1724 var label = px.toFixed(decimal_places) + ", " + py.toFixed(decimal_places);
1725 var _px = (px - srcLeft) * scale;
1726 var _py = (py - srcTop) * scale;
1727 ctx.beginPath();
1728 ctx.arc(_px, _py, 3, 0, Math.PI*2, true);
1729 ctx.closePath();
1730 if (end) {
1731 ctx.fill();
1732 } else {
1733 ctx.stroke();
1734 }
1735 if (debug_xy) {
1736 ctx.textAlign = "left";
1737 ctx.fillText(label, _px + 5, _py);
1738 }
1739 }
1740
1741 function drawPoints(ptArray, curveType, drawControls) {
1742 var count = (curveType - PATH_LINE + 2) * 2;
1743 for (var idx = 0; idx < count; idx += 2) {
1744 if (!drawControls && idx != 0 && idx != count - 2) {
1745 continue;
1746 }
1747 drawPoint(ptArray[idx], ptArray[idx + 1], idx == 0 || idx == count - 2);
1748 }
1749 }
1750
1751 function drawControlLines(curve, curveType, drawEnd) {
1752 if (curveType == PATH_LINE) {
1753 return;
1754 }
1755 ctx.strokeStyle = "rgba(0,0,0, 0.3)";
1756 drawLine(curve[0], curve[1], curve[2], curve[3]);
1757 drawLine(curve[2], curve[3], curve[4], curve[5]);
1758 if (curveType == PATH_CUBIC) {
1759 drawLine(curve[4], curve[5], curve[6], curve[7]);
1760 if (drawEnd > 1) {
1761 drawLine(curve[6], curve[7], curve[0], curve[1]);
1762 if (drawEnd > 2) {
1763 drawLine(curve[0], curve[1], curve[4], curve[5]);
1764 drawLine(curve[6], curve[7], curve[2], curve[3]);
1765 }
1766 }
1767 } else if (drawEnd > 1) {
1768 drawLine(curve[4], curve[5], curve[0], curve[1]);
1769 }
1770 }
1771
1772 function pointAtT(curve, curveType, t) {
1773 var xy = {};
1774 switch (curveType) {
1775 case PATH_LINE:
1776 var a = 1 - t;
1777 var b = t;
1778 xy.x = a * curve[0] + b * curve[2];
1779 xy.y = a * curve[1] + b * curve[3];
1780 break;
1781 case PATH_QUAD:
1782 var one_t = 1 - t;
1783 var a = one_t * one_t;
1784 var b = 2 * one_t * t;
1785 var c = t * t;
1786 xy.x = a * curve[0] + b * curve[2] + c * curve[4];
1787 xy.y = a * curve[1] + b * curve[3] + c * curve[5];
1788 break;
1789 case PATH_CUBIC:
1790 var one_t = 1 - t;
1791 var one_t2 = one_t * one_t;
1792 var a = one_t2 * one_t;
1793 var b = 3 * one_t2 * t;
1794 var t2 = t * t;
1795 var c = 3 * one_t * t2;
1796 var d = t2 * t;
1797 xy.x = a * curve[0] + b * curve[2] + c * curve[4] + d * curve[6];
1798 xy.y = a * curve[1] + b * curve[3] + c * curve[5] + d * curve[7];
1799 break;
1800 }
1801 return xy;
1802 }
1803
1804 function drawPointAtT(curve, curveType) {
1805 var x, y;
1806 var xy = pointAtT(curve, curveType, curveT);
1807 drawPoint(xy.x, xy.y, true);
1808 if (!draw_intersectT) {
1809 return;
1810 }
1811 ctx.fillStyle = "red";
1812 drawTAtPointUp(xy.x, xy.y, curveT);
1813 }
1814
1815 function drawTAtPointUp(px, py, t) {
1816 var label = t.toFixed(decimal_places);
1817 var _px = (px - srcLeft)* scale;
1818 var _py = (py - srcTop) * scale;
1819 ctx.fillText(label, _px + 5, _py - 10);
1820 }
1821
1822 function drawTAtPointDown(px, py, t) {
1823 var label = t.toFixed(decimal_places);
1824 var _px = (px - srcLeft)* scale;
1825 var _py = (py - srcTop) * scale;
1826 ctx.fillText(label, _px + 5, _py + 10);
1827 }
1828
1829 function alreadyDrawnLine(x1, y1, x2, y2) {
1830 if (collect_bounds) {
1831 if (focus_enabled) {
1832 focusXmin = Math.min(focusXmin, x1, x2);
1833 focusYmin = Math.min(focusYmin, y1, y2);
1834 focusXmax = Math.max(focusXmax, x1, x2);
1835 focusYmax = Math.max(focusYmax, y1, y2);
1836 }
1837 return true;
1838 }
1839 for (var pts = 0; pts < drawnLines.length; pts += 4) {
1840 if (x1 == drawnLines[pts] && y1 == drawnLines[pts + 1]
1841 && x2 == drawnLines[pts + 2] && y2 == drawnLines[pts + 3]) {
1842 return true;
1843 }
1844 }
1845 drawnLines.push(x1);
1846 drawnLines.push(y1);
1847 drawnLines.push(x2);
1848 drawnLines.push(y2);
1849 return false;
1850 }
1851
1852 function drawLine(x1, y1, x2, y2) {
1853 if (alreadyDrawnLine(x1, y1, x2, y2)) {
1854 return;
1855 }
1856 ctx.beginPath();
1857 ctx.moveTo((x1 - srcLeft) * scale,
1858 (y1 - srcTop) * scale);
1859 ctx.lineTo((x2 - srcLeft) * scale,
1860 (y2 - srcTop) * scale);
1861 ctx.stroke();
1862 }
1863
1864 function linePartial(x1, y1, x2, y2, t1, t2) {
1865 var dx = x1 - x2;
1866 var dy = y1 - y2;
1867 var array = [
1868 x1 - t1 * dx,
1869 y1 - t1 * dy,
1870 x1 - t2 * dx,
1871 y1 - t2 * dy
1872 ];
1873 return array;
1874 }
1875
1876 function drawLinePartial(x1, y1, x2, y2, t1, t2) {
1877 var a = linePartial(x1, y1, x2, y2, t1, t2);
1878 var ax = a[0];
1879 var ay = a[1];
1880 var bx = a[2];
1881 var by = a[3];
1882 if (alreadyDrawnLine(ax, ay, bx, by)) {
1883 return;
1884 }
1885 ctx.beginPath();
1886 ctx.moveTo((ax - srcLeft) * scale,
1887 (ay - srcTop) * scale);
1888 ctx.lineTo((bx - srcLeft) * scale,
1889 (by - srcTop) * scale);
1890 ctx.stroke();
1891 }
1892
1893 function alreadyDrawnQuad(x1, y1, x2, y2, x3, y3) {
1894 if (collect_bounds) {
1895 if (focus_enabled) {
1896 focusXmin = Math.min(focusXmin, x1, x2, x3);
1897 focusYmin = Math.min(focusYmin, y1, y2, y3);
1898 focusXmax = Math.max(focusXmax, x1, x2, x3);
1899 focusYmax = Math.max(focusYmax, y1, y2, y3);
1900 }
1901 return true;
1902 }
1903 for (var pts = 0; pts < drawnQuads.length; pts += 6) {
1904 if (x1 == drawnQuads[pts] && y1 == drawnQuads[pts + 1]
1905 && x2 == drawnQuads[pts + 2] && y2 == drawnQuads[pts + 3]
1906 && x3 == drawnQuads[pts + 4] && y3 == drawnQuads[pts + 5]) {
1907 return true;
1908 }
1909 }
1910 drawnQuads.push(x1);
1911 drawnQuads.push(y1);
1912 drawnQuads.push(x2);
1913 drawnQuads.push(y2);
1914 drawnQuads.push(x3);
1915 drawnQuads.push(y3);
1916 return false;
1917 }
1918
1919 function drawQuad(x1, y1, x2, y2, x3, y3) {
1920 if (alreadyDrawnQuad(x1, y1, x2, y2, x3, y3)) {
1921 return;
1922 }
1923 ctx.beginPath();
1924 ctx.moveTo((x1 - srcLeft) * scale,
1925 (y1 - srcTop) * scale);
1926 ctx.quadraticCurveTo((x2 - srcLeft) * scale,
1927 (y2 - srcTop) * scale,
1928 (x3 - srcLeft) * scale,
1929 (y3 - srcTop) * scale);
1930 ctx.stroke();
1931 }
1932
1933 function interp(A, B, t) {
1934 return A + (B - A) * t;
1935 }
1936
1937 function interp_quad_coords(x1, x2, x3, t)
1938 {
1939 var ab = interp(x1, x2, t);
1940 var bc = interp(x2, x3, t);
1941 var abc = interp(ab, bc, t);
1942 return abc;
1943 }
1944
1945 function quadPartial(x1, y1, x2, y2, x3, y3, t1, t2) {
1946 var ax = interp_quad_coords(x1, x2, x3, t1);
1947 var ay = interp_quad_coords(y1, y2, y3, t1);
1948 var dx = interp_quad_coords(x1, x2, x3, (t1 + t2) / 2);
1949 var dy = interp_quad_coords(y1, y2, y3, (t1 + t2) / 2);
1950 var cx = interp_quad_coords(x1, x2, x3, t2);
1951 var cy = interp_quad_coords(y1, y2, y3, t2);
1952 var bx = 2*dx - (ax + cx)/2;
1953 var by = 2*dy - (ay + cy)/2;
1954 var array = [
1955 ax, ay, bx, by, cx, cy
1956 ];
1957 return array;
1958 }
1959
1960 function drawQuadPartial(x1, y1, x2, y2, x3, y3, t1, t2) {
1961 var a = quadPartial(x1, y1, x2, y2, x3, y3, t1, t2);
1962 var ax = a[0];
1963 var ay = a[1];
1964 var bx = a[2];
1965 var by = a[3];
1966 var cx = a[4];
1967 var cy = a[5];
1968 if (alreadyDrawnQuad(ax, ay, bx, by, cx, cy)) {
1969 return;
1970 }
1971 ctx.beginPath();
1972 ctx.moveTo((ax - srcLeft) * scale,
1973 (ay - srcTop) * scale);
1974 ctx.quadraticCurveTo((bx - srcLeft) * scale,
1975 (by - srcTop) * scale,
1976 (cx - srcLeft) * scale,
1977 (cy - srcTop) * scale);
1978 ctx.stroke();
1979 }
1980
1981 function alreadyDrawnCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
1982 if (collect_bounds) {
1983 if (focus_enabled) {
1984 focusXmin = Math.min(focusXmin, x1, x2, x3, x4);
1985 focusYmin = Math.min(focusYmin, y1, y2, y3, y4);
1986 focusXmax = Math.max(focusXmax, x1, x2, x3, x4);
1987 focusYmax = Math.max(focusYmax, y1, y2, y3, y4);
1988 }
1989 return true;
1990 }
1991 for (var pts = 0; pts < drawnCubics.length; pts += 8) {
1992 if (x1 == drawnCubics[pts] && y1 == drawnCubics[pts + 1]
1993 && x2 == drawnCubics[pts + 2] && y2 == drawnCubics[pts + 3]
1994 && x3 == drawnCubics[pts + 4] && y3 == drawnCubics[pts + 5]
1995 && x4 == drawnCubics[pts + 6] && y4 == drawnCubics[pts + 7]) {
1996 return true;
1997 }
1998 }
1999 drawnCubics.push(x1);
2000 drawnCubics.push(y1);
2001 drawnCubics.push(x2);
2002 drawnCubics.push(y2);
2003 drawnCubics.push(x3);
2004 drawnCubics.push(y3);
2005 drawnCubics.push(x4);
2006 drawnCubics.push(y4);
2007 return false;
2008 }
2009
2010 function drawCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
2011 if (alreadyDrawnCubic(x1, y1, x2, y2, x3, y3, x4, y4)) {
2012 return;
2013 }
2014 ctx.beginPath();
2015 ctx.moveTo((x1 - srcLeft) * scale,
2016 (y1 - srcTop) * scale);
2017 ctx.bezierCurveTo((x2 - srcLeft) * scale,
2018 (y2 - srcTop) * scale,
2019 (x3 - srcLeft) * scale,
2020 (y3 - srcTop) * scale,
2021 (x4 - srcLeft) * scale,
2022 (y4 - srcTop) * scale);
2023 ctx.stroke();
2024 }
2025
2026 function interp_cubic_coords(x1, x2, x3, x4, t)
2027 {
2028 var ab = interp(x1, x2, t);
2029 var bc = interp(x2, x3, t);
2030 var cd = interp(x3, x4, t);
2031 var abc = interp(ab, bc, t);
2032 var bcd = interp(bc, cd, t);
2033 var abcd = interp(abc, bcd, t);
2034 return abcd;
2035 }
2036
2037 function cubicPartial(x1, y1, x2, y2, x3, y3, x4, y4, t1, t2) {
2038 var ax = interp_cubic_coords(x1, x2, x3, x4, t1);
2039 var ay = interp_cubic_coords(y1, y2, y3, y4, t1);
2040 var ex = interp_cubic_coords(x1, x2, x3, x4, (t1*2+t2)/3);
2041 var ey = interp_cubic_coords(y1, y2, y3, y4, (t1*2+t2)/3);
2042 var fx = interp_cubic_coords(x1, x2, x3, x4, (t1+t2*2)/3);
2043 var fy = interp_cubic_coords(y1, y2, y3, y4, (t1+t2*2)/3);
2044 var dx = interp_cubic_coords(x1, x2, x3, x4, t2);
2045 var dy = interp_cubic_coords(y1, y2, y3, y4, t2);
2046 var mx = ex * 27 - ax * 8 - dx;
2047 var my = ey * 27 - ay * 8 - dy;
2048 var nx = fx * 27 - ax - dx * 8;
2049 var ny = fy * 27 - ay - dy * 8;
2050 var bx = (mx * 2 - nx) / 18;
2051 var by = (my * 2 - ny) / 18;
2052 var cx = (nx * 2 - mx) / 18;
2053 var cy = (ny * 2 - my) / 18;
2054 var array = [
2055 ax, ay, bx, by, cx, cy, dx, dy
2056 ];
2057 return array;
2058 }
2059
2060 function drawCubicPartial(x1, y1, x2, y2, x3, y3, x4, y4, t1, t2) {
2061 var a = cubicPartial(x1, y1, x2, y2, x3, y3, x4, y4, t1, t2);
2062 var ax = a[0];
2063 var ay = a[1];
2064 var bx = a[2];
2065 var by = a[3];
2066 var cx = a[4];
2067 var cy = a[5];
2068 var dx = a[6];
2069 var dy = a[7];
2070 if (alreadyDrawnCubic(ax, ay, bx, by, cx, cy, dx, dy)) {
2071 return;
2072 }
2073 ctx.beginPath();
2074 ctx.moveTo((ax - srcLeft) * scale,
2075 (ay - srcTop) * scale);
2076 ctx.bezierCurveTo((bx - srcLeft) * scale,
2077 (by - srcTop) * scale,
2078 (cx - srcLeft) * scale,
2079 (cy - srcTop) * scale,
2080 (dx - srcLeft) * scale,
2081 (dy - srcTop) * scale);
2082 ctx.stroke();
2083 }
2084
2085 function drawCurve(c) {
2086 switch (c.length) {
2087 case 4:
2088 drawLine(c[0], c[1], c[2], c[3]);
2089 break;
2090 case 6:
2091 drawQuad(c[0], c[1], c[2], c[3], c[4], c[5]);
2092 break;
2093 case 8:
2094 drawCubic(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]);
2095 break;
2096 }
2097 }
2098
2099 function boundsWidth(pts) {
2100 var min = pts[0];
2101 var max = pts[0];
2102 for (var idx = 2; idx < pts.length; idx += 2) {
2103 min = Math.min(min, pts[idx]);
2104 max = Math.max(max, pts[idx]);
2105 }
2106 return max - min;
2107 }
2108
2109 function boundsHeight(pts) {
2110 var min = pts[1];
2111 var max = pts[1];
2112 for (var idx = 3; idx < pts.length; idx += 2) {
2113 min = Math.min(min, pts[idx]);
2114 max = Math.max(max, pts[idx]);
2115 }
2116 return max - min;
2117 }
2118
2119 function tangent(pts) {
2120 var dx = pts[2] - pts[0];
2121 var dy = pts[3] - pts[1];
2122 if (dx == 0 && dy == 0 && pts.length > 4) {
2123 dx = pts[4] - pts[0];
2124 dy = pts[5] - pts[1];
2125 if (dx == 0 && dy == 0 && pts.length > 6) {
2126 dx = pts[6] - pts[0];
2127 dy = pts[7] - pts[1];
2128 }
2129 }
2130 return Math.atan2(-dy, dx);
2131 }
2132
2133 function hodograph(cubic) {
2134 var hodo = [];
2135 hodo[0] = 3 * (cubic[2] - cubic[0]);
2136 hodo[1] = 3 * (cubic[3] - cubic[1]);
2137 hodo[2] = 3 * (cubic[4] - cubic[2]);
2138 hodo[3] = 3 * (cubic[5] - cubic[3]);
2139 hodo[4] = 3 * (cubic[6] - cubic[4]);
2140 hodo[5] = 3 * (cubic[7] - cubic[5]);
2141 return hodo;
2142 }
2143
2144 function hodograph2(cubic) {
2145 var quad = hodograph(cubic);
2146 var hodo = [];
2147 hodo[0] = 2 * (quad[2] - quad[0]);
2148 hodo[1] = 2 * (quad[3] - quad[1]);
2149 hodo[2] = 2 * (quad[4] - quad[2]);
2150 hodo[3] = 2 * (quad[5] - quad[3]);
2151 return hodo;
2152 }
2153
2154 function quadraticRootsReal(A, B, C, s) {
2155 if (A == 0) {
2156 if (B == 0) {
2157 s[0] = 0;
2158 return C == 0;
2159 }
2160 s[0] = -C / B;
2161 return 1;
2162 }
2163 /* normal form: x^2 + px + q = 0 */
2164 var p = B / (2 * A);
2165 var q = C / A;
2166 var p2 = p * p;
2167 if (p2 < q) {
2168 return 0;
2169 }
2170 var sqrt_D = 0;
2171 if (p2 > q) {
2172 sqrt_D = sqrt(p2 - q);
2173 }
2174 s[0] = sqrt_D - p;
2175 s[1] = -sqrt_D - p;
2176 return 1 + s[0] != s[1];
2177 }
2178
2179 function add_valid_ts(s, realRoots, t) {
2180 var foundRoots = 0;
2181 for (var index = 0; index < realRoots; ++index) {
2182 var tValue = s[index];
2183 if (tValue >= 0 && tValue <= 1) {
2184 for (var idx2 = 0; idx2 < foundRoots; ++idx2) {
2185 if (t[idx2] != tValue) {
2186 t[foundRoots++] = tValue;
2187 }
2188 }
2189 }
2190 }
2191 return foundRoots;
2192 }
2193
2194 function quadraticRootsValidT(a, b, c, t) {
2195 var s = [];
2196 var realRoots = quadraticRootsReal(A, B, C, s);
2197 var foundRoots = add_valid_ts(s, realRoots, t);
2198 return foundRoots != 0;
2199 }
2200
2201 function find_cubic_inflections(cubic, tValues) {
2202 var Ax = src[2] - src[0];
2203 var Ay = src[3] - src[1];
2204 var Bx = src[4] - 2 * src[2] + src[0];
2205 var By = src[5] - 2 * src[3] + src[1];
2206 var Cx = src[6] + 3 * (src[2] - src[4]) - src[0];
2207 var Cy = src[7] + 3 * (src[3] - src[5]) - src[1];
2208 return quadraticRootsValidT(Bx * Cy - By * Cx, (Ax * Cy - Ay * Cx),
2209 Ax * By - Ay * Bx, tValues);
2210 }
2211
2212 function dxy_at_t(curve, type, t) {
2213 var dxy = {};
2214 if (type == PATH_QUAD) {
2215 var a = t - 1;
2216 var b = 1 - 2 * t;
2217 var c = t;
2218 dxy.x = a * curve[0] + b * curve[2] + c * curve[4];
2219 dxy.y = a * curve[1] + b * curve[3] + c * curve[5];
2220 } else if (type == PATH_CUBIC) {
2221 var one_t = 1 - t;
2222 var a = curve[0];
2223 var b = curve[2];
2224 var c = curve[4];
2225 var d = curve[6];
2226 dxy.x = 3 * ((b - a) * one_t * one_t + 2 * (c - b) * t * one_t + (d - c) * t * t);
2227 a = curve[1];
2228 b = curve[3];
2229 c = curve[5];
2230 d = curve[7];
2231 dxy.y = 3 * ((b - a) * one_t * one_t + 2 * (c - b) * t * one_t + (d - c) * t * t);
2232 }
2233 return dxy;
2234 }
2235
2236 function drawLabel(num, px, py) {
2237 ctx.beginPath();
2238 ctx.arc(px, py, 8, 0, Math.PI*2, true);
2239 ctx.closePath();
2240 ctx.strokeStyle = "rgba(0,0,0, 0.4)";
2241 ctx.lineWidth = num == 0 || num == 3 ? 2 : 1;
2242 ctx.stroke();
2243 ctx.fillStyle = "black";
2244 ctx.font = "normal 10px Arial";
2245 // ctx.rotate(0.001);
2246 ctx.fillText(num, px - 2, py + 3);
2247 // ctx.rotate(-0.001);
2248 }
2249
2250 function drawLabelX(ymin, num, loc) {
2251 var px = (loc - srcLeft) * scale;
2252 var py = (ymin - srcTop) * scale - 20;
2253 drawLabel(num, px, py);
2254 }
2255
2256 function drawLabelY(xmin, num, loc) {
2257 var px = (xmin - srcLeft) * scale - 20;
2258 var py = (loc - srcTop) * scale;
2259 drawLabel(num, px, py);
2260 }
2261
2262 function drawHodoOrigin(hx, hy, hMinX, hMinY, hMaxX, hMaxY) {
2263 ctx.beginPath();
2264 ctx.moveTo(hx, hy - 100);
2265 ctx.lineTo(hx, hy);
2266 ctx.strokeStyle = hMinY < 0 ? "green" : "blue";
2267 ctx.stroke();
2268 ctx.beginPath();
2269 ctx.moveTo(hx, hy);
2270 ctx.lineTo(hx, hy + 100);
2271 ctx.strokeStyle = hMaxY > 0 ? "green" : "blue";
2272 ctx.stroke();
2273 ctx.beginPath();
2274 ctx.moveTo(hx - 100, hy);
2275 ctx.lineTo(hx, hy);
2276 ctx.strokeStyle = hMinX < 0 ? "green" : "blue";
2277 ctx.stroke();
2278 ctx.beginPath();
2279 ctx.moveTo(hx, hy);
2280 ctx.lineTo(hx + 100, hy);
2281 ctx.strokeStyle = hMaxX > 0 ? "green" : "blue";
2282 ctx.stroke();
2283 }
2284
2285 function scalexy(x, y, mag) {
2286 var length = Math.sqrt(x * x + y * y);
2287 return mag / length;
2288 }
2289
2290 function drawArrow(x, y, dx, dy) {
2291 var dscale = scalexy(dx, dy, 1 / scale * 100);
2292 dx *= dscale;
2293 dy *= dscale;
2294 ctx.beginPath();
2295 ctx.moveTo((x - srcLeft) * scale, (y - srcTop) * scale);
2296 x += dx;
2297 y += dy;
2298 ctx.lineTo((x - srcLeft) * scale, (y - srcTop) * scale);
2299 dx /= 10;
2300 dy /= 10;
2301 ctx.lineTo((x - dy - srcLeft) * scale, (y + dx - srcTop) * scale);
2302 ctx.lineTo((x + dx * 2 - srcLeft) * scale, (y + dy * 2 - srcTop) * scale);
2303 ctx.lineTo((x + dy - srcLeft) * scale, (y - dx - srcTop) * scale);
2304 ctx.lineTo((x - srcLeft) * scale, (y - srcTop) * scale);
2305 ctx.strokeStyle = "rgba(0,75,0, 0.4)";
2306 ctx.stroke();
2307 }
2308
2309 function x_at_t(curve, t) {
2310 var one_t = 1 - t;
2311 if (curve.length == 4) {
2312 return one_t * curve[0] + t * curve[2];
2313 }
2314 var one_t2 = one_t * one_t;
2315 var t2 = t * t;
2316 if (curve.length == 6) {
2317 return one_t2 * curve[0] + 2 * one_t * t * curve[2] + t2 * curve[4];
2318 }
2319 var a = one_t2 * one_t;
2320 var b = 3 * one_t2 * t;
2321 var c = 3 * one_t * t2;
2322 var d = t2 * t;
2323 return a * curve[0] + b * curve[2] + c * curve[4] + d * curve[6];
2324 }
2325
2326 function y_at_t(curve, t) {
2327 var one_t = 1 - t;
2328 if (curve.length == 4) {
2329 return one_t * curve[1] + t * curve[3];
2330 }
2331 var one_t2 = one_t * one_t;
2332 var t2 = t * t;
2333 if (curve.length == 6) {
2334 return one_t2 * curve[1] + 2 * one_t * t * curve[3] + t2 * curve[5];
2335 }
2336 var a = one_t2 * one_t;
2337 var b = 3 * one_t2 * t;
2338 var c = 3 * one_t * t2;
2339 var d = t2 * t;
2340 return a * curve[1] + b * curve[3] + c * curve[5] + d * curve[7];
2341 }
2342
2343 function drawOrder(curve, label) {
2344 var px = x_at_t(curve, 0.75);
2345 var py = y_at_t(curve, 0.75);
2346 var _px = (px - srcLeft) * scale;
2347 var _py = (py - srcTop) * scale;
2348 ctx.beginPath();
2349 ctx.arc(_px, _py, 15, 0, Math.PI * 2, true);
2350 ctx.closePath();
2351 ctx.fillStyle = "white";
2352 ctx.fill();
2353 if (label == 'L') {
2354 ctx.strokeStyle = "rgba(255,0,0, 1)";
2355 ctx.fillStyle = "rgba(255,0,0, 1)";
2356 } else {
2357 ctx.strokeStyle = "rgba(0,0,255, 1)";
2358 ctx.fillStyle = "rgba(0,0,255, 1)";
2359 }
2360 ctx.stroke();
2361 ctx.font = "normal 16px Arial";
2362 ctx.textAlign = "center";
2363 ctx.fillText(label, _px, _py + 5);
2364 ctx.font = "normal 10px Arial";
2365 }
2366
2367 function drawID(curve, id) {
2368 var px = x_at_t(curve, 0.5);
2369 var py = y_at_t(curve, 0.5);
2370 var _px = (px - srcLeft) * scale;
2371 var _py = (py - srcTop) * scale;
2372 draw_id_at(id, _px, _py);
2373 }
2374
2375 function draw_id_at(id, _px, _py) {
2376 ctx.beginPath();
2377 ctx.arc(_px, _py, 15, 0, Math.PI * 2, true);
2378 ctx.closePath();
2379 ctx.fillStyle = "white";
2380 ctx.fill();
2381 ctx.strokeStyle = "rgba(127,127,0, 1)";
2382 ctx.fillStyle = "rgba(127,127,0, 1)";
2383 ctx.stroke();
2384 ctx.font = "normal 16px Arial";
2385 ctx.textAlign = "center";
2386 ctx.fillText(id, _px, _py + 5);
2387 ctx.font = "normal 10px Arial";
2388 }
2389
2390 function drawLinePartialID(id, x1, y1, x2, y2, t1, t2) {
2391 var curve = [x1, y1, x2, y2];
2392 drawCurvePartialID(id, curve, t1, t2);
2393 }
2394
2395 function drawQuadPartialID(id, x1, y1, x2, y2, x3, y3, t1, t2) {
2396 var curve = [x1, y1, x2, y2, x3, y3];
2397 drawCurvePartialID(id, curve, t1, t2);
2398 }
2399
2400 function drawCubicPartialID(id, x1, y1, x2, y2, x3, y3, x4, y4, t1, t2) {
2401 var curve = [x1, y1, x2, y2, x3, y3, x4, y4];
2402 drawCurvePartialID(id, curve, t1, t2);
2403 }
2404
2405 function drawCurvePartialID(id, curve, t1, t2) {
2406 var px = x_at_t(curve, (t1 + t2) / 2);
2407 var py = y_at_t(curve, (t1 + t2) / 2);
2408 var _px = (px - srcLeft) * scale;
2409 var _py = (py - srcTop) * scale;
2410 draw_id_at(id, _px, _py);
2411 }
2412
2413 function drawCurveSpecials(test, curve, type) {
2414 if (pt_labels) {
2415 drawPoints(curve, type, pt_labels == 2);
2416 }
2417 if (control_lines != 0) {
2418 drawControlLines(curve, type, control_lines);
2419 }
2420 if (curve_t) {
2421 drawPointAtT(curve, type);
2422 }
2423 if (draw_midpoint) {
2424 var mid = pointAtT(curve, type, 0.5);
2425 drawPoint(mid.x, mid.y, true);
2426 }
2427 if (draw_id) {
2428 var id = idByCurve(test, curve, type);
2429 if (id >= 0) {
2430 drawID(curve, id);
2431 }
2432 }
2433 if (type == PATH_LINE) {
2434 return;
2435 }
2436 if (draw_deriviatives > 0) {
2437 var d = dxy_at_t(curve, type, 0);
2438 drawArrow(curve[0], curve[1], d.x, d.y);
2439 if (draw_deriviatives == 2) {
2440 d = dxy_at_t(curve, type, 1);
2441 if (type == PATH_CUBIC) {
2442 drawArrow(curve[6], curve[7], d.x, d.y);
2443 } else {
2444 drawArrow(curve[4], curve[5], d.x, d.y);
2445 }
2446 }
2447 if (draw_midpoint) {
2448 var mid = pointAtT(curve, type, 0.5);
2449 d = dxy_at_t(curve, type, 0.5);
2450 drawArrow(mid.x, mid.y, d.x, d.y);
2451 }
2452 }
2453 if (type != PATH_CUBIC) {
2454 return;
2455 }
2456 if (draw_hodo == 1 || draw_hodo == 2) {
2457 var hodo = hodograph(curve);
2458 var hMinX = Math.min(0, hodo[0], hodo[2], hodo[4]);
2459 var hMinY = Math.min(0, hodo[1], hodo[3], hodo[5]);
2460 var hMaxX = Math.max(0, hodo[0], hodo[2], hodo[4]);
2461 var hMaxY = Math.max(0, hodo[1], hodo[3], hodo[5]);
2462 var hScaleX = hMaxX - hMinX > 0 ? screenWidth / (hMaxX - hMinX) : 1;
2463 var hScaleY = hMaxY - hMinY > 0 ? screenHeight / (hMaxY - hMinY) : 1;
2464 var hUnit = Math.min(hScaleX, hScaleY);
2465 hUnit /= 2;
2466 var hx = xoffset - hMinX * hUnit;
2467 var hy = yoffset - hMinY * hUnit;
2468 ctx.moveTo(hx + hodo[0] * hUnit, hy + hodo[1] * hUnit);
2469 ctx.quadraticCurveTo(
2470 hx + hodo[2] * hUnit, hy + hodo[3] * hUnit,
2471 hx + hodo[4] * hUnit, hy + hodo[5] * hUnit);
2472 ctx.strokeStyle = "red";
2473 ctx.stroke();
2474 if (draw_hodo == 1) {
2475 drawHodoOrigin(hx, hy, hMinX, hMinY, hMaxX, hMaxY);
2476 }
2477 }
2478 if (draw_hodo == 3) {
2479 var hodo = hodograph2(curve);
2480 var hMinX = Math.min(0, hodo[0], hodo[2]);
2481 var hMinY = Math.min(0, hodo[1], hodo[3]);
2482 var hMaxX = Math.max(0, hodo[0], hodo[2]);
2483 var hMaxY = Math.max(0, hodo[1], hodo[3]);
2484 var hScaleX = hMaxX - hMinX > 0 ? screenWidth / (hMaxX - hMinX) : 1;
2485 var hScaleY = hMaxY - hMinY > 0 ? screenHeight / (hMaxY - hMinY) : 1;
2486 var hUnit = Math.min(hScaleX, hScaleY);
2487 hUnit /= 2;
2488 var hx = xoffset - hMinX * hUnit;
2489 var hy = yoffset - hMinY * hUnit;
2490 ctx.moveTo(hx + hodo[0] * hUnit, hy + hodo[1] * hUnit);
2491 ctx.lineTo(hx + hodo[2] * hUnit, hy + hodo[3] * hUnit);
2492 ctx.strokeStyle = "red";
2493 ctx.stroke();
2494 drawHodoOrigin(hx, hy, hMinX, hMinY, hMaxX, hMaxY);
2495 }
2496 if (draw_sequence) {
2497 var ymin = Math.min(curve[1], curve[3], curve[5], curve[7]);
2498 for (var i = 0; i < 8; i+= 2) {
2499 drawLabelX(ymin, i >> 1, curve[i]);
2500 }
2501 var xmin = Math.min(curve[0], curve[2], curve[4], curve[6]);
2502 for (var i = 1; i < 8; i+= 2) {
2503 drawLabelY(xmin, i >> 1, curve[i]);
2504 }
2505 }
2506 }
2507
2508 function logCurves(test) {
2509 for (curves in test) {
2510 var curve = test[curves];
2511 dumpCurve(curve);
2512 }
2513 }
2514
2515 function curveToString(curve) {
2516 var str = "{{";
2517 for (i = 0; i < curve.length; i += 2) {
2518 str += curve[i].toFixed(decimal_places) + "," + curve[i + 1].toFixed(dec imal_places);
2519 if (i < curve.length - 2) {
2520 str += "}, {";
2521 }
2522 }
2523 str += "}}";
2524 return str;
2525 }
2526
2527 function dumpCurve(curve) {
2528 console.log(curveToString(curve));
2529 }
2530
2531 function draw(test, lines, title) {
2532 ctx.fillStyle = "rgba(0,0,0, 0.1)";
2533 ctx.font = "normal 50px Arial";
2534 ctx.textAlign = "left";
2535 ctx.fillText(title, 50, 50);
2536 ctx.font = "normal 10px Arial";
2537 ctx.lineWidth = "1.001"; "0.999";
2538 var secondPath = test.length;
2539 var closeCount = 0;
2540 logStart = -1;
2541 logRange = 0;
2542 // find last active rec type at this step
2543 var curType = test[0];
2544 var curStep = 0;
2545 var hasOp = false;
2546 var lastActive = 0;
2547 var lastAdd = 0;
2548 var lastSect = 0;
2549 var lastSort = 0;
2550 var lastMark = 0;
2551 activeCount = 0;
2552 addCount = 0;
2553 angleCount = 0;
2554 opCount = 0;
2555 sectCount = 0;
2556 sortCount = 0;
2557 markCount = 0;
2558 activeMax = 0;
2559 addMax = 0;
2560 angleMax = 0;
2561 opMax = 0;
2562 sectMax = 0;
2563 sectMax2 = 0;
2564 sortMax = 0;
2565 markMax = 0;
2566 lastIndex = test.length - 3;
2567 for (var tIndex = 0; tIndex < test.length; tIndex += 3) {
2568 var recType = test[tIndex];
2569 if (!typeof recType == 'number' || recType < REC_TYPE_UNKNOWN || recType > REC_TYPE_LAST) {
2570 console.log("unknown rec type: " + recType);
2571 throw "stop execution";
2572 }
2573 // if (curType == recType && curType != REC_TYPE_ADD) {
2574 // continue;
2575 // }
2576 var inStepRange = step_limit == 0 || curStep < step_limit;
2577 curType = recType;
2578 if (recType == REC_TYPE_OP) {
2579 hasOp = true;
2580 continue;
2581 }
2582 if (recType == REC_TYPE_UNKNOWN) {
2583 // these types do not advance step
2584 continue;
2585 }
2586 var bumpStep = false;
2587 var records = test[tIndex + 2];
2588 var fragType = records[0];
2589 if (recType == REC_TYPE_ADD) {
2590 if (records.length != 2) {
2591 console.log("expect only two elements: " + records.length);
2592 throw "stop execution";
2593 }
2594 if (fragType == ADD_MOVETO || fragType == ADD_CLOSE) {
2595 continue;
2596 }
2597 ++addMax;
2598 if (!draw_add || !inStepRange) {
2599 continue;
2600 }
2601 lastAdd = tIndex;
2602 ++addCount;
2603 bumpStep = true;
2604 }
2605 if (recType == REC_TYPE_PATH && hasOp) {
2606 secondPath = tIndex;
2607 }
2608 if (recType == REC_TYPE_ACTIVE) {
2609 ++activeMax;
2610 if (!draw_active || !inStepRange) {
2611 continue;
2612 }
2613 lastActive = tIndex;
2614 ++activeCount;
2615 bumpStep = true;
2616 }
2617 if (recType == REC_TYPE_ACTIVE_OP) {
2618 ++opMax;
2619 if (!draw_op || !inStepRange) {
2620 continue;
2621 }
2622 lastOp = tIndex;
2623 ++opCount;
2624 bumpStep = true;
2625 }
2626 if (recType == REC_TYPE_ANGLE) {
2627 ++angleMax;
2628 if (!draw_angle || !inStepRange) {
2629 continue;
2630 }
2631 lastAngle = tIndex;
2632 ++angleCount;
2633 bumpStep = true;
2634 }
2635 if (recType == REC_TYPE_SECT) {
2636 if (records.length != 2) {
2637 console.log("expect only two elements: " + records.length);
2638 throw "stop execution";
2639 }
2640 ++sectMax;
2641 var sectBump = 1;
2642 switch (fragType) {
2643 case INTERSECT_LINE:
2644 case INTERSECT_QUAD_LINE:
2645 case INTERSECT_QUAD:
2646 case INTERSECT_SELF_CUBIC:
2647 case INTERSECT_CUBIC_LINE:
2648 case INTERSECT_CUBIC_QUAD:
2649 case INTERSECT_CUBIC:
2650 sectBump = 1;
2651 break;
2652 case INTERSECT_LINE_2:
2653 case INTERSECT_QUAD_LINE_2:
2654 case INTERSECT_QUAD_2:
2655 case INTERSECT_CUBIC_LINE_2:
2656 case INTERSECT_CUBIC_QUAD_2:
2657 case INTERSECT_CUBIC_2:
2658 sectBump = 2;
2659 break;
2660 case INTERSECT_LINE_NO:
2661 case INTERSECT_QUAD_LINE_NO:
2662 case INTERSECT_QUAD_NO:
2663 case INTERSECT_SELF_CUBIC_NO:
2664 case INTERSECT_CUBIC_LINE_NO:
2665 case INTERSECT_CUBIC_QUAD_NO:
2666 case INTERSECT_CUBIC_NO:
2667 sectBump = 0;
2668 break;
2669 case INTERSECT_CUBIC_LINE_3:
2670 case INTERSECT_CUBIC_QUAD_3:
2671 case INTERSECT_CUBIC_3:
2672 sectBump = 3;
2673 break;
2674 case INTERSECT_CUBIC_QUAD_4:
2675 case INTERSECT_CUBIC_4:
2676 sectBump = 4;
2677 break;
2678 default:
2679 console.log("missing case " + records.length);
2680 throw "stop execution";
2681 }
2682 sectMax2 += sectBump;
2683 if (draw_intersection <= 1 || !inStepRange) {
2684 continue;
2685 }
2686 lastSect = tIndex;
2687 sectCount += sectBump;
2688 bumpStep = true;
2689 }
2690 if (recType == REC_TYPE_SORT) {
2691 ++sortMax;
2692 if (!draw_sort || !inStepRange) {
2693 continue;
2694 }
2695 lastSort = tIndex;
2696 ++sortCount;
2697 bumpStep = true;
2698 }
2699 if (recType == REC_TYPE_MARK) {
2700 ++markMax;
2701 if (!draw_mark || !inStepRange) {
2702 continue;
2703 }
2704 lastMark = tIndex;
2705 ++markCount;
2706 bumpStep = true;
2707 }
2708 if (bumpStep) {
2709 lastIndex = tIndex;
2710 logStart = test[tIndex + 1];
2711 logRange = records.length / 2;
2712 ++curStep;
2713 }
2714 }
2715 stepMax = (draw_add ? addMax : 0)
2716 + (draw_active ? activeMax : 0)
2717 + (draw_op ? opMax : 0)
2718 + (draw_angle ? angleMax : 0)
2719 + (draw_sort ? sortMax : 0)
2720 + (draw_mark ? markMax : 0)
2721 + (draw_intersection == 2 ? sectMax : draw_intersection == 3 ? sectM ax2 : 0);
2722 if (stepMax == 0) {
2723 stepMax = addMax + activeMax + angleMax + opMax + sortMax + markMax;
2724 }
2725 drawnPts = [];
2726 drawnLines = [];
2727 drawnQuads = [];
2728 drawnCubics = [];
2729 focusXmin = focusYmin = Infinity;
2730 focusXmax = focusYmax = -Infinity;
2731 var pathIndex = 0;
2732 var opLetter = 'S';
2733 for (var tIndex = lastIndex; tIndex >= 0; tIndex -= 3) {
2734 var recType = test[tIndex];
2735 var records = test[tIndex + 2];
2736 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2 ) {
2737 var fragType = records[recordIndex];
2738 if (!typeof fragType == 'number' || fragType < 1 || fragType > FRAG_ TYPE_LAST) {
2739 console.log("unknown in range frag type: " + fragType);
2740 throw "stop execution";
2741 }
2742 var frags = records[recordIndex + 1];
2743 focus_enabled = false;
2744 switch (recType) {
2745 case REC_TYPE_COMPUTED:
2746 if (draw_computed == 0) {
2747 continue;
2748 }
2749 ctx.lineWidth = 1;
2750 ctx.strokeStyle = pathIndex == 0 ? "black" : "red";
2751 ctx.fillStyle = "blue";
2752 var drawThis = false;
2753 switch (fragType) {
2754 case PATH_QUAD:
2755 if ((draw_computed & 5) == 1 || ((draw_computed & 4) != 0
2756 && (draw_computed & 1) == pathIndex)) {
2757 drawQuad(frags[0], frags[1], frags[2], frags[3],
2758 frags[4], frags[5]);
2759 drawThis = true;
2760 }
2761 break;
2762 case PATH_CUBIC:
2763 if ((draw_computed & 6) == 2 || ((draw_computed & 4) != 0
2764 && (draw_computed & 1) != pathIndex)) {
2765 drawCubic(frags[0], frags[1], frags[2], frags[3] ,
2766 frags[4], frags[5], frags[6], frags[7]);
2767 drawThis = true;
2768 }
2769 ++pathIndex;
2770 break;
2771 case COMPUTED_SET_1:
2772 pathIndex = 0;
2773 break;
2774 case COMPUTED_SET_2:
2775 pathIndex = 1;
2776 break;
2777 default:
2778 console.log("unknown REC_TYPE_COMPUTED frag type: " + fragType);
2779 throw "stop execution";
2780 }
2781 if (!drawThis || collect_bounds) {
2782 break;
2783 }
2784 drawCurveSpecials(test, frags, fragType);
2785 break;
2786 case REC_TYPE_PATH:
2787 if (!draw_path) {
2788 continue;
2789 }
2790 var firstPath = tIndex < secondPath;
2791 if ((draw_path & (firstPath ? 1 : 2)) == 0) {
2792 continue;
2793 }
2794 ctx.lineWidth = 1;
2795 ctx.strokeStyle = firstPath ? "black" : "red";
2796 ctx.fillStyle = "blue";
2797 switch (fragType) {
2798 case PATH_LINE:
2799 drawLine(frags[0], frags[1], frags[2], frags[3]);
2800 break;
2801 case PATH_QUAD:
2802 drawQuad(frags[0], frags[1], frags[2], frags[3],
2803 frags[4], frags[5]);
2804 break;
2805 case PATH_CUBIC:
2806 drawCubic(frags[0], frags[1], frags[2], frags[3],
2807 frags[4], frags[5], frags[6], frags[7]);
2808 break;
2809 default:
2810 console.log("unknown REC_TYPE_PATH frag type: " + fr agType);
2811 throw "stop execution";
2812 }
2813 if (collect_bounds) {
2814 break;
2815 }
2816 drawCurveSpecials(test, frags, fragType);
2817 break;
2818 case REC_TYPE_OP:
2819 switch (fragType) {
2820 case OP_INTERSECT: opLetter = 'I'; break;
2821 case OP_DIFFERENCE: opLetter = 'D'; break;
2822 case OP_UNION: opLetter = 'U'; break;
2823 case OP_XOR: opLetter = 'X'; break;
2824 default:
2825 console.log("unknown REC_TYPE_OP frag type: " + frag Type);
2826 throw "stop execution";
2827 }
2828 break;
2829 case REC_TYPE_ACTIVE:
2830 if (!draw_active || (step_limit > 0 && tIndex < lastActive)) {
2831 continue;
2832 }
2833 var x1 = frags[SPAN_X1];
2834 var y1 = frags[SPAN_Y1];
2835 var x2 = frags[SPAN_X2];
2836 var y2 = frags[SPAN_Y2];
2837 var x3, y3, x3, y4, t1, t2;
2838 ctx.lineWidth = 3;
2839 ctx.strokeStyle = "rgba(0,0,255, 0.3)";
2840 focus_enabled = true;
2841 switch (fragType) {
2842 case ACTIVE_LINE_SPAN:
2843 t1 = frags[SPAN_L_T];
2844 t2 = frags[SPAN_L_TEND];
2845 drawLinePartial(x1, y1, x2, y2, t1, t2);
2846 if (draw_id) {
2847 drawLinePartialID(frags[0], x1, y1, x2, y2, t1, t2);
2848 }
2849 break;
2850 case ACTIVE_QUAD_SPAN:
2851 x3 = frags[SPAN_X3];
2852 y3 = frags[SPAN_Y3];
2853 t1 = frags[SPAN_Q_T];
2854 t2 = frags[SPAN_Q_TEND];
2855 drawQuadPartial(x1, y1, x2, y2, x3, y3, t1, t2);
2856 if (draw_id) {
2857 drawQuadPartialID(frags[0], x1, y1, x2, y2, x3, y3, t1, t2);
2858 }
2859 break;
2860 case ACTIVE_CUBIC_SPAN:
2861 x3 = frags[SPAN_X3];
2862 y3 = frags[SPAN_Y3];
2863 x4 = frags[SPAN_X4];
2864 y4 = frags[SPAN_Y4];
2865 t1 = frags[SPAN_C_T];
2866 t2 = frags[SPAN_C_TEND];
2867 drawCubicPartial(x1, y1, x2, y2, x3, y3, x4, y4, t1, t2);
2868 if (draw_id) {
2869 drawCubicPartialID(frags[0], x1, y1, x2, y2, x3, y3, x4, y4, t1, t2);
2870 }
2871 break;
2872 default:
2873 console.log("unknown REC_TYPE_ACTIVE frag type: " + fragType);
2874 throw "stop execution";
2875 }
2876 break;
2877 case REC_TYPE_ACTIVE_OP:
2878 if (!draw_op || (step_limit > 0 && tIndex < lastOp)) {
2879 continue;
2880 }
2881 focus_enabled = true;
2882 ctx.lineWidth = 3;
2883 var activeSpan = frags[7] == "1";
2884 ctx.strokeStyle = activeSpan ? "rgba(45,160,0, 0.3)" : "rgba (255,45,0, 0.5)";
2885 var curve = curvePartialByID(test, frags[0], frags[1], frags [2]);
2886 drawCurve(curve);
2887 if (draw_op > 1) {
2888 drawArc(curve, false, frags[3], frags[4]);
2889 drawArc(curve, true, frags[5], frags[6]);
2890 }
2891 break;
2892 case REC_TYPE_ADD:
2893 if (!draw_add) {
2894 continue;
2895 }
2896 ctx.lineWidth = 3;
2897 ctx.strokeStyle = closeCount == 0 ? "rgba(0,0,255, 0.3)"
2898 : closeCount == 1 ? "rgba(0,127,0, 0.3)"
2899 : closeCount == 2 ? "rgba(0,127,127, 0.3)"
2900 : closeCount == 3 ? "rgba(127,127,0, 0.3)"
2901 : "rgba(127,0,127, 0.3)";
2902 focus_enabled = true;
2903 switch (fragType) {
2904 case ADD_MOVETO:
2905 break;
2906 case ADD_LINETO:
2907 if (step_limit == 0 || tIndex >= lastAdd) {
2908 drawLine(frags[0], frags[1], frags[2], frags[3]) ;
2909 }
2910 break;
2911 case ADD_QUADTO:
2912 if (step_limit == 0 || tIndex >= lastAdd) {
2913 drawQuad(frags[0], frags[1], frags[2], frags[3], frags[4], frags[5]);
2914 }
2915 break;
2916 case ADD_CUBICTO:
2917 if (step_limit == 0 || tIndex >= lastAdd) {
2918 drawCubic(frags[0], frags[1], frags[2], frags[3] ,
2919 frags[4], frags[5], frags[6], frags[7]);
2920 }
2921 break;
2922 case ADD_CLOSE:
2923 ++closeCount;
2924 break;
2925 case ADD_FILL:
2926 break;
2927 default:
2928 console.log("unknown REC_TYPE_ADD frag type: " + fra gType);
2929 throw "stop execution";
2930 }
2931 break;
2932 case REC_TYPE_ANGLE:
2933 if (!draw_angle || (step_limit > 0 && tIndex < lastAngle)) {
2934 continue;
2935 }
2936 if (fragType != ANGLE_AFTER && fragType != ANGLE_AFTER2) {
2937 continue;
2938 }
2939 focus_enabled = true;
2940 ctx.lineWidth = 3;
2941 ctx.strokeStyle = "rgba(127,45,127, 0.3)";
2942 var leftCurve, midCurve, rightCurve;
2943 if (fragType == ANGLE_AFTER) {
2944 leftCurve = curvePartialByID(test, frags[0], frags[3], f rags[4]);
2945 midCurve = curvePartialByID(test, frags[5], frags[8], fr ags[9]);
2946 rightCurve = curvePartialByID(test, frags[10], frags[13] , frags[14]);
2947 } else {
2948 leftCurve = curvePartialByID(test, frags[0], frags[4], f rags[5]);
2949 midCurve = curvePartialByID(test, frags[6], frags[10], f rags[11]);
2950 rightCurve = curvePartialByID(test, frags[12], frags[16] , frags[17]);
2951 }
2952 drawCurve(leftCurve);
2953 drawCurve(rightCurve);
2954 var inBetween = frags[fragType == ANGLE_AFTER ? 15 : 18] == "T";
2955 ctx.strokeStyle = inBetween ? "rgba(0,160,45, 0.3)" : "rgba( 255,0,45, 0.5)";
2956 drawCurve(midCurve);
2957 if (draw_angle > 1) {
2958 drawOrder(leftCurve, 'L');
2959 drawOrder(rightCurve, 'R');
2960 }
2961 break;
2962 case REC_TYPE_SECT:
2963 if (!draw_intersection) {
2964 continue;
2965 }
2966 if (draw_intersection != 1 && (step_limit > 0 && tIndex < la stSect)) {
2967 continue;
2968 }
2969 // draw_intersection == 1 : show all
2970 // draw_intersection == 2 : step == 0 ? show all : show inte rsection line #step
2971 // draw_intersection == 3 : step == 0 ? show all : show inte rsection #step
2972 ctx.lineWidth = 1;
2973 ctx.strokeStyle = "rgba(0,0,255, 0.3)";
2974 ctx.fillStyle = "blue";
2975 focus_enabled = true;
2976 var f = [];
2977 var c1s;
2978 var c1l;
2979 var c2s;
2980 var c2l;
2981 switch (fragType) {
2982 case INTERSECT_LINE:
2983 f.push(5, 6, 0, 7);
2984 c1s = 1; c1l = 4; c2s = 8; c2l = 4;
2985 break;
2986 case INTERSECT_LINE_2:
2987 f.push(5, 6, 0, 10);
2988 f.push(8, 9, 7, 15);
2989 c1s = 1; c1l = 4; c2s = 11; c2l = 4;
2990 break;
2991 case INTERSECT_LINE_NO:
2992 c1s = 0; c1l = 4; c2s = 4; c2l = 4;
2993 break;
2994 case INTERSECT_QUAD_LINE:
2995 f.push(7, 8, 0, 9);
2996 c1s = 1; c1l = 6; c2s = 10; c2l = 4;
2997 break;
2998 case INTERSECT_QUAD_LINE_2:
2999 f.push(7, 8, 0, 12);
3000 f.push(10, 11, 9, 17);
3001 c1s = 1; c1l = 6; c2s = 13; c2l = 4;
3002 break;
3003 case INTERSECT_QUAD_LINE_NO:
3004 c1s = 0; c1l = 6; c2s = 6; c2l = 4;
3005 break;
3006 case INTERSECT_QUAD:
3007 f.push(7, 8, 0, 9);
3008 c1s = 1; c1l = 6; c2s = 10; c2l = 6;
3009 break;
3010 case INTERSECT_QUAD_2:
3011 f.push(7, 8, 0, 12);
3012 f.push(10, 11, 9, 19);
3013 c1s = 1; c1l = 6; c2s = 13; c2l = 6;
3014 break;
3015 case INTERSECT_QUAD_NO:
3016 c1s = 0; c1l = 6; c2s = 6; c2l = 6;
3017 break;
3018 case INTERSECT_SELF_CUBIC:
3019 f.push(9, 10, 0, 11);
3020 c1s = 1; c1l = 8; c2s = 0; c2l = 0;
3021 break;
3022 case INTERSECT_SELF_CUBIC_NO:
3023 c1s = 0; c1l = 8; c2s = 0; c2l = 0;
3024 break;
3025 case INTERSECT_CUBIC_LINE:
3026 f.push(9, 10, 0, 11);
3027 c1s = 1; c1l = 8; c2s = 12; c2l = 4;
3028 break;
3029 case INTERSECT_CUBIC_LINE_2:
3030 f.push(9, 10, 0, 14);
3031 f.push(12, 13, 11, 19);
3032 c1s = 1; c1l = 8; c2s = 15; c2l = 4;
3033 break;
3034 case INTERSECT_CUBIC_LINE_3:
3035 f.push(9, 10, 0, 17);
3036 f.push(12, 13, 11, 22);
3037 f.push(15, 16, 14, 23);
3038 c1s = 1; c1l = 8; c2s = 18; c2l = 4;
3039 break;
3040 case INTERSECT_CUBIC_QUAD_NO:
3041 c1s = 0; c1l = 8; c2s = 8; c2l = 6;
3042 break;
3043 case INTERSECT_CUBIC_QUAD:
3044 f.push(9, 10, 0, 11);
3045 c1s = 1; c1l = 8; c2s = 12; c2l = 6;
3046 break;
3047 case INTERSECT_CUBIC_QUAD_2:
3048 f.push(9, 10, 0, 14);
3049 f.push(12, 13, 11, 21);
3050 c1s = 1; c1l = 8; c2s = 15; c2l = 6;
3051 break;
3052 case INTERSECT_CUBIC_QUAD_3:
3053 f.push(9, 10, 0, 17);
3054 f.push(12, 13, 11, 24);
3055 f.push(15, 16, 14, 25);
3056 c1s = 1; c1l = 8; c2s = 18; c2l = 6;
3057 break;
3058 case INTERSECT_CUBIC_QUAD_4:
3059 f.push(9, 10, 0, 20);
3060 f.push(12, 13, 11, 27);
3061 f.push(15, 16, 14, 28);
3062 f.push(18, 19, 17, 29);
3063 c1s = 1; c1l = 8; c2s = 21; c2l = 6;
3064 break;
3065 case INTERSECT_CUBIC_LINE_NO:
3066 c1s = 0; c1l = 8; c2s = 8; c2l = 4;
3067 break;
3068 case INTERSECT_CUBIC:
3069 f.push(9, 10, 0, 11);
3070 c1s = 1; c1l = 8; c2s = 12; c2l = 8;
3071 break;
3072 case INTERSECT_CUBIC_2:
3073 f.push(9, 10, 0, 14);
3074 f.push(12, 13, 11, 23);
3075 c1s = 1; c1l = 8; c2s = 15; c2l = 8;
3076 break;
3077 case INTERSECT_CUBIC_3:
3078 f.push(9, 10, 0, 17);
3079 f.push(12, 13, 11, 26);
3080 f.push(15, 16, 14, 27);
3081 c1s = 1; c1l = 8; c2s = 18; c2l = 8;
3082 break;
3083 case INTERSECT_CUBIC_4:
3084 f.push(9, 10, 0, 20);
3085 f.push(12, 13, 11, 29);
3086 f.push(15, 16, 14, 30);
3087 f.push(18, 19, 17, 31);
3088 c1s = 1; c1l = 8; c2s = 21; c2l = 8;
3089 break;
3090 case INTERSECT_CUBIC_NO:
3091 c1s = 0; c1l = 8; c2s = 8; c2l = 8;
3092 break;
3093 default:
3094 console.log("unknown REC_TYPE_SECT frag type: " + fr agType);
3095 throw "stop execution";
3096 }
3097 if (draw_intersection != 1) {
3098 var id = -1;
3099 var curve;
3100 switch (c1l) {
3101 case 4:
3102 drawLine(frags[c1s], frags[c1s + 1], frags[c1s + 2], frags[c1s + 3]);
3103 if (draw_id) {
3104 curve = [frags[c1s], frags[c1s + 1], frags[c 1s + 2], frags[c1s + 3]];
3105 id = idByCurve(test, curve, PATH_LINE);
3106 }
3107 break;
3108 case 6:
3109 drawQuad(frags[c1s], frags[c1s + 1], frags[c1s + 2], frags[c1s + 3],
3110 frags[c1s + 4], frags[c1s + 5]);
3111 if (draw_id) {
3112 curve = [frags[c1s], frags[c1s + 1], frags[c 1s + 2], frags[c1s + 3],
3113 frags[c1s + 4], frags[c1s + 5]];
3114 id = idByCurve(test, curve, PATH_QUAD);
3115 }
3116 break;
3117 case 8:
3118 drawCubic(frags[c1s], frags[c1s + 1], frags[c1s + 2], frags[c1s + 3],
3119 frags[c1s + 4], frags[c1s + 5], frags[c1 s + 6], frags[c1s + 7]);
3120 if (draw_id) {
3121 curve = [frags[c1s], frags[c1s + 1], frags[c 1s + 2], frags[c1s + 3],
3122 frags[c1s + 4], frags[c1s + 5], frag s[c1s + 6], frags[c1s + 7]];
3123 id = idByCurve(test, curve, PATH_CUBIC);
3124 }
3125 break;
3126 }
3127 if (id >= 0) {
3128 drawID(curve, id);
3129 }
3130 id = -1;
3131 switch (c2l) {
3132 case 0:
3133 break;
3134 case 4:
3135 drawLine(frags[c2s], frags[c2s + 1], frags[c2s + 2], frags[c2s + 3]);
3136 if (draw_id) {
3137 curve = [frags[c2s], frags[c2s + 1], frags[c 2s + 2], frags[c2s + 3]];
3138 id = idByCurve(test, curve, PATH_LINE);
3139 }
3140 break;
3141 case 6:
3142 drawQuad(frags[c2s], frags[c2s + 1], frags[c2s + 2], frags[c2s + 3],
3143 frags[c2s + 4], frags[c2s + 5]);
3144 if (draw_id) {
3145 curve = [frags[c2s], frags[c2s + 1], frags[c 2s + 2], frags[c2s + 3],
3146 frags[c2s + 4], frags[c2s + 5]];
3147 id = idByCurve(test, curve, PATH_QUAD);
3148 }
3149 break;
3150 case 8:
3151 drawCubic(frags[c2s], frags[c2s + 1], frags[c2s + 2], frags[c2s + 3],
3152 frags[c2s + 4], frags[c2s + 5], frags[c2 s + 6], frags[c2s + 7]);
3153 if (draw_id) {
3154 curve = [frags[c2s], frags[c2s + 1], frags[c 2s + 2], frags[c2s + 3],
3155 frags[c2s + 4], frags[c2s + 5], frag s[c2s + 6], frags[c2s + 7]];
3156 id = idByCurve(test, curve, PATH_CUBIC);
3157 }
3158 break;
3159 }
3160 if (id >= 0) {
3161 drawID(curve, id);
3162 }
3163 }
3164 if (collect_bounds) {
3165 break;
3166 }
3167 for (var idx = 0; idx < f.length; idx += 4) {
3168 if (draw_intersection != 3 || idx == lastSect - tIndex) {
3169 drawPoint(frags[f[idx]], frags[f[idx + 1]], true);
3170 }
3171 }
3172 if (!draw_intersectT) {
3173 break;
3174 }
3175 ctx.fillStyle = "red";
3176 for (var idx = 0; idx < f.length; idx += 4) {
3177 if (draw_intersection != 3 || idx == lastSect - tIndex) {
3178 drawTAtPointUp(frags[f[idx]], frags[f[idx + 1]], fra gs[f[idx + 2]]);
3179 drawTAtPointDown(frags[f[idx]], frags[f[idx + 1]], f rags[f[idx + 3]]);
3180 }
3181 }
3182 break;
3183 case REC_TYPE_SORT:
3184 if (!draw_sort || (step_limit > 0 && tIndex < lastSort)) {
3185 continue;
3186 }
3187 ctx.lineWidth = 3;
3188 ctx.strokeStyle = "rgba(127,127,0, 0.5)";
3189 focus_enabled = true;
3190 switch (fragType) {
3191 case SORT_UNARY:
3192 case SORT_BINARY:
3193 var curve = curvePartialByID(test, frags[0], frags[6 ], frags[8]);
3194 drawCurve(curve);
3195 break;
3196 default:
3197 console.log("unknown REC_TYPE_SORT frag type: " + fr agType);
3198 throw "stop execution";
3199 }
3200 break;
3201 case REC_TYPE_MARK:
3202 if (!draw_mark || (step_limit > 0 && tIndex < lastMark)) {
3203 continue;
3204 }
3205 ctx.lineWidth = 3;
3206 ctx.strokeStyle = fragType >= MARK_DONE_LINE ?
3207 "rgba(127,0,127, 0.5)" : "rgba(127,127,0, 0.5)";
3208 focus_enabled = true;
3209 switch (fragType) {
3210 case MARK_LINE:
3211 case MARK_DONE_LINE:
3212 case MARK_UNSORTABLE_LINE:
3213 case MARK_SIMPLE_LINE:
3214 case MARK_SIMPLE_DONE_LINE:
3215 case MARK_DONE_UNARY_LINE:
3216 drawLinePartial(frags[1], frags[2], frags[3], frags[ 4],
3217 frags[5], frags[9]);
3218 if (draw_id) {
3219 drawLinePartialID(frags[0], frags[1], frags[2], frags[3], frags[4],
3220 frags[5], frags[9]);
3221 }
3222 break;
3223 case MARK_QUAD:
3224 case MARK_DONE_QUAD:
3225 case MARK_UNSORTABLE_QUAD:
3226 case MARK_SIMPLE_QUAD:
3227 case MARK_SIMPLE_DONE_QUAD:
3228 case MARK_DONE_UNARY_QUAD:
3229 drawQuadPartial(frags[1], frags[2], frags[3], frags[ 4],
3230 frags[5], frags[6], frags[7], frags[11]);
3231 if (draw_id) {
3232 drawQuadPartialID(frags[0], frags[1], frags[2], frags[3], frags[4],
3233 frags[5], frags[6], frags[7], frags[11]);
3234 }
3235 break;
3236 case MARK_CUBIC:
3237 case MARK_DONE_CUBIC:
3238 case MARK_UNSORTABLE_CUBIC:
3239 case MARK_SIMPLE_CUBIC:
3240 case MARK_SIMPLE_DONE_CUBIC:
3241 case MARK_DONE_UNARY_CUBIC:
3242 drawCubicPartial(frags[1], frags[2], frags[3], frags [4],
3243 frags[5], frags[6], frags[7], frags[8], frags[9] , frags[13]);
3244 if (draw_id) {
3245 drawCubicPartialID(frags[0], frags[1], frags[2], frags[3], frags[4],
3246 frags[5], frags[6], frags[7], frags[8], frags[9] , frags[13]);
3247 }
3248 break;
3249 case MARK_ANGLE_LAST:
3250 // FIXME: ignored for now
3251 break;
3252 default:
3253 console.log("unknown REC_TYPE_MARK frag type: " + fr agType);
3254 throw "stop execution";
3255 }
3256 break;
3257 default:
3258 continue;
3259 }
3260 }
3261 switch (recType) {
3262 case REC_TYPE_SORT:
3263 if (!draw_sort || (step_limit > 0 && tIndex < lastSort)) {
3264 break;
3265 }
3266 var angles = []; // use tangent lines to describe arcs
3267 var windFrom = [];
3268 var windTo = [];
3269 var opp = [];
3270 var minXY = Number.MAX_VALUE;
3271 var partial;
3272 focus_enabled = true;
3273 var someUnsortable = false;
3274 for (var recordIndex = 0; recordIndex < records.length; recordIn dex += 2) {
3275 var fragType = records[recordIndex];
3276 var frags = records[recordIndex + 1];
3277 var unsortable = (fragType == SORT_UNARY && frags[14]) ||
3278 (fragType == SORT_BINARY && frags[16]);
3279 someUnsortable |= unsortable;
3280 switch (fragType) {
3281 case SORT_UNARY:
3282 case SORT_BINARY:
3283 partial = curvePartialByID(test, frags[0], frags[6], frags[8]);
3284 break;
3285 default:
3286 console.log("unknown REC_TYPE_SORT frag type: " + fr agType);
3287 throw "stop execution";
3288 }
3289 var dx = boundsWidth(partial);
3290 var dy = boundsHeight(partial);
3291 minXY = Math.min(minXY, dx * dx + dy * dy);
3292 if (collect_bounds) {
3293 continue;
3294 }
3295 angles.push(tangent(partial));
3296 var from = frags[12];
3297 var to = frags[12];
3298 var sgn = frags[10];
3299 if (sgn < 0) {
3300 from -= frags[11];
3301 } else if (sgn > 0) {
3302 to -= frags[11];
3303 }
3304 windFrom.push(from + (unsortable ? "!" : ""));
3305 windTo.push(to + (unsortable ? "!" : ""));
3306 opp.push(fragType == SORT_BINARY);
3307 if (draw_sort == 1) {
3308 drawOrder(partial, frags[12]);
3309 } else {
3310 drawOrder(partial, (recordIndex / 2) + 1);
3311 }
3312 }
3313 var radius = Math.sqrt(minXY) / 2 * scale;
3314 radius = Math.min(50, radius);
3315 var scaledRadius = radius / scale;
3316 var centerX = partial[0];
3317 var centerY = partial[1];
3318 if (collect_bounds) {
3319 if (focus_enabled) {
3320 focusXmin = Math.min(focusXmin, centerX - scaledRadius);
3321 focusYmin = Math.min(focusYmin, centerY - scaledRadius);
3322 focusXmax = Math.max(focusXmax, centerX + scaledRadius);
3323 focusYmax = Math.max(focusYmax, centerY + scaledRadius);
3324 }
3325 break;
3326 }
3327 break;
3328 default:
3329 break;
3330 }
3331 }
3332 if (collect_bounds) {
3333 return;
3334 }
3335 if (draw_log && logStart >= 0) {
3336 ctx.font = "normal 10px Arial";
3337 ctx.textAlign = "left";
3338 ctx.beginPath();
3339 var top = screenHeight - 20 - (logRange + 2) * 10;
3340 ctx.rect(50, top, screenWidth - 100, (logRange + 2) * 10);
3341 ctx.fillStyle = "white";
3342 ctx.fill();
3343 ctx.fillStyle = "rgba(0,0,0, 0.5)";
3344 if (logStart > 0) {
3345 ctx.fillText(lines[logStart - 1], 50, top + 8);
3346 }
3347 ctx.fillStyle = "black";
3348 for (var idx = 0; idx < logRange; ++idx) {
3349 ctx.fillText(lines[logStart + idx], 50, top + 18 + 10 * idx);
3350 }
3351 ctx.fillStyle = "rgba(0,0,0, 0.5)";
3352 if (logStart + logRange < lines.length) {
3353 ctx.fillText(lines[logStart + logRange], 50, top + 18 + 10 * logRang e);
3354 }
3355 }
3356 if (draw_legend) {
3357 var pos = 0;
3358 var drawSomething = draw_add | draw_active | draw_sort | draw_mark;
3359 // drawBox(pos++, "yellow", "black", opLetter, true, '');
3360 drawBox(pos++, "rgba(0,0,255, 0.3)", "black", draw_intersection > 1 ? se ctCount : sectMax2, draw_intersection, intersectionKey);
3361 drawBox(pos++, "rgba(0,0,255, 0.3)", "black", draw_add ? addCount : addM ax, draw_add, addKey);
3362 drawBox(pos++, "rgba(0,0,255, 0.3)", "black", draw_active ? activeCount : activeMax, draw_active, activeKey);
3363 drawBox(pos++, "rgba(127,127,0, 0.3)", "black", draw_angle ? angleCount : angleMax, draw_angle, angleKey);
3364 drawBox(pos++, "rgba(127,127,0, 0.3)", "black", draw_op ? opCount : opMa x, draw_op, opKey);
3365 drawBox(pos++, "rgba(127,127,0, 0.3)", "black", draw_sort ? sortCount : sortMax, draw_sort, sortKey);
3366 drawBox(pos++, "rgba(127,0,127, 0.3)", "black", draw_mark ? markCount : markMax, draw_mark, markKey);
3367 drawBox(pos++, "black", "white",
3368 (new Array('P', 'P1', 'P2', 'P'))[draw_path], draw_path != 0, pa thKey);
3369 drawBox(pos++, "rgba(0,63,0, 0.7)", "white",
3370 (new Array('Q', 'Q', 'C', 'QC', 'Qc', 'Cq'))[draw_computed],
3371 draw_computed != 0, computedKey);
3372 drawBox(pos++, "green", "black", step_limit, drawSomething, '');
3373 drawBox(pos++, "green", "black", stepMax, drawSomething, '');
3374 drawBox(pos++, "rgba(255,0,0, 0.6)", "black", lastIndex, drawSomething & draw_log, '');
3375 drawBox(pos++, "rgba(255,0,0, 0.6)", "black", test.length - 1, drawSomet hing & draw_log, '');
3376 if (curve_t) {
3377 drawCurveTControl();
3378 }
3379 ctx.font = "normal 20px Arial";
3380 ctx.fillStyle = "rgba(0,0,0, 0.3)";
3381 ctx.textAlign = "right";
3382 ctx.fillText(scale.toFixed(decimal_places) + 'x' , screenWidth - 10, scr eenHeight - 5);
3383 }
3384 if (draw_hints) {
3385 ctx.font = "normal 10px Arial";
3386 ctx.fillStyle = "rgba(0,0,0, 0.5)";
3387 ctx.textAlign = "right";
3388 var y = 4;
3389 ctx.fillText("control lines : " + controlLinesKey, ctx.screenWidthwidth - 10, pos * 50 + y++ * 10);
3390 ctx.fillText("curve t : " + curveTKey, screenWidth - 10, pos * 50 + y++ * 10);
3391 ctx.fillText("deriviatives : " + deriviativesKey, screenWidth - 10, pos * 50 + y++ * 10);
3392 ctx.fillText("intersect t : " + intersectTKey, screenWidth - 10, pos * 50 + y++ * 10);
3393 ctx.fillText("hodo : " + hodoKey, screenWidth - 10, pos * 50 + y++ * 10 );
3394 ctx.fillText("log : " + logKey, screenWidth - 10, pos * 50 + y++ * 10);
3395 ctx.fillText("log curve : " + logCurvesKey, screenWidth - 10, pos * 50 + y++ * 10);
3396 ctx.fillText("mid point : " + midpointKey, screenWidth - 10, pos * 50 + y++ * 10);
3397 ctx.fillText("points : " + ptsKey, screenWidth - 10, pos * 50 + y++ * 1 0);
3398 ctx.fillText("sequence : " + sequenceKey, screenWidth - 10, pos * 50 + y++ * 10);
3399 ctx.fillText("xy : " + xyKey, screenWidth - 10, pos * 50 + y++ * 10);
3400 }
3401 }
3402
3403 function drawBox(y, backC, foreC, str, enable, label) {
3404 ctx.beginPath();
3405 ctx.fillStyle = backC;
3406 ctx.rect(screenWidth - 40, y * 50 + 10, 40, 30);
3407 ctx.fill();
3408 ctx.font = "normal 16px Arial";
3409 ctx.fillStyle = foreC;
3410 ctx.textAlign = "center";
3411 ctx.fillText(str, screenWidth - 20, y * 50 + 32);
3412 if (!enable) {
3413 ctx.fillStyle = "rgba(255,255,255, 0.5)";
3414 ctx.fill();
3415 }
3416 if (label != '') {
3417 ctx.font = "normal 9px Arial";
3418 ctx.fillStyle = "black";
3419 ctx.fillText(label, screenWidth - 47, y * 50 + 40);
3420 }
3421 }
3422
3423 function drawCurveTControl() {
3424 ctx.lineWidth = 2;
3425 ctx.strokeStyle = "rgba(0,0,0, 0.3)";
3426 ctx.beginPath();
3427 ctx.rect(screenWidth - 80, 40, 28, screenHeight - 80);
3428 ctx.stroke();
3429 var ty = 40 + curveT * (screenHeight - 80);
3430 ctx.beginPath();
3431 ctx.moveTo(screenWidth - 80, ty);
3432 ctx.lineTo(screenWidth - 85, ty - 5);
3433 ctx.lineTo(screenWidth - 85, ty + 5);
3434 ctx.lineTo(screenWidth - 80, ty);
3435 ctx.fillStyle = "rgba(0,0,0, 0.6)";
3436 ctx.fill();
3437 var num = curveT.toFixed(decimal_places);
3438 ctx.font = "normal 10px Arial";
3439 ctx.textAlign = "left";
3440 ctx.fillText(num, screenWidth - 78, ty);
3441 }
3442
3443 function ptInTControl() {
3444 var e = window.event;
3445 var tgt = e.target || e.srcElement;
3446 var left = tgt.offsetLeft;
3447 var top = tgt.offsetTop;
3448 var x = (e.clientX - left);
3449 var y = (e.clientY - top);
3450 if (x < screenWidth - 80 || x > screenWidth - 50) {
3451 return false;
3452 }
3453 if (y < 40 || y > screenHeight - 80) {
3454 return false;
3455 }
3456 curveT = (y - 40) / (screenHeight - 120);
3457 if (curveT < 0 || curveT > 1) {
3458 throw "stop execution";
3459 }
3460 return true;
3461 }
3462
3463 function drawTop() {
3464 if (tests[testIndex] == null) {
3465 var str = testDivs[testIndex].textContent;
3466 parse_all(str);
3467 var title = testDivs[testIndex].id.toString();
3468 testTitles[testIndex] = title;
3469 }
3470 init(tests[testIndex]);
3471 redraw();
3472 }
3473
3474 function redraw() {
3475 if (focus_on_selection) {
3476 collect_bounds = true;
3477 draw(tests[testIndex], testLines[testIndex], testTitles[testIndex]);
3478 collect_bounds = false;
3479 if (focusXmin < focusXmax && focusYmin < focusYmax) {
3480 setScale(focusXmin, focusXmax, focusYmin, focusYmax);
3481 }
3482 }
3483 ctx.beginPath();
3484 ctx.fillStyle = "white";
3485 ctx.rect(0, 0, screenWidth, screenHeight);
3486 ctx.fill();
3487 draw(tests[testIndex], testLines[testIndex], testTitles[testIndex]);
3488 }
3489
3490 function dumpCurvePartial(test, id, t0, t1) {
3491 var curve = curveByID(test, id);
3492 var name = ["line", "quad", "cubic"][curve.length / 2 - 2];
3493 console.log("id=" + id + " " + name + "=" + curveToString(curve)
3494 + " t0=" + t0 + " t1=" + t1
3495 + " partial=" + curveToString(curvePartialByID(test, id, t0, t1)));
3496 }
3497
3498 function dumpAngleTest(test, id, t0, t1) {
3499 var curve = curveByID(test, id);
3500 console.log(" { {" + curveToString(curve) + "}, "
3501 + curve.length / 2 + ", " + t0 + ", " + t1 + ", {} }, //");
3502 }
3503
3504 function dumpLogToConsole() {
3505 if (logStart < 0) {
3506 return;
3507 }
3508 var test = tests[testIndex];
3509 var recType = REC_TYPE_UNKNOWN;
3510 var records;
3511 for (var index = 0; index < test.length; index += 3) {
3512 var lastLineNo = test[index + 1];
3513 if (lastLineNo >= logStart && lastLineNo < logStart + logRange) {
3514 recType = test[index];
3515 records = test[index + 2];
3516 break;
3517 }
3518 }
3519 if (recType == REC_TYPE_UNKNOWN) {
3520 return;
3521 }
3522 var lines = testLines[testIndex];
3523 for (var idx = 0; idx < logRange; ++idx) {
3524 var line = lines[logStart + idx];
3525 console.log(line);
3526 for (var recordIndex = 0; recordIndex < records.length; recordIndex += 2 ) {
3527 var fragType = records[recordIndex];
3528 var frags = records[recordIndex + 1];
3529 if (recType == REC_TYPE_ANGLE && fragType == ANGLE_AFTER) {
3530 dumpCurvePartial(test, frags[0], frags[3], frags[4]);
3531 dumpCurvePartial(test, frags[5], frags[8], frags[9]);
3532 dumpCurvePartial(test, frags[10], frags[13], frags[14]);
3533 console.log("\nstatic IntersectData intersectDataSet[] = {");
3534 dumpAngleTest(test, frags[0], frags[3], frags[4]);
3535 dumpAngleTest(test, frags[5], frags[8], frags[9]);
3536 dumpAngleTest(test, frags[10], frags[13], frags[14]);
3537 console.log("};");
3538 } else if (recType == REC_TYPE_ANGLE && fragType == ANGLE_AFTER2) {
3539 dumpCurvePartial(test, frags[0], frags[4], frags[5]);
3540 dumpCurvePartial(test, frags[6], frags[10], frags[11]);
3541 dumpCurvePartial(test, frags[12], frags[16], frags[17]);
3542 console.log("\nstatic IntersectData intersectDataSet[] = { //");
3543 dumpAngleTest(test, frags[0], frags[4], frags[5]);
3544 dumpAngleTest(test, frags[6], frags[10], frags[11]);
3545 dumpAngleTest(test, frags[12], frags[16], frags[17]);
3546 console.log("}; //");
3547 }
3548 }
3549 }
3550 }
3551
3552 var activeKey = 'a';
3553 var pathKey = 'b';
3554 var pathBackKey = 'B';
3555 var centerKey = 'c';
3556 var addKey = 'd';
3557 var deriviativesKey = 'f';
3558 var angleKey = 'g';
3559 var angleBackKey = 'G';
3560 var hodoKey = 'h';
3561 var intersectionKey = 'i';
3562 var intersectionBackKey = 'I';
3563 var sequenceKey = 'j';
3564 var midpointKey = 'k';
3565 var logKey = 'l';
3566 var logToConsoleKey = 'L';
3567 var markKey = 'm';
3568 var sortKey = 'o';
3569 var opKey = 'p';
3570 var opBackKey = 'P';
3571 var computedKey = 'q';
3572 var computedBackKey = 'Q';
3573 var stepKey = 's';
3574 var stepBackKey = 'S';
3575 var intersectTKey = 't';
3576 var curveTKey = 'u';
3577 var controlLinesBackKey = 'V';
3578 var controlLinesKey = 'v';
3579 var ptsKey = 'x';
3580 var xyKey = 'y';
3581 var logCurvesKey = 'z';
3582 var focusKey = '`';
3583 var idKey = '.';
3584 var retinaKey = '\\';
3585
3586 function doKeyPress(evt) {
3587 var char = String.fromCharCode(evt.charCode);
3588 var focusWasOn = false;
3589 switch (char) {
3590 case '0':
3591 case '1':
3592 case '2':
3593 case '3':
3594 case '4':
3595 case '5':
3596 case '6':
3597 case '7':
3598 case '8':
3599 case '9':
3600 decimal_places = char - '0';
3601 redraw();
3602 break;
3603 case activeKey:
3604 draw_active ^= true;
3605 redraw();
3606 break;
3607 case addKey:
3608 draw_add ^= true;
3609 redraw();
3610 break;
3611 case angleKey:
3612 draw_angle = (draw_angle + 1) % 3;
3613 redraw();
3614 break;
3615 case angleBackKey:
3616 draw_angle = (draw_angle + 2) % 3;
3617 redraw();
3618 break;
3619 case centerKey:
3620 setScale(xmin, xmax, ymin, ymax);
3621 redraw();
3622 break;
3623 case controlLinesBackKey:
3624 control_lines = (control_lines + 3) % 4;
3625 redraw();
3626 break;
3627 case controlLinesKey:
3628 control_lines = (control_lines + 1) % 4;
3629 redraw();
3630 break;
3631 case computedBackKey:
3632 draw_computed = (draw_computed + 5) % 6;
3633 redraw();
3634 break;
3635 case computedKey:
3636 draw_computed = (draw_computed + 1) % 6;
3637 redraw();
3638 break;
3639 case curveTKey:
3640 curve_t ^= true;
3641 if (curve_t) {
3642 draw_legend = true;
3643 }
3644 redraw();
3645 break;
3646 case deriviativesKey:
3647 draw_deriviatives = (draw_deriviatives + 1) % 3;
3648 redraw();
3649 break;
3650 case focusKey:
3651 focus_on_selection ^= true;
3652 setScale(xmin, xmax, ymin, ymax);
3653 redraw();
3654 break;
3655 case hodoKey:
3656 draw_hodo = (draw_hodo + 1) % 4;
3657 redraw();
3658 break;
3659 case idKey:
3660 draw_id ^= true;
3661 redraw();
3662 break;
3663 case intersectionBackKey:
3664 draw_intersection = (draw_intersection + 3) % 4;
3665 redraw();
3666 break;
3667 case intersectionKey:
3668 draw_intersection = (draw_intersection + 1) % 4;
3669 redraw();
3670 break;
3671 case intersectTKey:
3672 draw_intersectT ^= true;
3673 redraw();
3674 break;
3675 case logCurvesKey:
3676 logCurves(tests[testIndex]);
3677 break;
3678 case logKey:
3679 draw_log ^= true;
3680 redraw();
3681 break;
3682 case logToConsoleKey:
3683 if (draw_log) {
3684 dumpLogToConsole();
3685 }
3686 break;
3687 case markKey:
3688 draw_mark ^= true;
3689 redraw();
3690 break;
3691 case midpointKey:
3692 draw_midpoint ^= true;
3693 redraw();
3694 break;
3695 case opKey:
3696 draw_op = (draw_op + 1) % 3;
3697 redraw();
3698 break;
3699 case opBackKey:
3700 draw_op = (draw_op + 2) % 3;
3701 redraw();
3702 break;
3703 case pathKey:
3704 draw_path = (draw_path + 1) % 4;
3705 redraw();
3706 break;
3707 case pathBackKey:
3708 draw_path = (draw_path + 3) % 4;
3709 redraw();
3710 break;
3711 case ptsKey:
3712 pt_labels = (pt_labels + 1) % 3;
3713 redraw();
3714 break;
3715 case retinaKey:
3716 retina_scale ^= true;
3717 drawTop();
3718 break;
3719 case sequenceKey:
3720 draw_sequence ^= true;
3721 redraw();
3722 break;
3723 case sortKey:
3724 draw_sort = (draw_sort + 1) % 3;
3725 drawTop();
3726 break;
3727 case stepKey:
3728 step_limit++;
3729 if (step_limit > stepMax) {
3730 step_limit = stepMax;
3731 }
3732 redraw();
3733 break;
3734 case stepBackKey:
3735 step_limit--;
3736 if (step_limit < 0) {
3737 step_limit = 0;
3738 }
3739 redraw();
3740 break;
3741 case xyKey:
3742 debug_xy = (debug_xy + 1) % 3;
3743 redraw();
3744 break;
3745 case '-':
3746 focusWasOn = focus_on_selection;
3747 if (focusWasOn) {
3748 focus_on_selection = false;
3749 scale /= 1.2;
3750 } else {
3751 scale /= 2;
3752 calcLeftTop();
3753 }
3754 redraw();
3755 focus_on_selection = focusWasOn;
3756 break;
3757 case '=':
3758 case '+':
3759 focusWasOn = focus_on_selection;
3760 if (focusWasOn) {
3761 focus_on_selection = false;
3762 scale *= 1.2;
3763 } else {
3764 scale *= 2;
3765 calcLeftTop();
3766 }
3767 redraw();
3768 focus_on_selection = focusWasOn;
3769 break;
3770 case '?':
3771 draw_hints ^= true;
3772 if (draw_hints && !draw_legend) {
3773 draw_legend = true;
3774 }
3775 redraw();
3776 break;
3777 case '/':
3778 draw_legend ^= true;
3779 redraw();
3780 break;
3781 }
3782 }
3783
3784 function doKeyDown(evt) {
3785 var char = evt.keyCode;
3786 var preventDefault = false;
3787 switch (char) {
3788 case 37: // left arrow
3789 if (evt.shiftKey) {
3790 testIndex -= 9;
3791 }
3792 if (--testIndex < 0)
3793 testIndex = tests.length - 1;
3794 drawTop();
3795 preventDefault = true;
3796 break;
3797 case 39: // right arrow
3798 if (evt.shiftKey) {
3799 testIndex += 9;
3800 }
3801 if (++testIndex >= tests.length)
3802 testIndex = 0;
3803 drawTop();
3804 preventDefault = true;
3805 break;
3806 }
3807 if (preventDefault) {
3808 evt.preventDefault();
3809 return false;
3810 }
3811 return true;
3812 }
3813
3814 (function() {
3815 var hidden = "hidden";
3816
3817 // Standards:
3818 if (hidden in document)
3819 document.addEventListener("visibilitychange", onchange);
3820 else if ((hidden = "mozHidden") in document)
3821 document.addEventListener("mozvisibilitychange", onchange);
3822 else if ((hidden = "webkitHidden") in document)
3823 document.addEventListener("webkitvisibilitychange", onchange);
3824 else if ((hidden = "msHidden") in document)
3825 document.addEventListener("msvisibilitychange", onchange);
3826 // IE 9 and lower:
3827 else if ('onfocusin' in document)
3828 document.onfocusin = document.onfocusout = onchange;
3829 // All others:
3830 else
3831 window.onpageshow = window.onpagehide
3832 = window.onfocus = window.onblur = onchange;
3833
3834 function onchange (evt) {
3835 var v = 'visible', h = 'hidden',
3836 evtMap = {
3837 focus:v, focusin:v, pageshow:v, blur:h, focusout:h, pagehide:h
3838 };
3839
3840 evt = evt || window.event;
3841 if (evt.type in evtMap)
3842 document.body.className = evtMap[evt.type];
3843 else
3844 document.body.className = this[hidden] ? "hidden" : "visible";
3845 }
3846 })();
3847
3848 function calcXY() {
3849 var e = window.event;
3850 var tgt = e.target || e.srcElement;
3851 var left = tgt.offsetLeft;
3852 var top = tgt.offsetTop;
3853 mouseX = (e.clientX - left) / scale + srcLeft;
3854 mouseY = (e.clientY - top) / scale + srcTop;
3855 }
3856
3857 function calcLeftTop() {
3858 srcLeft = mouseX - screenWidth / 2 / scale;
3859 srcTop = mouseY - screenHeight / 2 / scale;
3860 }
3861
3862 var disableClick = false;
3863
3864 function handleMouseClick() {
3865 if (disableClick) {
3866 return;
3867 }
3868 if (!curve_t || !ptInTControl()) {
3869 calcXY();
3870 calcLeftTop();
3871 }
3872 redraw();
3873 // if (!curve_t || !ptInTControl()) {
3874 // mouseX = screenWidth / 2 / scale + srcLeft;
3875 // mouseY = screenHeight / 2 / scale + srcTop;
3876 // }
3877 }
3878
3879 function handleMouseOver() {
3880 calcXY();
3881 if (debug_xy != 2) {
3882 return;
3883 }
3884 var num = mouseX.toFixed(decimal_places) + ", " + mouseY.toFixed(decimal_pla ces);
3885 ctx.beginPath();
3886 ctx.rect(300,100,num.length * 6,10);
3887 ctx.fillStyle="white";
3888 ctx.fill();
3889 ctx.font = "normal 10px Arial";
3890 ctx.fillStyle="black";
3891 ctx.textAlign = "left";
3892 ctx.fillText(num, 300, 108);
3893 }
3894
3895 function start() {
3896 for (var i = 0; i < testDivs.length; ++i) {
3897 tests[i] = null;
3898 }
3899 testIndex = 0;
3900 drawTop();
3901 window.addEventListener('keypress', doKeyPress, true);
3902 window.addEventListener('keydown', doKeyDown, true);
3903 window.onresize = function() {
3904 drawTop();
3905 }
3906 /*
3907 window.onpagehide = function() {
3908 disableClick = true;
3909 }
3910 */
3911 window.onpageshow = function () {
3912 disableClick = false;
3913 }
3914 }
3915
3916 </script>
3917 </head>
3918
3919 <body onLoad="start();">
3920 <canvas id="canvas" width="750" height="500"
3921 onmousemove="handleMouseOver()"
3922 onclick="handleMouseClick()"
3923 ></canvas >
3924 </body>
3925 </html>
OLDNEW
« no previous file with comments | « tools/pathops_sorter.htm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698