blob: 43dceb47578e40a48f4c19ee2a2e31e42ec9db18 [file] [log] [blame]
caryclark@google.comf839c032012-10-26 21:03:50 +00001<html>
2<head>
3<div style="height:0">
4
5<div id="quad56">
6debugShowActiveSpans id=1 (366.608826,151.196014 378.803101,136.674606 398.164948,136.674606) t=0.490456543 (380.294495,140.44487) other=7 otherT=0.578520747 otherIndex=3 windSum=? windValue=1
7debugShowActiveSpans id=2 (398.164948,136.674606 354.009216,208.816208) t=0 (398.164948,136.674606) other=1 otherT=1 otherIndex=4 windSum=? windValue=1
8debugShowActiveSpans id=3 (354.009216,208.816208 393.291473,102.232819) t=0 (354.009216,208.816208) other=2 otherT=1 otherIndex=1 windSum=? windValue=1
9debugShowActiveSpans id=3 (354.009216,208.816208 393.291473,102.232819) t=0.508945199 (374.00174,154.571106) other=6 otherT=0.598402499 otherIndex=1 windSum=? windValue=1
10debugShowActiveSpans id=3 (354.009216,208.816208 393.291473,102.232819) t=0.634079491 (378.917297,141.233871) other=7 otherT=0.536512741 otherIndex=1 windSum=-1 windValue=1
11debugShowActiveSpans id=5 (359.978058,136.581512 378.315979,136.581512 388.322723,149.613556) t=0.597488996 (378.917297,141.233856) other=7 otherT=0.536512973 otherIndex=2 windSum=? windValue=1
12debugShowActiveSpans id=6 (388.322723,149.613556 364.390686,157.898193) t=0 (388.322723,149.613556) other=5 otherT=1 otherIndex=4 windSum=? windValue=1
13debugShowActiveSpans id=6 (388.322723,149.613556 364.390686,157.898193) t=0.598402499 (374.00174,154.571106) other=3 otherT=0.508945199 otherIndex=1 windSum=? windValue=1
14debugShowActiveSpans id=7 (364.390686,157.898193 375.281769,136.674606 396.039917,136.674606) t=0 (364.390686,157.898193) other=6 otherT=1 otherIndex=2 windSum=? windValue=1
15debugShowActiveSpans id=7 (364.390686,157.898193 375.281769,136.674606 396.039917,136.674606) t=0.536512741 (378.917297,141.233871) other=3 otherT=0.634079491 otherIndex=2 windSum=? windValue=1
16debugShowActiveSpans id=7 (364.390686,157.898193 375.281769,136.674606 396.039917,136.674606) t=0.536512973 (378.917297,141.233856) other=5 otherT=0.597488996 otherIndex=3 windSum=-1 windValue=1
17</div>
18
19<div id="quad57c">
20debugShowActiveSpans id=1 (303.12088,141.299606 330.463562,217.659027) t=0.845414865 (326.236786,205.854996) other=13 otherT=0.999999913 otherIndex=3 windSum=? windValue=1
21debugShowActiveSpans id=2 (330.463562,217.659027 358.606506,141.299606) t=-0 (330.463562,217.659027) other=1 otherT=1 otherIndex=3 windSum=? windValue=1
22debugShowActiveSpans id=2 (330.463562,217.659027 358.606506,141.299606) t=0.154585135 (334.814056,205.854996) other=13 otherT=0.812241055 otherIndex=2 windSum=? windValue=1
23debugShowActiveSpans id=2 (330.463562,217.659027 358.606506,141.299606) t=0.283842806 (338.451721,195.984955) other=16 otherT=0.363593784 otherIndex=1 windSum=? windValue=1
24debugShowActiveSpans id=4 (362.874634,159.705902 335.665344,233.397751) t=0.379109438 (352.559326,187.643173) other=17 otherT=0.412818074 otherIndex=1 windSum=? windValue=1
25debugShowActiveSpans id=13 (371.919067,205.854996 326.236786,205.854996) t=0.812241055 (334.814056,205.854996) other=2 otherT=0.154585135 otherIndex=1 windSum=? windValue=1
26debugShowActiveSpans id=14 (326.236786,205.854996 329.104431,231.663818 351.512085,231.663818) t=0.962138429 (349.843323,231.626816) other=15 otherT=0.0583966647 otherIndex=1 windSum=1 windValue=1
27debugShowActiveSpans id=15 (351.512085,231.663818 322.935669,231.030273) t=0 (351.512085,231.663818) other=14 otherT=1 otherIndex=3 windSum=1 windValue=1
28debugShowActiveSpans id=16 (326.837006,195.984955 358.78125,195.984955) t=0 (326.837006,195.984955) other=18 otherT=1 otherIndex=1 windSum=? windValue=1
29debugShowActiveSpans id=16 (326.837006,195.984955 358.78125,195.984955) t=0.363593784 (338.451721,195.984955) other=2 otherT=0.283842806 otherIndex=2 windSum=? windValue=1
30debugShowActiveSpans id=16 (326.837006,195.984955 358.78125,195.984955) t=0.708806554 (349.479309,195.984955) other=4 otherT=0.492307539 otherIndex=3 windSum=? windValue=1
31debugShowActiveSpans id=17 (358.78125,195.984955 343.709442,175.778046) t=-0 (358.78125,195.984955) other=16 otherT=1 otherIndex=3 windSum=? windValue=1
32debugShowActiveSpans id=17 (358.78125,195.984955 343.709442,175.778046) t=0.412818074 (352.559326,187.643173) other=4 otherT=0.379109438 otherIndex=2 windSum=? windValue=1
33debugShowActiveSpans id=17 (358.78125,195.984955 343.709442,175.778046) t=0.902761903 (345.174988,177.74292) other=2 otherT=0.522739691 otherIndex=3 windSum=? windValue=1
34debugShowActiveSpans id=18 (343.709442,175.778046 328.570923,175.778046 326.837006,195.984955) t=0 (343.709442,175.778046) other=17 otherT=1 otherIndex=3 windSum=? windValue=1
35</div>
36
37<div id="quad57b">
38debugShowActiveSpans id=1 (303.12088,141.299606 330.463562,217.659027) t=0.845414865 (326.236786,205.854996) other=13 otherT=0.999999913 otherIndex=3 windSum=1 windValue=1
39debugShowActiveSpans id=2 (330.463562,217.659027 358.606506,141.299606) t=-0 (330.463562,217.659027) other=1 otherT=1 otherIndex=3 windSum=? windValue=1
40debugShowActiveSpans id=2 (330.463562,217.659027 358.606506,141.299606) t=0.154585135 (334.814056,205.854996) other=13 otherT=0.812241055 otherIndex=2 windSum=? windValue=1
41debugShowActiveSpans id=2 (330.463562,217.659027 358.606506,141.299606) t=0.283842806 (338.451721,195.984955) other=16 otherT=0.363593784 otherIndex=1 windSum=? windValue=1
42debugShowActiveSpans id=4 (362.874634,159.705902 335.665344,233.397751) t=0.379109438 (352.559326,187.643173) other=17 otherT=0.412818074 otherIndex=1 windSum=? windValue=1
43debugShowActiveSpans id=13 (371.919067,205.854996 326.236786,205.854996) t=0.812241055 (334.814056,205.854996) other=2 otherT=0.154585135 otherIndex=1 windSum=? windValue=1
44debugShowActiveSpans id=16 (326.837006,195.984955 358.78125,195.984955) t=0 (326.837006,195.984955) other=18 otherT=1 otherIndex=1 windSum=? windValue=1
45debugShowActiveSpans id=16 (326.837006,195.984955 358.78125,195.984955) t=0.363593784 (338.451721,195.984955) other=2 otherT=0.283842806 otherIndex=2 windSum=? windValue=1
46debugShowActiveSpans id=16 (326.837006,195.984955 358.78125,195.984955) t=0.708806554 (349.479309,195.984955) other=4 otherT=0.492307539 otherIndex=3 windSum=? windValue=1
47debugShowActiveSpans id=17 (358.78125,195.984955 343.709442,175.778046) t=-0 (358.78125,195.984955) other=16 otherT=1 otherIndex=3 windSum=? windValue=1
48debugShowActiveSpans id=17 (358.78125,195.984955 343.709442,175.778046) t=0.412818074 (352.559326,187.643173) other=4 otherT=0.379109438 otherIndex=2 windSum=? windValue=1
49debugShowActiveSpans id=17 (358.78125,195.984955 343.709442,175.778046) t=0.902761903 (345.174988,177.74292) other=2 otherT=0.522739691 otherIndex=3 windSum=? windValue=1
50debugShowActiveSpans id=18 (343.709442,175.778046 328.570923,175.778046 326.837006,195.984955) t=0 (343.709442,175.778046) other=17 otherT=1 otherIndex=3 windSum=? windValue=1
51</div>
52
53<div id="quad57a">
54debugShowActiveSpans id=2 (330.463562,217.659027 358.606506,141.299606) t=0.154585135 (334.814056,205.854996) other=13 otherT=0.812241055 otherIndex=2 windSum=-1 windValue=1
55debugShowActiveSpans id=2 (330.463562,217.659027 358.606506,141.299606) t=0.283842806 (338.451721,195.984955) other=16 otherT=0.363593784 otherIndex=1 windSum=? windValue=1
56debugShowActiveSpans id=4 (362.874634,159.705902 335.665344,233.397751) t=0.379109438 (352.559326,187.643173) other=17 otherT=0.412818074 otherIndex=1 windSum=? windValue=1
57debugShowActiveSpans id=16 (326.837006,195.984955 358.78125,195.984955) t=0 (326.837006,195.984955) other=18 otherT=1 otherIndex=1 windSum=? windValue=1
58debugShowActiveSpans id=16 (326.837006,195.984955 358.78125,195.984955) t=0.363593784 (338.451721,195.984955) other=2 otherT=0.283842806 otherIndex=2 windSum=? windValue=1
59debugShowActiveSpans id=16 (326.837006,195.984955 358.78125,195.984955) t=0.708806554 (349.479309,195.984955) other=4 otherT=0.492307539 otherIndex=3 windSum=? windValue=1
60debugShowActiveSpans id=17 (358.78125,195.984955 343.709442,175.778046) t=-0 (358.78125,195.984955) other=16 otherT=1 otherIndex=3 windSum=? windValue=1
61debugShowActiveSpans id=17 (358.78125,195.984955 343.709442,175.778046) t=0.412818074 (352.559326,187.643173) other=4 otherT=0.379109438 otherIndex=2 windSum=? windValue=1
62debugShowActiveSpans id=17 (358.78125,195.984955 343.709442,175.778046) t=0.902761903 (345.174988,177.74292) other=2 otherT=0.522739691 otherIndex=3 windSum=? windValue=1
63debugShowActiveSpans id=18 (343.709442,175.778046 328.570923,175.778046 326.837006,195.984955) t=0 (343.709442,175.778046) other=17 otherT=1 otherIndex=3 windSum=? windValue=1
64</div>
65
66<div id="quad58b">
67debugShowActiveSpans id=3 (303.12088,141.299606 330.463562,217.659027) t=0.845414865 (326.236786,205.854996) other=16 otherT=0.999999913 otherIndex=3 windSum=1 windValue=1
68debugShowActiveSpans id=4 (330.463562,217.659027 358.606506,141.299606) t=-0 (330.463562,217.659027) other=3 otherT=1 otherIndex=3 windSum=? windValue=1
69debugShowActiveSpans id=4 (330.463562,217.659027 358.606506,141.299606) t=0.154585135 (334.814056,205.854996) other=16 otherT=0.812241055 otherIndex=2 windSum=? windValue=1
70debugShowActiveSpans id=4 (330.463562,217.659027 358.606506,141.299606) t=0.283842806 (338.451721,195.984955) other=19 otherT=0.363593784 otherIndex=1 windSum=? windValue=1
71debugShowActiveSpans id=6 (362.874634,159.705902 335.665344,233.397751) t=0.287405665 (355.054535,180.885361) other=20 otherT=0.497256785 otherIndex=1 windSum=? windValue=1
72debugShowActiveSpans id=16 (371.919067,205.854996 326.236786,205.854996) t=0.812241055 (334.814056,205.854996) other=4 otherT=0.154585135 otherIndex=1 windSum=? windValue=1
73debugShowActiveSpans id=19 (326.837006,195.984955 358.78125,195.984955) t=0 (326.837006,195.984955) other=21 otherT=1 otherIndex=1 windSum=? windValue=1
74debugShowActiveSpans id=19 (326.837006,195.984955 358.78125,195.984955) t=0.363593784 (338.451721,195.984955) other=4 otherT=0.283842806 otherIndex=2 windSum=? windValue=1
75debugShowActiveSpans id=19 (326.837006,195.984955 358.78125,195.984955) t=0.708806554 (349.479309,195.984955) other=6 otherT=0.492307539 otherIndex=3 windSum=? windValue=1
76debugShowActiveSpans id=20 (358.78125,195.984955 358.78125,175.778046 343.709442,175.778046) t=0 (358.78125,195.984955) other=19 otherT=1 otherIndex=3 windSum=? windValue=1
77debugShowActiveSpans id=20 (358.78125,195.984955 358.78125,175.778046 343.709442,175.778046) t=0.497256785 (355.054535,180.885361) other=6 otherT=0.287405665 otherIndex=2 windSum=? windValue=1
78debugShowActiveSpans id=20 (358.78125,195.984955 358.78125,175.778046 343.709442,175.778046) t=0.925970638 (345.858368,175.888794) other=4 otherT=0.547021444 otherIndex=3 windSum=? windValue=1
79debugShowActiveSpans id=21 (343.709442,175.778046 328.570923,175.778046 326.837006,195.984955) t=0 (343.709442,175.778046) other=20 otherT=1 otherIndex=3 windSum=? windValue=1
80</div>
81
82<div id="quad58a">
83debugShowActiveSpans id=4 (330.463562,217.659027 358.606506,141.299606) t=0.154585135 (334.814056,205.854996) other=16 otherT=0.812241055 otherIndex=2 windSum=-1 windValue=1
84debugShowActiveSpans id=4 (330.463562,217.659027 358.606506,141.299606) t=0.283842806 (338.451721,195.984955) other=19 otherT=0.363593784 otherIndex=1 windSum=? windValue=1
85debugShowActiveSpans id=6 (362.874634,159.705902 335.665344,233.397751) t=0.287405665 (355.054535,180.885361) other=20 otherT=0.497256785 otherIndex=1 windSum=? windValue=1
86debugShowActiveSpans id=19 (326.837006,195.984955 358.78125,195.984955) t=0 (326.837006,195.984955) other=21 otherT=1 otherIndex=1 windSum=? windValue=1
87debugShowActiveSpans id=19 (326.837006,195.984955 358.78125,195.984955) t=0.363593784 (338.451721,195.984955) other=4 otherT=0.283842806 otherIndex=2 windSum=? windValue=1
88debugShowActiveSpans id=19 (326.837006,195.984955 358.78125,195.984955) t=0.708806554 (349.479309,195.984955) other=6 otherT=0.492307539 otherIndex=3 windSum=? windValue=1
89debugShowActiveSpans id=20 (358.78125,195.984955 358.78125,175.778046 343.709442,175.778046) t=0 (358.78125,195.984955) other=19 otherT=1 otherIndex=3 windSum=? windValue=1
90debugShowActiveSpans id=20 (358.78125,195.984955 358.78125,175.778046 343.709442,175.778046) t=0.497256785 (355.054535,180.885361) other=6 otherT=0.287405665 otherIndex=2 windSum=? windValue=1
91debugShowActiveSpans id=20 (358.78125,195.984955 358.78125,175.778046 343.709442,175.778046) t=0.925970638 (345.858368,175.888794) other=4 otherT=0.547021444 otherIndex=3 windSum=? windValue=1
92debugShowActiveSpans id=21 (343.709442,175.778046 328.570923,175.778046 326.837006,195.984955) t=0 (343.709442,175.778046) other=20 otherT=1 otherIndex=3 windSum=? windValue=1
93</div>
94
caryclark@google.com0b7da432012-10-31 19:00:20 +000095<div id="quad59">
96debugShowQuadIntersection wtTs[0]=0 (369.863983,145.645813 382.380371,121.254936 406.236359,121.254936) (369.863983,145.645813) wnTs[0]=1 (406.236359,121.254936 409.445679,121.254936 412.975952,121.789818) (412.975952,121.789818)
97debugShowQuadLineIntersection wtTs[0]=1 (369.863983,145.645813 382.380371,121.254936 406.236359,121.254936) (406.236359,121.254936) wnTs[0]=0 (412.975952,121.789818 369.863983,145.645813) (412.975952,121.789818)
98debugShowQuadLineIntersection wtTs[0]=0 (406.236359,121.254936 409.445679,121.254936 412.975952,121.789818) (406.236359,121.254936) wnTs[0]=1 (412.975952,121.789818 369.863983,145.645813) (369.863983,145.645813)
99debugShowQuadIntersection no intersect (369.863983,145.645813 382.380371,121.254936 406.236359,121.254936) (369.970581,137.94342 383.98465,121.254936 406.235992,121.254936)
100debugShowQuadIntersection no intersect (369.863983,145.645813 382.380371,121.254936 406.236359,121.254936) (406.235992,121.254936 425.705902,121.254936 439.71994,137.087616)
101debugShowQuadLineIntersection wtTs[0]=0.934062756 (369.863983,145.645813 382.380371,121.254936 406.236359,121.254936) (403.139679,121.360977) wnTs[0]=0.17423 (439.71994,137.087616 369.970581,137.94342) (427.567535,137.236725)
102debugShowQuadIntersection wtTs[0]=9.61225644e-05 (406.236359,121.254936 409.445679,121.254936 412.975952,121.789818) (406.236969,121.254936) wnTs[0]=0.000495996 (406.235992,121.254936 425.705902,121.254936 439.71994,137.087616) (406.25531,121.254944)
103debugShowQuadLineIntersection no intersect (369.970581,137.94342 383.98465,121.254936 406.235992,121.254936) (412.975952,121.789818 369.863983,145.645813)
104debugShowQuadLineIntersection no intersect (406.235992,121.254936 425.705902,121.254936 439.71994,137.087616) (412.975952,121.789818 369.863983,145.645813)
105debugShowQuadIntersection wtTs[0]=0 (369.970581,137.94342 383.98465,121.254936 406.235992,121.254936) (369.970581,137.94342) wnTs[0]=1 (406.235992,121.254936 425.705902,121.254936 439.71994,137.087616) (439.71994,137.087616)
106debugShowQuadLineIntersection wtTs[0]=1 (369.970581,137.94342 383.98465,121.254936 406.235992,121.254936) (406.235992,121.254936) wnTs[0]=0 (439.71994,137.087616 369.970581,137.94342) (439.71994,137.087616)
107debugShowQuadLineIntersection wtTs[0]=0 (406.235992,121.254936 425.705902,121.254936 439.71994,137.087616) (406.235992,121.254936) wnTs[0]=1 (439.71994,137.087616 369.970581,137.94342) (369.970581,137.94342)
108</div>
109
110<div id="quad59b">
111debugShowActiveSpans id=1 (369.863983,145.645813 382.380371,121.254936 406.236359,121.254936) t=0 (369.863983,145.645813) other=3 otherT=1 otherIndex=2 windSum=? windValue=1
112debugShowActiveSpans id=1 (369.863983,145.645813 382.380371,121.254936 406.236359,121.254936) t=0.174229721 (374.569672,137.886993) other=6 otherT=0.934062756 otherIndex=2 windSum=? windValue=1
113debugShowActiveSpans id=2 (406.236359,121.254936 409.445679,121.254936 412.975952,121.789818) t=0 (406.236359,121.254936) other=1 otherT=1 otherIndex=2 windSum=? windValue=1
114debugShowActiveSpans id=2 (406.236359,121.254936 409.445679,121.254936 412.975952,121.789818) t=0.000495995847 (406.239532,121.254936) other=5 otherT=9.61225644e-05 otherIndex=1 windSum=? windValue=1
115debugShowActiveSpans id=3 (412.975952,121.789818 369.863983,145.645813) t=0 (412.975952,121.789818) other=2 otherT=1 otherIndex=2 windSum=? windValue=1
116debugShowActiveSpans id=3 (412.975952,121.789818 369.863983,145.645813) t=0.669864243 (384.096771,137.770096) other=6 otherT=0.797471908 otherIndex=1 windSum=? windValue=1
117debugShowActiveSpans id=4 (369.970581,137.94342 383.98465,121.254936 406.235992,121.254936) t=0 (369.970581,137.94342) other=6 otherT=1 otherIndex=3 windSum=? windValue=1
118debugShowActiveSpans id=5 (406.235992,121.254936 425.705902,121.254936 439.71994,137.087616) t=0 (406.235992,121.254936) other=4 otherT=1 otherIndex=1 windSum=? windValue=1
119debugShowActiveSpans id=5 (406.235992,121.254936 425.705902,121.254936 439.71994,137.087616) t=9.61225644e-05 (406.239746,121.254936) other=2 otherT=0.000495995847 otherIndex=1 windSum=? windValue=1
120debugShowActiveSpans id=6 (439.71994,137.087616 369.970581,137.94342) t=0 (439.71994,137.087616) other=5 otherT=1 otherIndex=2 windSum=? windValue=1
121debugShowActiveSpans id=6 (439.71994,137.087616 369.970581,137.94342) t=0.797471908 (384.096771,137.770096) other=3 otherT=0.669864243 otherIndex=1 windSum=? windValue=1
122debugShowActiveSpans id=6 (439.71994,137.087616 369.970581,137.94342) t=0.934062756 (374.569672,137.886993) other=1 otherT=0.174229721 otherIndex=1 windSum=? windValue=1
123</div>
124
125<div id="quad60">
126debugShowActiveSpans id=1 (360.416077,166.795715 370.126831,147.872162 388.635406,147.872162) t=0 (360.416077,166.795715) other=2 otherT=1 otherIndex=2 windSum=? windValue=1
127debugShowActiveSpans id=2 (388.635406,147.872162 360.416077,166.795715) t=0 (388.635406,147.872162) other=1 otherT=1 otherIndex=1 windSum=? windValue=1
128debugShowActiveSpans id=2 (388.635406,147.872162 360.416077,166.795715) t=0.00925761141 (388.374176,148.047348) other=4 otherT=0.883679938 otherIndex=1 windSum=? windValue=1
129debugShowActiveSpans id=3 (353.2948,194.351074 353.2948,173.767563 364.167572,160.819855) t=0 (353.2948,194.351074) other=5 otherT=1 otherIndex=1 windSum=? windValue=1
130debugShowActiveSpans id=4 (364.167572,160.819855 375.040314,147.872162 392.303894,147.872162) t=0 (364.167572,160.819855) other=3 otherT=1 otherIndex=1 windSum=? windValue=1
131debugShowActiveSpans id=4 (364.167572,160.819855 375.040314,147.872162 392.303894,147.872162) t=0.883679938 (388.374176,148.047348) other=2 otherT=0.00925761141 otherIndex=1 windSum=? windValue=1
132debugShowActiveSpans id=5 (392.303894,147.872162 353.2948,194.351074) t=0 (392.303894,147.872162) other=4 otherT=1 otherIndex=2 windSum=? windValue=1
133</div>
134
135<div id="quad61">
136debugShowActiveSpans id=1 (348.781738,123.864815 369.848602,123.864815) t=0 (348.781738,123.864815) other=4 otherT=1 otherIndex=4 windSum=? windValue=1
137debugShowActiveSpans id=2 (369.848602,123.864815 369.848602,145.680267) t=0 (369.848602,123.864815) other=1 otherT=1 otherIndex=1 windSum=? windValue=1
138debugShowActiveSpans id=3 (369.848602,145.680267 382.360413,121.298294 406.207703,121.298294) t=0 (369.848602,145.680267) other=2 otherT=1 otherIndex=1 windSum=? windValue=1
139debugShowActiveSpans id=3 (369.848602,145.680267 382.360413,121.298294 406.207703,121.298294) t=0.258355433 (377.070221,134.709274) other=6 otherT=0.8038997 otherIndex=1 windSum=? windValue=1
140debugShowActiveSpans id=3 (369.848602,145.680267 382.360413,121.298294 406.207703,121.298294) t=0.914354357 (402.206024,121.477142) other=4 otherT=0.0696842495 otherIndex=2 windSum=? windValue=1
141debugShowActiveSpans id=3 (369.848602,145.680267 382.360413,121.298294 406.207703,121.298294) t=0.999082394 (406.16394,121.298317) other=5 otherT=0.998890674 otherIndex=2 windSum=? windValue=1
142debugShowActiveSpans id=4 (406.207703,121.298294 348.781738,123.864815) t=1.0265934e-07 (406.207703,121.298294) other=5 otherT=0.999874327 otherIndex=3 windSum=? windValue=1
143debugShowActiveSpans id=4 (406.207703,121.298294 348.781738,123.864815) t=0.0696842495 (402.206024,121.477142) other=3 otherT=0.914354357 otherIndex=2 windSum=? windValue=1
144debugShowActiveSpans id=4 (406.207703,121.298294 348.781738,123.864815) t=0.0881931013 (401.143127,121.524643) other=5 otherT=0.883517581 otherIndex=1 windSum=? windValue=1
145debugShowActiveSpans id=5 (369.961151,137.980698 383.970093,121.298294 406.213287,121.298294) t=0 (369.961151,137.980698) other=6 otherT=1 otherIndex=2 windSum=? windValue=1
146debugShowActiveSpans id=5 (369.961151,137.980698 383.970093,121.298294 406.213287,121.298294) t=0.883517581 (401.143127,121.524643) other=4 otherT=0.0881931013 otherIndex=3 windSum=? windValue=1
147debugShowActiveSpans id=5 (369.961151,137.980698 383.970093,121.298294 406.213287,121.298294) t=0.998890674 (406.16394,121.298317) other=3 otherT=0.999082394 otherIndex=3 windSum=? windValue=1
148debugShowActiveSpans id=5 (369.961151,137.980698 383.970093,121.298294 406.213287,121.298294) t=0.999874327 (406.207703,121.298294) other=4 otherT=1.0265934e-07 otherIndex=1 windSum=? windValue=1
149debugShowActiveSpans id=6 (406.213287,121.298294 369.961151,137.980698) t=0 (406.213287,121.298294) other=5 otherT=1 otherIndex=4 windSum=? windValue=1
150debugShowActiveSpans id=6 (406.213287,121.298294 369.961151,137.980698) t=0.8038997 (377.070221,134.709274) other=3 otherT=0.258355433 otherIndex=1 windSum=? windValue=1
151</div>
152
153<div id="quad61b">
154debugShowQuadLineIntersection wtTs[0]=0.914354357 (369.848602,145.680267 382.360413,121.298294 406.207703,121.298294) (402.206024,121.477142) wtTs[1]=1 (406.207703,121.298294) wnTs[0]=0.0696842 (406.207703,121.298294 348.781738,123.864815) (402.206024,121.477142) wnTs[1]=0 (406.207703,121.298294)
155debugShowQuadIntersection wtTs[0]=0.999082394 (369.848602,145.680267 382.360413,121.298294 406.207703,121.298294) (406.16394,121.298317) wnTs[0]=0.998891 (369.961151,137.980698 383.970093,121.298294 406.213287,121.298294) (406.16394,121.298317)
156debugShowQuadLineIntersection wtTs[0]=0.258355433 (369.848602,145.680267 382.360413,121.298294 406.207703,121.298294) (377.070221,134.709274) wnTs[0]=0.8039 (406.213287,121.298294 369.961151,137.980698) (377.070221,134.709274)
157debugShowQuadLineIntersection wtTs[0]=0.883517581 (369.961151,137.980698 383.970093,121.298294 406.213287,121.298294) (401.143127,121.524643) wtTs[1]=0.999874327 (406.207703,121.298294) wnTs[0]=0.0881931 (406.207703,121.298294 348.781738,123.864815) (401.143127,121.524643) wnTs[1]=1.0265934e-07 (406.207703,121.298294)
158debugShowQuadLineIntersection wtTs[0]=0 (369.961151,137.980698 383.970093,121.298294 406.213287,121.298294) (369.961151,137.980698) wtTs[1]=1 (406.213287,121.298294) wnTs[0]=1 (406.213287,121.298294 369.961151,137.980698) (369.961151,137.980698) wnTs[1]=0 (406.213287,121.298294)
159</div>
160
161<div id="quad61c">
162debugShowActiveSpans id=3 (369.848602,145.680267 382.360413,121.298294 406.207703,121.298294) t=0.914354357 (402.206024,121.477142) other=4 otherT=0.0696842495 otherIndex=2 windSum=-1 windValue=1
163debugShowActiveSpans id=4 (406.207703,121.298294 348.781738,123.864815) t=1.0265934e-07 (406.207703,121.298294) other=5 otherT=0.999874327 otherIndex=3 windSum=-1 windValue=1
164debugShowActiveSpans id=5 (369.961151,137.980698 383.970093,121.298294 406.213287,121.298294) t=0.998890674 (406.16394,121.298317) other=3 otherT=0.999082394 otherIndex=3 windSum=-1 windValue=1
165</div>
166
caryclark@google.comf839c032012-10-26 21:03:50 +0000167</div>
168
169<script type="text/javascript">
170
171var testDivs = [
caryclark@google.com0b7da432012-10-31 19:00:20 +0000172 quad61,
173 quad61b,
174 quad61c,
175 quad60,
176 quad59b,
177 quad59,
caryclark@google.comf839c032012-10-26 21:03:50 +0000178 quad58b,
179 quad58a,
180 quad57c,
181 quad57b,
182 quad57a,
183 quad56,
184];
185
186var decimal_places = 3; // make this 3 to show more precision
187
188var tests = [];
189var testTitles = [];
190var testIndex = 0;
191var ctx;
192
193var xmin;
194var ymin;
195var scale;
196var mouseX, mouseY;
197var srcLeft, srcTop;
198var srcWidth, srcHeight;
199var screenWidth, screenHeight;
caryclark@google.com0b7da432012-10-31 19:00:20 +0000200var drawnPts, drawnLines, drawnQuads, deferredLines, deferredQuads;
caryclark@google.comf839c032012-10-26 21:03:50 +0000201
202var ptLabels = true;
203var digit_mode = false;
204var index_mode = true;
205var index_bits = -1;
206var debug_xy = false;
207var info_mode = false;
208var intersect_mode = false;
209var sequence = -1;
210
211var SPAN_ID = 1;
212var SPAN_X1 = 2;
213var SPAN_Y1 = 3;
214var SPAN_X2 = 4;
215var SPAN_Y2 = 5;
216var SPAN_L_T = 6;
217var SPAN_L_TX = 7;
218var SPAN_L_TY = 8;
219var SPAN_L_OTHER = 9;
220var SPAN_L_OTHERT = 10;
221var SPAN_L_OTHERI = 11;
222var SPAN_L_SUM = 12;
223var SPAN_L_VAL = 13;
224
225var SPAN_X3 = 6;
226var SPAN_Y3 = 7;
227var SPAN_Q_T = 8;
228var SPAN_Q_TX = 9;
229var SPAN_Q_TY = 10;
230var SPAN_Q_OTHER = 11;
231var SPAN_Q_OTHERT = 12;
232var SPAN_Q_OTHERI = 13;
233var SPAN_Q_SUM = 14;
234var SPAN_Q_VAL = 15;
235
caryclark@google.com0b7da432012-10-31 19:00:20 +0000236var ACTIVE_LINE_SPAN = 1;
237var ACTIVE_QUAD_SPAN = 2;
238var INTERSECT_QUAD_LINE = 3;
239var INTERSECT_QUAD_LINE_2 = 4;
240var INTERSECT_QUAD_LINE_NO = 5;
241var INTERSECT_QUAD = 6;
242var INTERSECT_QUAD_2 = 7;
243var INTERSECT_QUAD_NO = 8;
caryclark@google.comf839c032012-10-26 21:03:50 +0000244
245function strs_to_nums(strs) {
246 var result = [];
247 for (var idx in strs) {
248 var str = strs[idx];
249 var num = parseFloat(str);
250 if (isNaN(num)) {
251 result.push(str);
252 } else {
253 result.push(num);
254 }
255 }
256 return result;
257}
258
caryclark@google.com0b7da432012-10-31 19:00:20 +0000259function construct_regexp(pattern) {
260 var escape = pattern.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
261 escape = escape.replace(/PT_VAL/g, "(\\d+\\.?\\d*),(\\d+\\.?\\d*)");
262 escape = escape.replace(/T_VAL/g, "(\\d+\\.?\\d*e?-?\\d*)");
263 escape = escape.replace(/IDX/g, "(\\d+)");
264 escape = escape.replace(/OPT/g, "(\\?|-?\\d+)");
265 return new RegExp(escape, 'i');
266}
267
caryclark@google.comf839c032012-10-26 21:03:50 +0000268function parse_debugShowActiveSpans(test, title) {
caryclark@google.com0b7da432012-10-31 19:00:20 +0000269 var re_quad = construct_regexp(" id=IDX (PT_VAL PT_VAL PT_VAL) t=T_VAL (PT_VAL) other=IDX otherT=T_VAL otherIndex=IDX windSum=OPT windValue=IDX");
270 var re_line = construct_regexp(" id=IDX (PT_VAL PT_VAL) t=T_VAL (PT_VAL) other=IDX otherT=T_VAL otherIndex=IDX windSum=OPT windValue=IDX");
caryclark@google.comf839c032012-10-26 21:03:50 +0000271
272 var strs = test.split("debugShowActiveSpans");
273 if (strs.length == 1)
274 return;
275 var spans = [];
276 for (var s in strs) {
277 var str = strs[s];
278 if (str == "\n") {
279 continue;
280 }
281 if (re_line.test(str)) {
282 var lineStrs = re_line.exec(str);
283 var line = strs_to_nums(lineStrs);
caryclark@google.com0b7da432012-10-31 19:00:20 +0000284 spans.push(ACTIVE_LINE_SPAN);
caryclark@google.comf839c032012-10-26 21:03:50 +0000285 spans.push(line);
286 } else if (re_quad.test(str)) {
287 var quadStrs = re_quad.exec(str);
288 var quad = strs_to_nums(quadStrs);
caryclark@google.com0b7da432012-10-31 19:00:20 +0000289 spans.push(ACTIVE_QUAD_SPAN);
caryclark@google.comf839c032012-10-26 21:03:50 +0000290 spans.push(quad);
291 }
292 }
293 if (spans.length >= 1) {
294 tests.push(spans);
295 testTitles.push(title);
296 }
297}
298
caryclark@google.com0b7da432012-10-31 19:00:20 +0000299function filter_str_by(id, str, regex, array) {
300 if (regex.test(str)) {
301 var strs = regex.exec(str);
302 var result = strs_to_nums(strs);
303 array.push(id);
304 array.push(result);
305 }
306}
307
308function parse_intersections(test, title) {
309 var re_quad_line = construct_regexp(" wtTs[0]=T_VAL (PT_VAL PT_VAL PT_VAL) (PT_VAL) wnTs[0]=T_VAL (PT_VAL PT_VAL) (PT_VAL)");
310 var re_quad_line_2 = construct_regexp(" wtTs[0]=T_VAL (PT_VAL PT_VAL PT_VAL) (PT_VAL) wtTs[1]=T_VAL (PT_VAL) wnTs[0]=T_VAL (PT_VAL PT_VAL) (PT_VAL) wnTs[1]=T_VAL (PT_VAL)");
311 var re_quad_line_no_intersect = construct_regexp(" no intersect (PT_VAL PT_VAL PT_VAL) (PT_VAL PT_VAL)");
312 var re_quad = construct_regexp(" wtTs[0]=T_VAL (PT_VAL PT_VAL PT_VAL) (PT_VAL) wnTs[0]=T_VAL (PT_VAL PT_VAL PT_VAL) (PT_VAL)");
313 var re_quad_2 = construct_regexp(" wtTs[0]=T_VAL (PT_VAL PT_VAL PT_VAL) (PT_VAL) wtTs[1]=T_VAL wnTs[0]=T_VAL (PT_VAL PT_VAL PT_VAL) (PT_VAL) wnTs[1]=T_VAL");
314 var re_quad_no_intersect = construct_regexp(" no intersect (PT_VAL PT_VAL PT_VAL) (PT_VAL PT_VAL PT_VAL)");
315
316 var strs = test.split(/debugShow[A-Za-z]+Intersection/);
317 if (strs.length == 1)
318 return;
319 var spans = [];
320 for (var s in strs) {
321 var str = strs[s];
322 if (str == "\n") {
323 continue;
324 }
325 filter_str_by(INTERSECT_QUAD_LINE, str, re_quad_line, spans);
326 filter_str_by(INTERSECT_QUAD_LINE_2, str, re_quad_line_2, spans);
327 filter_str_by(INTERSECT_QUAD_LINE_NO, str, re_quad_line_no_intersect, spans);
328 filter_str_by(INTERSECT_QUAD, str, re_quad, spans);
329 filter_str_by(INTERSECT_QUAD_2, str, re_quad_2, spans);
330 filter_str_by(INTERSECT_QUAD_NO, str, re_quad_no_intersect, spans);
331 }
332 if (spans.length >= 1) {
333 tests.push(spans);
334 testTitles.push(title);
335 }
336}
337
caryclark@google.comf839c032012-10-26 21:03:50 +0000338function init(test) {
339 var canvas = document.getElementById('canvas');
340 if (!canvas.getContext) return;
341 screenWidth = canvas.width = window.innerWidth - 20;
342 screenHeight = canvas.height = window.innerHeight - 20;
343 ctx = canvas.getContext('2d');
344 xmin = Infinity;
345 var xmax = -Infinity;
346 ymin = Infinity;
347 var ymax = -Infinity;
caryclark@google.com0b7da432012-10-31 19:00:20 +0000348 var scanType = -1;
349 for (var scansStr in test) {
350 var scans = parseInt(scansStr);
caryclark@google.comf839c032012-10-26 21:03:50 +0000351 var scan = test[scans];
caryclark@google.com0b7da432012-10-31 19:00:20 +0000352 if (scanType == -1) {
353 scanType = scan;
354 continue;
caryclark@google.comf839c032012-10-26 21:03:50 +0000355 }
caryclark@google.com0b7da432012-10-31 19:00:20 +0000356 if (scanType == ACTIVE_LINE_SPAN || scanType == ACTIVE_QUAD_SPAN) {
357 var last = scanType == ACTIVE_QUAD_SPAN ? SPAN_X3 : SPAN_X2;
358 for (var idx = SPAN_X1; idx <= last; idx += 2) {
359 xmin = Math.min(xmin, scan[idx]);
360 xmax = Math.max(xmax, scan[idx]);
361 ymin = Math.min(ymin, scan[idx + 1]);
362 ymax = Math.max(ymax, scan[idx + 1]);
363 }
364 } else {
365 var start = 1;
366 if (scanType != INTERSECT_QUAD_LINE_NO && scanType != INTERSECT_QUAD_NO) {
367 start = 2;
368 }
369 for (var idx = start; idx < start + 6; idx += 2) {
370 xmin = Math.min(xmin, scan[idx]);
371 xmax = Math.max(xmax, scan[idx]);
372 ymin = Math.min(ymin, scan[idx + 1]);
373 ymax = Math.max(ymax, scan[idx + 1]);
374 }
375 start = start + 6;
376 if (scanType == INTERSECT_QUAD_LINE || scanType == INTERSECT_QUAD) {
377 start += 3;
378 }
379 if (scanType == INTERSECT_QUAD_LINE_2) {
380 start += 6;
381 }
382 if (scanType == INTERSECT_QUAD_2) {
383 start += 4;
384 }
385 var end = start + 4;
386 if (scanType == INTERSECT_QUAD || scanType == INTERSECT_QUAD_2 || scanType == INTERSECT_QUAD_NO) {
387 end += 2;
388 }
389 for (var idx = start; idx < end; idx += 2) {
390 xmin = Math.min(xmin, scan[idx]);
391 xmax = Math.max(xmax, scan[idx]);
392 ymin = Math.min(ymin, scan[idx + 1]);
393 ymax = Math.max(ymax, scan[idx + 1]);
394 }
395 }
396 scanType = -1;
caryclark@google.comf839c032012-10-26 21:03:50 +0000397 }
398 srcWidth = xmax - xmin;
399 srcHeight = ymax - ymin;
400 var hscale = ctx.canvas.width / srcWidth;
401 var vscale = ctx.canvas.height / srcHeight;
402 var minScale = Math.min(hscale, vscale);
403 scale = minScale;
404 srcLeft = xmin;
405 srcTop = ymin;
406}
407
408function drawPoint(px, py) {
409 for (var pts = 0; pts < drawnPts.length; pts += 2) {
410 var x = drawnPts[pts];
411 var y = drawnPts[pts + 1];
412 if (px == x && py == y) {
413 return;
414 }
415 }
416 drawnPts.push(px);
417 drawnPts.push(py);
418 var label = px.toFixed(decimal_places) + ", " + py.toFixed(decimal_places);
419 var _px = (px - srcLeft)* scale;
420 var _py = (py - srcTop) * scale;
421 ctx.beginPath();
422 ctx.arc(_px, _py, 3, 0, Math.PI*2, true);
423 ctx.closePath();
424 ctx.fill();
425 ctx.fillText(label, _px + 5, _py);
426}
427
caryclark@google.com0b7da432012-10-31 19:00:20 +0000428function drawLine(x1, y1, x2, y2, selected) {
429 for (var pts = 0; pts < drawnLines.length; pts += 4) {
430 if (x1 == drawnLines[pts] && y1 == drawnLines[pts + 1]) {
431 return;
432 }
433 if (x2 == drawnLines[pts + 2] && x2 == drawnLines[pts + 3]) {
434 return;
435 }
436 }
437 if (selected) {
438 drawnLines.push(x1);
439 drawnLines.push(y1);
440 drawnLines.push(x2);
441 drawnLines.push(y2);
442 ctx.beginPath();
443 ctx.moveTo((x1 - srcLeft) * scale,
444 (y1 - srcTop) * scale);
445 ctx.lineTo((x2 - srcLeft) * scale,
446 (y2 - srcTop) * scale);
447 ctx.stroke();
448 return;
449 }
450 deferredLines.push(x1);
451 deferredLines.push(y1);
452 deferredLines.push(x2);
453 deferredLines.push(y2);
454}
455
456function drawQuad(x1, y1, x2, y2, x3, y3, selected) {
457 for (var pts = 0; pts < drawnQuads.length; pts += 6) {
458 if (x1 == drawnQuads[pts] && y1 == drawnQuads[pts + 1]) {
459 return;
460 }
461 if (x2 == drawnQuads[pts + 2] && x2 == drawnQuads[pts + 3]) {
462 return;
463 }
464 if (x2 == drawnQuads[pts + 4] && x2 == drawnQuads[pts + 5]) {
465 return;
466 }
467 }
468 if (selected) {
469 drawnQuads.push(x1);
470 drawnQuads.push(y1);
471 drawnQuads.push(x2);
472 drawnQuads.push(y2);
473 drawnQuads.push(x3);
474 drawnQuads.push(y3);
475 ctx.beginPath();
476 ctx.moveTo((x1 - srcLeft) * scale,
477 (y1 - srcTop) * scale);
478 ctx.quadraticCurveTo((x2 - srcLeft) * scale,
479 (y2 - srcTop) * scale,
480 (x3 - srcLeft) * scale,
481 (y3 - srcTop) * scale);
482 ctx.stroke();
483 return;
484 }
485 deferredQuads.push(x1);
486 deferredQuads.push(y1);
487 deferredQuads.push(x2);
488 deferredQuads.push(y2);
489 deferredQuads.push(x3);
490 deferredQuads.push(y3);
491}
492
493function drawDeferred() {
494 for (var pts = 0; pts < deferredQuads.length; pts += 6) {
495 drawQuad(deferredQuads[pts], deferredQuads[pts + 1],
496 deferredQuads[pts + 2], deferredQuads[pts + 3],
497 deferredQuads[pts + 4], deferredQuads[pts + 5], true);
498 }
499 for (var pts = 0; pts < deferredLines.length; pts += 4) {
500 drawLine(deferredLines[pts], deferredLines[pts + 1],
501 deferredLines[pts + 2], deferredLines[pts + 3], true);
502 }
503}
504
caryclark@google.comf839c032012-10-26 21:03:50 +0000505function draw(test, title) {
506 ctx.fillStyle = "rgba(0,0,0, 0.1)";
507 ctx.font = "normal 50px Arial";
508 ctx.fillText(title, 50, 50);
509 ctx.font = "normal 10px Arial";
510 ctx.lineWidth = "1.001"; "0.999";
caryclark@google.com0b7da432012-10-31 19:00:20 +0000511 var curId = -1;
caryclark@google.comf839c032012-10-26 21:03:50 +0000512 var firstIdx;
513 var lastIdx;
514 var index_tst = -1;
515 drawnPts = [];
caryclark@google.com0b7da432012-10-31 19:00:20 +0000516 drawnLines = [];
517 drawnQuads = [];
518 deferredLines = [];
519 deferredQuads = [];
520 var scanType = -1;
521 var partIndex = 0;
caryclark@google.comf839c032012-10-26 21:03:50 +0000522 for (var scansStr in test) {
523 var scans = parseInt(scansStr);
524 var scan = test[scans];
caryclark@google.com0b7da432012-10-31 19:00:20 +0000525 if (scanType == -1) {
526 scanType = scan;
caryclark@google.comf839c032012-10-26 21:03:50 +0000527 continue;
528 }
caryclark@google.com0b7da432012-10-31 19:00:20 +0000529 partIndex++;
530 var hasId = scanType == ACTIVE_LINE_SPAN || scanType == ACTIVE_QUAD_SPAN ? SPAN_ID : -1;
531 if (hasId >= 0 && curId != scan[hasId]) {
532 curId = hasId;
533 firstIdx = lastIdx = partIndex;
534 index_tst++;
535 var nextIdx = lastIdx + 1;
536 while (nextIdx * 2 < test.length && test[nextIdx * 2][hasId] == curId) {
537 lastIdx = nextIdx++;
538 }
539 } else if (hasId < 0) {
540 firstIdx = lastIdx = partIndex;
541 index_tst++;
caryclark@google.comf839c032012-10-26 21:03:50 +0000542 }
caryclark@google.com0b7da432012-10-31 19:00:20 +0000543 var seq = sequence % (test.length / 2);
544 var selected = sequence >= 0 ? seq == partIndex
545 : (index_bits & (1 << index_tst)) != 0 && partIndex == firstIdx;
546 var skippable = (sequence >= 0 && seq >= firstIdx && seq <= lastIdx)
547 || partIndex != firstIdx;
548 if (skippable && !selected) {
549 scanType = -1;
550 continue;
551 }
552 var types = [scanType == ACTIVE_LINE_SPAN ? 0 : 1];
553 var pts = [];
554 if (scanType == ACTIVE_LINE_SPAN || scanType == ACTIVE_QUAD_SPAN) {
555 pts.push(SPAN_X1);
556 } else {
557 pts.push(scanType != INTERSECT_QUAD_NO && scanType != INTERSECT_QUAD_LINE_NO ? 2 : 1);
558 types.push(scanType == INTERSECT_QUAD_NO || scanType == INTERSECT_QUAD || scanType == INTERSECT_QUAD_2 ? 1 : 0);
559 pts.push(scanType == INTERSECT_QUAD_LINE || scanType == INTERSECT_QUAD ? 11
560 : scanType == INTERSECT_QUAD_LINE_2 ? 14 : scanType == INTERSECT_QUAD_2 ? 12 : 7);
561 }
562 ctx.strokeStyle = "red";
563 for (var typeIndex = 0; typeIndex < types.length; ++typeIndex) {
564 var type = types[typeIndex];
565 var index = pts[typeIndex];
566 if (type == 1) {
567 drawQuad(scan[index + 0], scan[index + 1], scan[index + 2], scan[index + 3],
568 scan[index + 4], scan[index + 5], selected);
569 } else {
570 drawLine(scan[index + 0], scan[index + 1], scan[index + 2], scan[index + 3],
571 selected);
572 }
573 }
caryclark@google.comf839c032012-10-26 21:03:50 +0000574 if (debug_xy && selected) {
575 var debugText = "";
caryclark@google.com0b7da432012-10-31 19:00:20 +0000576 for (var typeIndex = 0; typeIndex < types.length; ++typeIndex) {
577 var type = types[typeIndex];
578 var index = pts[typeIndex];
579 for (var idx = pts[typeIndex]; idx < (type == 1 ? pts[typeIndex] + 6 : pts[typeIndex] + 4); idx += 2) {
580 var screenX = (scan[idx] - srcLeft) * scale;
581 var screenY = (scan[idx + 1] - srcTop) * scale;
582 debugText += screenX.toFixed(decimal_places) + ", ";
583 debugText += screenY.toFixed(decimal_places) + " ";
584 }
caryclark@google.comf839c032012-10-26 21:03:50 +0000585 }
586 ctx.fillStyle="blue";
caryclark@google.com0b7da432012-10-31 19:00:20 +0000587 ctx.fillText(debugText, 50, partIndex * 50 + 100);
caryclark@google.comf839c032012-10-26 21:03:50 +0000588 }
589 if (ptLabels && selected) {
590 ctx.fillStyle="blue";
caryclark@google.com0b7da432012-10-31 19:00:20 +0000591 for (var typeIndex = 0; typeIndex < types.length; ++typeIndex) {
592 var type = types[typeIndex];
593 var index = pts[typeIndex];
594 for (var idx = pts[typeIndex]; idx < (type == 1 ? pts[typeIndex] + 6 : pts[typeIndex] + 4); idx += 2) {
595 drawPoint(scan[idx], scan[idx + 1]);
596 }
caryclark@google.comf839c032012-10-26 21:03:50 +0000597 }
598 }
caryclark@google.com0b7da432012-10-31 19:00:20 +0000599 var infoText = "";
caryclark@google.comf839c032012-10-26 21:03:50 +0000600 if (info_mode && selected) {
caryclark@google.com0b7da432012-10-31 19:00:20 +0000601 infoText += hasId >= 0 ? "id=" + scan[hasId] : partIndex;
602 }
603 if (intersect_mode && selected) {
604 if (scanType == ACTIVE_QUAD_SPAN) {
605 infoText += " t=" + scan[SPAN_Q_T];
606 } else if (scanType == ACTIVE_LINE_SPAN) {
607 infoText += " t=" + scan[SPAN_L_T];
608 } else if (scanType == INTERSECT_QUAD_LINE ||scanType == INTERSECT_QUAD) {
609 infoText += " t0[0]=" + scan[1] + " t1[0]=" + scan[10];
610 } else if (scanType == INTERSECT_QUAD_LINE_2 || scanType == INTERSECT_QUAD_2) {
611 infoText += " t0[0]=" + scan[1] + " t0[1]=" + scan[10] + " t1[0]=" + scan[13];
612 if (scanType == INTERSECT_QUAD_LINE_2) {
613 infoText += " t1[1]=" + scan[18];
614 } else {
615 infoText += " t0[1]=" + scan[20];
616 }
617 }
618 }
619 if (infoText.length > 0) {
caryclark@google.comf839c032012-10-26 21:03:50 +0000620 ctx.fillStyle="green";
caryclark@google.com0b7da432012-10-31 19:00:20 +0000621 ctx.fillText(infoText, 10, (hasId >= 0 && sequence >= 0
622 ? hasId : partIndex) * 30 + 50);
caryclark@google.comf839c032012-10-26 21:03:50 +0000623 }
624 if (intersect_mode && selected) {
625 ctx.fillStyle="rgba(50,100,200, 1.0)";
caryclark@google.com0b7da432012-10-31 19:00:20 +0000626 if (scanType == ACTIVE_QUAD_SPAN) {
caryclark@google.comf839c032012-10-26 21:03:50 +0000627 drawPoint(scan[SPAN_Q_TX], scan[SPAN_Q_TY]);
caryclark@google.com0b7da432012-10-31 19:00:20 +0000628 } else if (scanType == ACTIVE_LINE_SPAN) {
caryclark@google.comf839c032012-10-26 21:03:50 +0000629 drawPoint(scan[SPAN_L_TX], scan[SPAN_L_TY]);
caryclark@google.com0b7da432012-10-31 19:00:20 +0000630 } else if (scanType != INTERSECT_QUAD_NO && scanType != INTERSECT_QUAD_LINE_NO) {
631 drawPoint(scan[8], scan[9]);
632 if (scanType == INTERSECT_QUAD_LINE_2 || scanType == INTERSECT_QUAD_2) {
633 drawPoint(scan[11], scan[12]);
634 }
caryclark@google.comf839c032012-10-26 21:03:50 +0000635 }
636 }
caryclark@google.com0b7da432012-10-31 19:00:20 +0000637 ctx.strokeStyle = "rgba(0,0,0, 0.2)";
638 scanType = -1;
caryclark@google.comf839c032012-10-26 21:03:50 +0000639 }
caryclark@google.com0b7da432012-10-31 19:00:20 +0000640 drawDeferred();
caryclark@google.comf839c032012-10-26 21:03:50 +0000641}
642
643function drawTop() {
644 init(tests[testIndex]);
645 redraw();
646}
647
648function redraw() {
649 ctx.beginPath();
650 ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height);
651 ctx.fillStyle="white";
652 ctx.fill();
653 draw(tests[testIndex], testTitles[testIndex]);
654}
655
656function doKeyPress(evt) {
657 var char = String.fromCharCode(evt.charCode);
658 switch (char) {
659 case '0':
660 case '1':
661 case '2':
662 case '3':
663 case '4':
664 case '5':
665 case '6':
666 case '7':
667 case '8':
668 case '9':
669 if (digit_mode) {
670 decimal_places = char - '0';
671 } else if (index_mode) {
672 index_bits ^= 1 << (char - '0');
673 }
674 redraw();
675 break;
676 case 'd':
677 digit_mode = true;
678 index_mode = false;
679 break;
680 case 'f':
681 info_mode ^= true;
682 redraw();
683 break;
684 case 'i':
685 digit_mode = false;
686 if (sequence >= 0) {
687 sequence = -1;
688 index_mode = false;
689 } else {
690 index_mode ^= true;
691 }
692 if (index_mode) {
693 index_bits = 0;
694 } else {
695 index_bits = -1;
696 }
697 redraw();
698 break;
699 case 'N':
700 testIndex += 9;
701 case 'n':
702 if (++testIndex >= tests.length)
703 testIndex = 0;
704 drawTop();
705 break;
706 case 'P':
707 testIndex -= 9;
708 case 'p':
709 if (--testIndex < 0)
710 testIndex = tests.length - 1;
711 drawTop();
712 break;
713 case 's':
714 sequence++;
caryclark@google.com0b7da432012-10-31 19:00:20 +0000715 redraw();
716 break;
717 case 'S':
718 sequence--;
719 if (sequence < 0) {
720 sequence = 0;
721 }
722 redraw();
caryclark@google.comf839c032012-10-26 21:03:50 +0000723 break;
724 case 't':
725 intersect_mode ^= true;
726 redraw();
727 break;
728 case 'x':
729 ptLabels ^= true;
730 redraw();
731 break;
732 case 'y':
733 debug_xy ^= true;
734 redraw();
735 break;
736 case '-':
737 scale /= 2;
738 calcLeftTop();
739 redraw();
740 break;
741 case '=':
742 case '+':
743 scale *= 2;
744 calcLeftTop();
745 redraw();
746 break;
747 }
748}
749
750function calcXY() {
751 var e = window.event;
752 var tgt = e.target || e.srcElement;
753 var left = tgt.offsetLeft;
754 var top = tgt.offsetTop;
755 var unit = scale;
756 mouseX = (e.clientX - left) / scale + srcLeft;
757 mouseY = (e.clientY - top) / scale + srcTop;
758}
759
760function calcLeftTop() {
761 srcLeft = mouseX - screenWidth / 2 / scale;
762 srcTop = mouseY - screenHeight / 2 / scale;
763}
764
765function handleMouseClick() {
766 calcXY();
767 calcLeftTop();
768 redraw();
769}
770
771function handleMouseOver() {
772 calcXY();
773 var num = mouseX.toFixed(decimal_places) + ", " + mouseY.toFixed(decimal_places);
774 ctx.beginPath();
775 ctx.rect(300,100,200,10);
776 ctx.fillStyle="white";
777 ctx.fill();
778 ctx.fillStyle="black";
779 ctx.fillText(num, 300, 108);
780}
781
782function start() {
783 for (i = 0; i < testDivs.length; ++i) {
784 var title = testDivs[i].id.toString();
785 var str = testDivs[i].firstChild.data;
786 parse_debugShowActiveSpans(str, title);
caryclark@google.com0b7da432012-10-31 19:00:20 +0000787 parse_intersections(str, title);
caryclark@google.comf839c032012-10-26 21:03:50 +0000788 }
789 drawTop();
790 window.addEventListener('keypress', doKeyPress, true);
791 window.onresize = function() {
792 drawTop();
793 }
794}
795
796</script>
797</head>
798
799<body onLoad="start();">
800<canvas id="canvas" width="750" height="500"
801 onmousemove="handleMouseOver()"
802 onclick="handleMouseClick()"
803 ></canvas >
804</body>
805</html>