OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 | 2 |
3 <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | 3 <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> |
4 <head> | 4 <head> |
5 <meta charset="utf-8" /> | 5 <meta charset="utf-8" /> |
6 <title></title> | 6 <title></title> |
7 <div style="height:0"> | 7 <div style="height:0"> |
| 8 |
| 9 |
8 <div id="sect1"> | 10 <div id="sect1"> |
9 {{{1.80943513, 3.0778243500000002}, {1.66686702, 2.1680693600000001}, {1.6830127
2, 0}, {3, 0}}} id=1 | 11 {{{778, 14089}, {778, 14089.069030761719}, {777.99825114011765, 14089.1376533508
3}, {777.99479530565441, 14089.205825865269}}} id=1 |
10 {{{0, 1}, {0, 2}, {0.75, 2.25}, {1.75, 2.25}}} id=2 | 12 {{{777.99479530565441, 14089.205825865269}, {777.99133947119071, 14089.273998379
707}, {777.98617666214727, 14089.341720819473}, {777.97934876382351, 14089.40895
1282501}}} id=19 |
11 {{{1.75, 2.25}, {2.75, 2.25}, {4, 2}, {5, 2}}} id=4 | 13 {{{777.97934876382351, 14089.408951282501}, {777.96569296717644, 14089.543412208
557}, {777.94537681341171, 14089.675905227661}, {777.9187353849411, 14089.806095
123291}}} id=11 |
| 14 {{{777.9187353849411, 14089.806095123291}, {777.89209395647049, 14089.9362850189
21}, {777.85912725329399, 14090.064171791077}, {777.82017035782337, 14090.189420
223236}}} id=7 |
| 15 {{{777.82017035782337, 14090.189420223236}, {777.78121346235275, 14090.314668655
396}, {777.73626637458801, 14090.437278747559}, {777.68566417694092, 14090.55691
5283203}}} id=13 |
| 16 {{{777.68566417694092, 14090.556915283203}, {777.63506197929382, 14090.676551818
848}, {777.57880467176437, 14090.793214797974}, {777.51722733676434, 14090.90656
9004059}}} id=5 |
| 17 {{{777.51722733676434, 14090.906569004059}, {777.4556500017643, 14091.0199232101
48}, {777.38875263929367, 14091.129968643181}, {777.31687033176422, 14091.236370
08667}}} id=15 |
| 18 {{{777.31687033176422, 14091.23637008667}, {777.24498802423477, 14091.3427715301
51}, {777.1681207716465, 14091.44552898407}, {777.08660365641117, 14091.54430723
1903}}} id=9 |
| 19 {{{777.08660365641117, 14091.544307231903}, {777.00508654117584, 14091.643085479
736}, {776.91891956329346, 14091.737884521484}, {776.82843780517578, 14091.82836
9140625}}} id=17 |
| 20 |
| 21 {{{778, 14089}, {777.99997329711914, 14089.103515625}, {777.99537348747253, 1408
9.205139160156}}} id=2 |
| 22 {{{777.99537348747253, 14089.205139160156}, {777.99077367782593, 14089.306762695
312}, {777.98160076141357, 14089.406494140625}}} id=18 |
| 23 {{{777.98160076141357, 14089.406494140625}, {777.96325492858887, 14089.605957031
25}, {777.92661666870117, 14089.7978515625}}} id=10 |
| 24 {{{777.92661666870117, 14089.7978515625}, {777.88997840881348, 14089.98974609375
}, {777.83504772186279, 14090.174072265625}}} id=6 |
| 25 {{{777.83504772186279, 14090.174072265625}, {777.78011703491211, 14090.358398437
5}, {777.70689392089844, 14090.53515625}}} id=12 |
| 26 {{{777.70689392089844, 14090.53515625}, {777.63367080688477, 14090.7119140625},
{777.54215526580811, 14090.881103515625}}} id=4 |
| 27 {{{777.54215526580811, 14090.881103515625}, {777.45063972473145, 14091.050292968
75}, {777.3408317565918, 14091.2119140625}}} id=14 |
| 28 {{{777.3408317565918, 14091.2119140625}, {777.23102378845215, 14091.37353515625}
, {777.10292339324951, 14091.527587890625}}} id=8 |
| 29 {{{777.10292339324951, 14091.527587890625}, {776.97482299804687, 14091.681640625
}, {776.82843017578125, 14091.828125}}} id=16 |
12 </div> | 30 </div> |
13 | 31 |
14 <div id="sect2"> | 32 <div id="sect2"> |
15 {{{1.80943513, 3.0778243500000002}, {1.66686702, 2.1680693600000001}, {1.6830127
2, 0}, {3, 0}}} id=1 | 33 {{{777.9187353849411, 14089.806095123291}, {777.89209395647049, 14089.9362850189
21}, {777.85912725329399, 14090.064171791077}, {777.82017035782337, 14090.189420
223236}}} id=7 |
16 {{{0, 1}, {0, 2}, {0.75, 2.25}, {1.75, 2.25}}} id=2 | 34 {{{777.82017035782337, 14090.189420223236}, {777.78121346235275, 14090.314668655
396}, {777.73626637458801, 14090.437278747559}, {777.68566417694092, 14090.55691
5283203}}} id=13 |
17 {{{1.75, 2.25}, {2.2500000000000018, 2.25}, {2.8124999999999991, 2.1875}, {3.375
, 2.125}}} id=4 | 35 {{{777.68566417694092, 14090.556915283203}, {777.63506197929382, 14090.676551818
848}, {777.57880467176437, 14090.793214797974}, {777.51722733676434, 14090.90656
9004059}}} id=5 |
| 36 {{{777.51722733676434, 14090.906569004059}, {777.4556500017643, 14091.0199232101
48}, {777.38875263929367, 14091.129968643181}, {777.31687033176422, 14091.236370
08667}}} id=15 |
| 37 {{{777.31687033176422, 14091.23637008667}, {777.24498802423477, 14091.3427715301
51}, {777.1681207716465, 14091.44552898407}, {777.08660365641117, 14091.54430723
1903}}} id=9 |
| 38 {{{777.08660365641117, 14091.544307231903}, {777.00508654117584, 14091.643085479
736}, {776.91891956329346, 14091.737884521484}, {776.82843780517578, 14091.82836
9140625}}} id=17 |
| 39 {{{777.83504772186279, 14090.174072265625}, {777.78011703491211, 14090.358398437
5}, {777.70689392089844, 14090.53515625}}} id=12 |
| 40 {{{777.70689392089844, 14090.53515625}, {777.63367080688477, 14090.7119140625},
{777.54215526580811, 14090.881103515625}}} id=4 |
| 41 {{{777.54215526580811, 14090.881103515625}, {777.45063972473145, 14091.050292968
75}, {777.3408317565918, 14091.2119140625}}} id=14 |
| 42 {{{777.3408317565918, 14091.2119140625}, {777.23102378845215, 14091.37353515625}
, {777.10292339324951, 14091.527587890625}}} id=8 |
| 43 {{{777.10292339324951, 14091.527587890625}, {776.97482299804687, 14091.681640625
}, {776.82843017578125, 14091.828125}}} id=16 |
18 </div> | 44 </div> |
19 | 45 |
20 <div id="sect3"> | 46 <div id="sect3"> |
21 {{{1.80943513, 3.0778243500000002}, {1.738151075, 2.6229468550000004}, {1.706545
4725, 1.8534907675000001}, {1.85738429375, 1.19775405375}}} id=1 | 47 {{{778, 14089}, {777.99994659423828, 14089.20703125}, {777.98160076141357, 14089
.406494140625}}} id=2 |
22 {{{0, 1}, {0, 2}, {0.75, 2.25}, {1.75, 2.25}}} id=2 | 48 {{{777.98160076141357, 14089.406494140625}, {777.96325492858887, 14089.605957031
25}, {777.92661666870117, 14089.7978515625}}} id=10 |
23 {{{1.75, 2.25}, {2.2500000000000018, 2.25}, {2.8124999999999991, 2.1875}, {3.375
, 2.125}}} id=4 | 49 {{{777.92661666870117, 14089.7978515625}, {777.88997840881348, 14089.98974609375
}, {777.83504772186279, 14090.174072265625}}} id=6 |
24 </div> | 50 {{{777.83504772186279, 14090.174072265625}, {777.78011703491211, 14090.358398437
5}, {777.70689392089844, 14090.53515625}}} id=12 |
25 | 51 {{{777.70689392089844, 14090.53515625}, {777.63367080688477, 14090.7119140625},
{777.54215526580811, 14090.881103515625}}} id=4 |
26 <div id="sect4"> | 52 {{{777.54215526580811, 14090.881103515625}, {777.45063972473145, 14091.050292968
75}, {777.3408317565918, 14091.2119140625}}} id=14 |
27 {{{1.80943513, 3.0778243500000002}, {1.7737931025, 2.8503856025000003}, {1.74807
06881249999, 2.5443022068750003}, {1.7501136332812499, 2.2131114089062502}}} id=
1 | 53 {{{777.3408317565918, 14091.2119140625}, {777.1212158203125, 14091.53515625}, {7
76.82843017578125, 14091.828125}}} id=8 |
28 {{{0, 1}, {0, 2}, {0.75, 2.25}, {1.75, 2.25}}} id=2 | 54 {{{778, 14089}, {778, 14089.138061523438}, {777.99300456047058, 14089.2744903564
45}, {777.97934876382351, 14089.408951282501}}} id=1 |
29 {{{1.75, 2.25}, {2.2500000000000018, 2.25}, {2.8124999999999991, 2.1875}, {3.375
, 2.125}}} id=4 | 55 {{{777.97934876382351, 14089.408951282501}, {777.96569296717644, 14089.543412208
557}, {777.94537681341171, 14089.675905227661}, {777.9187353849411, 14089.806095
123291}}} id=11 |
30 </div> | 56 {{{777.9187353849411, 14089.806095123291}, {777.89209395647049, 14089.9362850189
21}, {777.85912725329399, 14090.064171791077}, {777.82017035782337, 14090.189420
223236}}} id=7 |
31 | 57 {{{777.82017035782337, 14090.189420223236}, {777.78121346235275, 14090.314668655
396}, {777.73626637458801, 14090.437278747559}, {777.68566417694092, 14090.55691
5283203}}} id=13 |
32 <div id="sect5"> | 58 {{{777.68566417694092, 14090.556915283203}, {777.63506197929382, 14090.676551818
848}, {777.57880467176437, 14090.793214797974}, {777.51722733676434, 14090.90656
9004059}}} id=5 |
33 {{{1.80943513, 3.0778243500000002}, {1.7737931025, 2.8503856025000003}, {1.74807
06881249999, 2.5443022068750003}, {1.7501136332812499, 2.2131114089062502}}} id=
1 | 59 {{{777.51722733676434, 14090.906569004059}, {777.4556500017643, 14091.0199232101
48}, {777.38875263929367, 14091.129968643181}, {777.31687033176422, 14091.236370
08667}}} id=15 |
34 {{{0.5, 2}, {0.81249999999999956, 2.1874999999999987}, {1.2500000000000009, 2.25
00000000000013}, {1.75, 2.25}}} id=8 | 60 {{{777.31687033176422, 14091.23637008667}, {777.17310571670532, 14091.4491729736
33}, {777.00940132141113, 14091.647399902344}, {776.82843780517578, 14091.828369
140625}}} id=9 |
35 {{{1.75, 2.25}, {2.2500000000000018, 2.25}, {2.8124999999999991, 2.1875}, {3.375
, 2.125}}} id=4 | |
36 </div> | |
37 | |
38 <div id="sect6"> | |
39 {{{1.80943513, 3.0778243500000002}, {1.7737931025, 2.8503856025000003}, {1.74807
06881249999, 2.5443022068750003}, {1.7501136332812499, 2.2131114089062502}}} id=
1 | |
40 {{{0.5, 2}, {0.81249999999999956, 2.1874999999999987}, {1.2500000000000009, 2.25
00000000000013}, {1.75, 2.25}}} id=8 | |
41 {{{1.75, 2.25}, {1.9999999999999976, 2.25}, {2.2656250000000022, 2.234375}, {2.5
390625, 2.2109375}}} id=4 | |
42 </div> | |
43 | |
44 <div id="sect7"> | |
45 {{{1.80943513, 3.0778243500000002}, {1.7737931025, 2.8503856025000003}, {1.74807
06881249999, 2.5443022068750003}, {1.7501136332812499, 2.2131114089062502}}} id=
1 | |
46 {{{1.0546875, 2.1953125}, {1.2656250000000009, 2.2343750000000009}, {1.499999999
9999996, 2.2499999999999996}, {1.75, 2.25}}} id=12 | |
47 {{{1.75, 2.25}, {1.9999999999999976, 2.25}, {2.2656250000000022, 2.234375}, {2.5
390625, 2.2109375}}} id=4 | |
48 </div> | |
49 | |
50 <div id="sect8"> | |
51 {{{1.7656425168945311, 2.6843748983789064}, {1.7550120280078125, 2.5380253562890
633}, {1.7490921607031253, 2.3787068078906248}, {1.7501136332812499, 2.213111408
9062502}}} id=7 | |
52 {{{1.0546875, 2.1953125}, {1.2656250000000009, 2.2343750000000009}, {1.499999999
9999996, 2.2499999999999996}, {1.75, 2.25}}} id=12 | |
53 {{{1.75, 2.25}, {1.9999999999999976, 2.25}, {2.2656250000000022, 2.234375}, {2.5
390625, 2.2109375}}} id=4 | |
54 </div> | |
55 | |
56 <div id="sect9"> | |
57 {{{1.7656425168945311, 2.6843748983789064}, {1.7550120280078125, 2.5380253562890
633}, {1.7490921607031253, 2.3787068078906248}, {1.7501136332812499, 2.213111408
9062502}}} id=7 | |
58 {{{1.0546875, 2.1953125}, {1.2656250000000009, 2.2343750000000009}, {1.499999999
9999996, 2.2499999999999996}, {1.75, 2.25}}} id=12 | |
59 {{{1.75, 2.25}, {1.8750000000000016, 2.2499999999999991}, {2.0039062499999982, 2
.2460937500000004}, {2.1357421875, 2.2392578125}}} id=4 | |
60 </div> | |
61 | |
62 <div id="sect10"> | |
63 {{{1.7656425168945311, 2.6843748983789064}, {1.7550120280078125, 2.5380253562890
633}, {1.7490921607031253, 2.3787068078906248}, {1.7501136332812499, 2.213111408
9062502}}} id=7 | |
64 {{{1.3876953125, 2.2373046875}, {1.50390625, 2.24609375}, {1.625, 2.25}, {1.75,
2.25}}} id=16 | |
65 {{{1.75, 2.25}, {1.8750000000000016, 2.2499999999999991}, {2.0039062499999982, 2
.2460937500000004}, {2.1357421875, 2.2392578125}}} id=4 | |
66 </div> | |
67 | |
68 <div id="sect11"> | |
69 {{{1.7535085895385742, 2.4559603499780276}, {1.7508274956738286, 2.3771375952441
409}, {1.7496028969921869, 2.2959091083984369}, {1.7501136332812499, 2.213111408
9062502}}} id=9 | |
70 {{{1.3876953125, 2.2373046875}, {1.50390625, 2.24609375}, {1.625, 2.25}, {1.75,
2.25}}} id=16 | |
71 {{{1.75, 2.25}, {1.8750000000000016, 2.2499999999999991}, {2.0039062499999982, 2
.2460937500000004}, {2.1357421875, 2.2392578125}}} id=4 | |
72 </div> | |
73 | |
74 <div id="sect12"> | |
75 {{{1.7535085895385742, 2.4559603499780276}, {1.7508274956738286, 2.3771375952441
409}, {1.7496028969921869, 2.2959091083984369}, {1.7501136332812499, 2.213111408
9062502}}} id=9 | |
76 {{{1.3876953125, 2.2373046875}, {1.50390625, 2.24609375}, {1.625, 2.25}, {1.75,
2.25}}} id=16 | |
77 {{{1.75, 2.25}, {1.8124999999999989, 2.2499999999999996}, {1.8759765625000011, 2
.2490234374999996}, {1.9403076171875, 2.2471923828125}}} id=4 | |
78 </div> | |
79 | |
80 <div id="sect13"> | |
81 {{{1.7535085895385742, 2.4559603499780276}, {1.7508274956738286, 2.3771375952441
409}, {1.7496028969921869, 2.2959091083984369}, {1.7501136332812499, 2.213111408
9062502}}} id=9 | |
82 {{{1.5655517578125, 2.2469482421875}, {1.6259765625, 2.2490234375}, {1.6875, 2.2
5}, {1.75, 2.25}}} id=20 | |
83 {{{1.75, 2.25}, {1.8124999999999989, 2.2499999999999996}, {1.8759765625000011, 2
.2490234374999996}, {1.9403076171875, 2.2471923828125}}} id=4 | |
84 </div> | |
85 | |
86 <div id="sect14"> | |
87 {{{1.7506141751022339, 2.3360264837265015}, {1.7500367307348632, 2.2955168052368
169}, {1.7498582651367187, 2.2545102586523438}, {1.7501136332812499, 2.213111408
9062502}}} id=11 | |
88 {{{1.5655517578125, 2.2469482421875}, {1.6259765625, 2.2490234375}, {1.6875, 2.2
5}, {1.75, 2.25}}} id=20 | |
89 {{{1.75, 2.25}, {1.8124999999999989, 2.2499999999999996}, {1.8759765625000011, 2
.2490234374999996}, {1.9403076171875, 2.2471923828125}}} id=4 | |
90 </div> | |
91 | |
92 <div id="sect15"> | |
93 {{{1.7506141751022339, 2.3360264837265015}, {1.7500367307348632, 2.2955168052368
169}, {1.7498582651367187, 2.2545102586523438}, {1.7501136332812499, 2.213111408
9062502}}} id=11 | |
94 {{{1.5655517578125, 2.2469482421875}, {1.6259765625, 2.2490234375}, {1.6875, 2.2
5}, {1.75, 2.25}}} id=20 | |
95 {{{1.75, 2.25}, {1.7812500000000011, 2.2500000000000004}, {1.8127441406249989, 2
.2497558593749991}, {1.8444671630859375, 2.2492828369140625}}} id=4 | |
96 </div> | |
97 | |
98 <div id="sect16"> | |
99 {{{1.7506141751022339, 2.3360264837265015}, {1.7500367307348632, 2.2955168052368
169}, {1.7498582651367187, 2.2545102586523438}, {1.7501136332812499, 2.213111408
9062502}}} id=11 | |
100 {{{1.6569976806640625, 2.2492523193359375}, {1.687744140625, 2.249755859375}, {1
.71875, 2.25}, {1.75, 2.25}}} id=24 | |
101 {{{1.75, 2.25}, {1.7812500000000011, 2.2500000000000004}, {1.8127441406249989, 2
.2497558593749991}, {1.8444671630859375, 2.2492828369140625}}} id=4 | |
102 </div> | |
103 | |
104 <div id="sect17"> | |
105 {{{1.7500515994997787, 2.274902385537529}, {1.7499667235723877, 2.25441218286193
79}, {1.7499859492089846, 2.2338108337792986}, {1.7501136332812499, 2.2131114089
062502}}} id=13 | |
106 {{{1.6569976806640625, 2.2492523193359375}, {1.687744140625, 2.249755859375}, {1
.71875, 2.25}, {1.75, 2.25}}} id=24 | |
107 {{{1.75, 2.25}, {1.7812500000000011, 2.2500000000000004}, {1.8127441406249989, 2
.2497558593749991}, {1.8444671630859375, 2.2492828369140625}}} id=4 | |
108 </div> | |
109 | |
110 <div id="sect18"> | |
111 {{{1.7500515994997787, 2.274902385537529}, {1.7499667235723877, 2.25441218286193
79}, {1.7499859492089846, 2.2338108337792986}, {1.7501136332812499, 2.2131114089
062502}}} id=13 | |
112 {{{1.6569976806640625, 2.2492523193359375}, {1.687744140625, 2.249755859375}, {1
.71875, 2.25}, {1.75, 2.25}}} id=24 | |
113 {{{1.75, 2.25}, {1.7656249999999989, 2.25}, {1.7813110351562511, 2.2499389648437
5}, {1.7970561981201172, 2.2498188018798828}}} id=4 | |
114 </div> | |
115 | |
116 <div id="sect19"> | |
117 {{{1.7500515994997787, 2.274902385537529}, {1.7499667235723877, 2.25441218286193
79}, {1.7499859492089846, 2.2338108337792986}, {1.7501136332812499, 2.2131114089
062502}}} id=13 | |
118 {{{1.7033100128173828, 2.2498149871826172}, {1.7188110351562504, 2.2499389648437
504}, {1.7343749999999991, 2.2499999999999991}, {1.75, 2.25}}} id=28 | |
119 {{{1.75, 2.25}, {1.7656249999999989, 2.25}, {1.7813110351562511, 2.2499389648437
5}, {1.7970561981201172, 2.2498188018798828}}} id=4 | |
120 </div> | |
121 | |
122 <div id="sect20"> | |
123 {{{1.7500515994997787, 2.274902385537529}, {1.7500091615360831, 2.26465728419973
37}, {1.7499927489633849, 2.2543843962601757}, {1.7500029063906433, 2.2440853555
459359}}} id=13 | |
124 {{{1.7033100128173828, 2.2498149871826172}, {1.7188110351562504, 2.2499389648437
504}, {1.7343749999999991, 2.2499999999999991}, {1.75, 2.25}}} id=28 | |
125 {{{1.75, 2.25}, {1.7656249999999989, 2.25}, {1.7813110351562511, 2.2499389648437
5}, {1.7970561981201172, 2.2498188018798828}}} id=4 | |
126 </div> | |
127 | |
128 <div id="sect21"> | |
129 {{{1.7500515994997787, 2.274902385537529}, {1.7500091615360831, 2.26465728419973
37}, {1.7499927489633849, 2.2543843962601757}, {1.7500029063906433, 2.2440853555
459359}}} id=13 | |
130 {{{1.7033100128173828, 2.2498149871826172}, {1.7188110351562504, 2.2499389648437
504}, {1.7343749999999991, 2.2499999999999991}, {1.75, 2.25}}} id=28 | |
131 {{{1.75, 2.25}, {1.7578125000000004, 2.25}, {1.7656402587890616, 2.2499847412109
375}, {1.7734830379486084, 2.2499544620513916}}} id=4 | |
132 </div> | |
133 | |
134 <div id="sect22"> | |
135 {{{1.7500515994997787, 2.274902385537529}, {1.7500091615360831, 2.26465728419973
37}, {1.7499927489633849, 2.2543843962601757}, {1.7500029063906433, 2.2440853555
459359}}} id=13 | |
136 {{{1.7266085147857666, 2.2499539852142334}, {1.7343902587890614, 2.2499847412109
362}, {1.7421875000000011, 2.2500000000000013}, {1.75, 2.25}}} id=32 | |
137 {{{1.75, 2.25}, {1.7578125000000004, 2.25}, {1.7656402587890616, 2.2499847412109
375}, {1.7734830379486084, 2.2499544620513916}}} id=4 | |
138 </div> | |
139 | |
140 <div id="sect23"> | |
141 {{{1.7500075296736033, 2.2595140978078994}, {1.749999391463374, 2.25437785806650
53}, {1.7499978276770138, 2.2492348759030554}, {1.7500029063906433, 2.2440853555
459359}}} id=17 | |
142 {{{1.7266085147857666, 2.2499539852142334}, {1.7343902587890614, 2.2499847412109
362}, {1.7421875000000011, 2.2500000000000013}, {1.75, 2.25}}} id=32 | |
143 {{{1.75, 2.25}, {1.7578125000000004, 2.25}, {1.7656402587890616, 2.2499847412109
375}, {1.7734830379486084, 2.2499544620513916}}} id=4 | |
144 </div> | |
145 | |
146 <div id="sect24"> | |
147 {{{1.7500075296736033, 2.2595140978078994}, {1.749999391463374, 2.25437785806650
53}, {1.7499978276770138, 2.2492348759030554}, {1.7500029063906433, 2.2440853555
459359}}} id=17 | |
148 {{{1.7266085147857666, 2.2499539852142334}, {1.7343902587890614, 2.2499847412109
362}, {1.7421875000000011, 2.2500000000000013}, {1.75, 2.25}}} id=32 | |
149 {{{1.75, 2.25}, {1.7539062499999991, 2.25}, {1.7578163146972661, 2.2499961853027
344}, {1.7617301642894745, 2.2499885857105255}}} id=4 | |
150 </div> | |
151 | |
152 <div id="sect25"> | |
153 {{{1.7500075296736033, 2.2595140978078994}, {1.749999391463374, 2.25437785806650
53}, {1.7499978276770138, 2.2492348759030554}, {1.7500029063906433, 2.2440853555
459359}}} id=17 | |
154 {{{1.7382927238941193, 2.2499885261058807}, {1.7421913146972665, 2.2499961853027
353}, {1.7460937499999996, 2.2499999999999996}, {1.75, 2.25}}} id=36 | |
155 {{{1.75, 2.25}, {1.7539062499999991, 2.25}, {1.7578163146972661, 2.2499961853027
344}, {1.7617301642894745, 2.2499885857105255}}} id=4 | |
156 </div> | |
157 | |
158 <div id="sect26"> | |
159 {{{1.7500002616856762, 2.2518047069078144}, {1.7499994883020116, 2.2492332413546
396}, {1.7500003670338282, 2.2466601157244943}, {1.7500029063906433, 2.244085355
5459359}}} id=19 | |
160 {{{1.75, 2.25}, {1.7539062499999991, 2.25}, {1.7578163146972661, 2.2499961853027
344}, {1.7617301642894745, 2.2499885857105255}}} id=4 | |
161 </div> | |
162 | |
163 <div id="sect27"> | |
164 {{{1.7500002616856762, 2.2518047069078144}, {1.7499994883020116, 2.2492332413546
396}, {1.7500003670338282, 2.2466601157244943}, {1.7500029063906433, 2.244085355
5459359}}} id=19 | |
165 {{{1.75, 2.25}, {1.7519531250000011, 2.2499999999999991}, {1.7539072036743153, 2
.249999046325684}, {1.7558622322976589, 2.2499971427023411}}} id=4 | |
166 </div> | |
167 | |
168 <div id="sect28"> | |
169 {{{1.7500002616856762, 2.2518047069078144}, {1.749999874993843, 2.25051897413122
73}, {1.7499999013308822, 2.2492328263353962}, {1.7500003417604797, 2.2479462667
113941}}} id=19 | |
170 {{{1.75, 2.25}, {1.7519531250000011, 2.2499999999999991}, {1.7539072036743153, 2
.249999046325684}, {1.7558622322976589, 2.2499971427023411}}} id=4 | |
171 </div> | |
172 | |
173 <div id="sect29"> | |
174 {{{1.7500002616856762, 2.2518047069078144}, {1.749999874993843, 2.25051897413122
73}, {1.7499999013308822, 2.2492328263353962}, {1.7500003417604797, 2.2479462667
113941}}} id=19 | |
175 {{{1.75, 2.25}, {1.7509765624999989, 2.2499999999999996}, {1.7519533634185802, 2
.2499997615814205}, {1.752930402290076, 2.249999285209924}}} id=4 | |
176 </div> | |
177 | |
178 <div id="sect30"> | |
179 {{{1.7500002616856762, 2.2518047069078144}, {1.7500000683397601, 2.2511618405195
208}, {1.7499999782510609, 2.2505188703764163}, {1.7499999915525417, 2.249875796
8773848}}} id=19 | |
180 {{{1.75, 2.25}, {1.7509765624999989, 2.2499999999999996}, {1.7519533634185802, 2
.2499997615814205}, {1.752930402290076, 2.249999285209924}}} id=4 | |
181 </div> | |
182 | |
183 <div id="sect31"> | |
184 {{{1.7500002616856762, 2.2518047069078144}, {1.7500000683397601, 2.2511618405195
208}, {1.7499999782510609, 2.2505188703764163}, {1.7499999915525417, 2.249875796
8773848}}} id=19 | |
185 {{{1.75, 2.25}, {1.7504882812500011, 2.2500000000000004}, {1.7509766221046437, 2
.2499999403953543}, {1.7514650225057267, 2.2499998212442733}}} id=4 | |
186 </div> | |
187 | |
188 <div id="sect32"> | |
189 {{{1.7500000491263352, 2.2508403295591259}, {1.7500000040986061, 2.2505188445374
351}, {1.7499999849018013, 2.2501973336269003}, {1.7499999915525417, 2.249875796
8773848}}} id=25 | |
190 {{{1.75, 2.25}, {1.7504882812500011, 2.2500000000000004}, {1.7509766221046437, 2
.2499999403953543}, {1.7514650225057267, 2.2499998212442733}}} id=4 | |
191 </div> | |
192 | |
193 <div id="sect33"> | |
194 {{{1.7500000491263352, 2.2508403295591259}, {1.7500000040986061, 2.2505188445374
351}, {1.7499999849018013, 2.2501973336269003}, {1.7499999915525417, 2.249875796
8773848}}} id=25 | |
195 {{{1.75, 2.25}, {1.7502441406249989, 2.25}, {1.7504882961511623, 2.2499999850988
388}, {1.7507324665712076, 2.2499999553037924}}} id=4 | |
196 </div> | |
197 | |
198 <div id="sect34"> | |
199 {{{1.7500000009600125, 2.2503580826161893}, {1.7499999913636877, 2.2501973271671
556}, {1.7499999882271713, 2.2500365652521426}, {1.7499999915525417, 2.249875796
8773848}}} id=27 | |
200 {{{1.75, 2.25}, {1.7502441406249989, 2.25}, {1.7504882961511623, 2.2499999850988
388}, {1.7507324665712076, 2.2499999553037924}}} id=4 | |
201 </div> | |
202 | |
203 <div id="sect35"> | |
204 {{{1.7500000009600125, 2.2503580826161893}, {1.7499999913636877, 2.2501973271671
556}, {1.7499999882271713, 2.2500365652521426}, {1.7499999915525417, 2.249875796
8773848}}} id=27 | |
205 {{{1.75, 2.25}, {1.7501220703125004, 2.25}, {1.7502441443502894, 2.2499999962747
097}, {1.7503662221124614, 2.2499999888250386}}} id=4 | |
206 </div> | |
207 | |
208 <div id="sect36"> | |
209 </div> | 61 </div> |
210 | 62 |
211 </div> | 63 </div> |
212 | 64 |
213 <script type="text/javascript"> | 65 <script type="text/javascript"> |
214 | 66 |
215 var testDivs = [ | 67 var testDivs = [ |
216 sect1, | 68 sect1, |
217 sect2, | 69 sect2, |
218 sect3, | 70 sect3, |
219 sect4, | 71 ]; |
220 sect5, | |
221 sect6, | |
222 sect7, | |
223 sect8, | |
224 sect9, | |
225 sect10, | |
226 sect11, | |
227 sect12, | |
228 sect13, | |
229 sect14, | |
230 sect15, | |
231 sect16, | |
232 sect17, | |
233 sect18, | |
234 sect19, | |
235 sect20, | |
236 sect21, | |
237 sect22, | |
238 sect23, | |
239 sect24, | |
240 sect25, | |
241 sect26, | |
242 sect27, | |
243 sect28, | |
244 sect29, | |
245 sect30, | |
246 sect31, | |
247 sect32, | |
248 sect33, | |
249 sect34, | |
250 sect35, | |
251 sect36, | |
252 | |
253 | |
254 ]; | |
255 | 72 |
256 var decimal_places = 3; | 73 var decimal_places = 3; |
257 | 74 |
258 var tests = []; | 75 var tests = []; |
259 var testTitles = []; | 76 var testTitles = []; |
260 var testIndex = 0; | 77 var testIndex = 0; |
261 var ctx; | 78 var ctx; |
262 | 79 |
263 var subscale = 1; | 80 var subscale = 1; |
264 var xmin, xmax, ymin, ymax; | 81 var xmin, xmax, ymin, ymax; |
265 var scale; | 82 var scale; |
266 var initScale; | 83 var initScale; |
267 var mouseX, mouseY; | 84 var mouseX, mouseY; |
268 var mouseDown = false; | 85 var mouseDown = false; |
269 var srcLeft, srcTop; | 86 var srcLeft, srcTop; |
270 var screenWidth, screenHeight; | 87 var screenWidth, screenHeight; |
271 var drawnPts; | 88 var drawnPts; |
272 var curveT = 0; | 89 var curveT = 0; |
| 90 var curveW = -1; |
273 | 91 |
274 var lastX, lastY; | 92 var lastX, lastY; |
275 var activeCurve = []; | 93 var activeCurve = []; |
276 var activePt; | 94 var activePt; |
277 var ids = []; | 95 var ids = []; |
278 | 96 |
279 var focus_on_selection = 0; | 97 var focus_on_selection = 0; |
280 var draw_t = false; | 98 var draw_t = false; |
| 99 var draw_w = false; |
281 var draw_closest_t = false; | 100 var draw_closest_t = false; |
282 var draw_cubic_red = false; | 101 var draw_cubic_red = false; |
283 var draw_derivative = false; | 102 var draw_derivative = false; |
284 var draw_endpoints = 2; | 103 var draw_endpoints = 2; |
285 var draw_id = false; | 104 var draw_id = 0; |
286 var draw_midpoint = 0; | 105 var draw_midpoint = 0; |
287 var draw_mouse_xy = false; | 106 var draw_mouse_xy = false; |
288 var draw_order = false; | 107 var draw_order = false; |
289 var draw_point_xy = false; | 108 var draw_point_xy = false; |
290 var draw_ray_intersect = false; | 109 var draw_ray_intersect = false; |
291 var draw_quarterpoint = 0; | 110 var draw_quarterpoint = 0; |
292 var draw_tangents = 1; | 111 var draw_tangents = 1; |
293 var draw_sortpoint = 0; | 112 var draw_sortpoint = 0; |
294 var retina_scale = !!window.devicePixelRatio; | 113 var retina_scale = !!window.devicePixelRatio; |
295 | 114 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 canvas.style.height = unscaledHeight + 'px'; | 160 canvas.style.height = unscaledHeight + 'px'; |
342 if (resScale != 1) { | 161 if (resScale != 1) { |
343 ctx.scale(resScale, resScale); | 162 ctx.scale(resScale, resScale); |
344 } | 163 } |
345 xmin = Infinity; | 164 xmin = Infinity; |
346 xmax = -Infinity; | 165 xmax = -Infinity; |
347 ymin = Infinity; | 166 ymin = Infinity; |
348 ymax = -Infinity; | 167 ymax = -Infinity; |
349 for (var curves in test) { | 168 for (var curves in test) { |
350 var curve = test[curves]; | 169 var curve = test[curves]; |
351 var last = curve.length; | 170 var last = curve.length - (curve.length % 2 == 1 ? 1 : 0); |
352 for (var idx = 0; idx < last; idx += 2) { | 171 for (var idx = 0; idx < last; idx += 2) { |
353 xmin = Math.min(xmin, curve[idx]); | 172 xmin = Math.min(xmin, curve[idx]); |
354 xmax = Math.max(xmax, curve[idx]); | 173 xmax = Math.max(xmax, curve[idx]); |
355 ymin = Math.min(ymin, curve[idx + 1]); | 174 ymin = Math.min(ymin, curve[idx + 1]); |
356 ymax = Math.max(ymax, curve[idx + 1]); | 175 ymax = Math.max(ymax, curve[idx + 1]); |
357 } | 176 } |
358 } | 177 } |
359 xmin -= Math.min(1, Math.max(xmax - xmin, ymax - ymin)); | 178 xmin -= Math.min(1, Math.max(xmax - xmin, ymax - ymin)); |
360 var testW = xmax - xmin; | 179 var testW = xmax - xmin; |
361 var testH = ymax - ymin; | 180 var testH = ymax - ymin; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 } | 217 } |
399 | 218 |
400 function dxy_at_t(curve, t) { | 219 function dxy_at_t(curve, t) { |
401 var dxy = {}; | 220 var dxy = {}; |
402 if (curve.length == 6) { | 221 if (curve.length == 6) { |
403 var a = t - 1; | 222 var a = t - 1; |
404 var b = 1 - 2 * t; | 223 var b = 1 - 2 * t; |
405 var c = t; | 224 var c = t; |
406 dxy.x = a * curve[0] + b * curve[2] + c * curve[4]; | 225 dxy.x = a * curve[0] + b * curve[2] + c * curve[4]; |
407 dxy.y = a * curve[1] + b * curve[3] + c * curve[5]; | 226 dxy.y = a * curve[1] + b * curve[3] + c * curve[5]; |
| 227 } else if (curve.length == 7) { |
| 228 var p20x = curve[4] - curve[0]; |
| 229 var p20y = curve[5] - curve[1]; |
| 230 var p10xw = (curve[2] - curve[0]) * curve[6]; |
| 231 var p10yw = (curve[3] - curve[1]) * curve[6]; |
| 232 var coeff0x = curve[6] * p20x - p20x; |
| 233 var coeff0y = curve[6] * p20y - p20y; |
| 234 var coeff1x = p20x - 2 * p10xw; |
| 235 var coeff1y = p20y - 2 * p10yw; |
| 236 dxy.x = t * (t * coeff0x + coeff1x) + p10xw; |
| 237 dxy.y = t * (t * coeff0y + coeff1y) + p10yw; |
408 } else if (curve.length == 8) { | 238 } else if (curve.length == 8) { |
409 var one_t = 1 - t; | 239 var one_t = 1 - t; |
410 var a = curve[0]; | 240 var a = curve[0]; |
411 var b = curve[2]; | 241 var b = curve[2]; |
412 var c = curve[4]; | 242 var c = curve[4]; |
413 var d = curve[6]; | 243 var d = curve[6]; |
414 dxy.x = 3 * ((b - a) * one_t * one_t + 2 * (c - b) * t * one_t + (d - c)
* t * t); | 244 dxy.x = 3 * ((b - a) * one_t * one_t + 2 * (c - b) * t * one_t + (d - c)
* t * t); |
415 a = curve[1]; | 245 a = curve[1]; |
416 b = curve[3]; | 246 b = curve[3]; |
417 c = curve[5]; | 247 c = curve[5]; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 function cubic_roots(A, B, C, D) { | 414 function cubic_roots(A, B, C, D) { |
585 var s = cubic_real_roots(A, B, C, D); | 415 var s = cubic_real_roots(A, B, C, D); |
586 var foundRoots = add_valid_ts(s); | 416 var foundRoots = add_valid_ts(s); |
587 return foundRoots; | 417 return foundRoots; |
588 } | 418 } |
589 | 419 |
590 function ray_curve_intersect(startPt, endPt, curve) { | 420 function ray_curve_intersect(startPt, endPt, curve) { |
591 var adj = endPt[0] - startPt[0]; | 421 var adj = endPt[0] - startPt[0]; |
592 var opp = endPt[1] - startPt[1]; | 422 var opp = endPt[1] - startPt[1]; |
593 var r = []; | 423 var r = []; |
594 for (var n = 0; n < curve.length / 2; ++n) { | 424 var len = (curve.length == 7 ? 6 : curve.length) / 2; |
| 425 for (var n = 0; n < len; ++n) { |
595 r[n] = (curve[n * 2 + 1] - startPt[1]) * adj - (curve[n * 2] - start
Pt[0]) * opp; | 426 r[n] = (curve[n * 2 + 1] - startPt[1]) * adj - (curve[n * 2] - start
Pt[0]) * opp; |
596 } | 427 } |
597 if (curve.length == 6) { | 428 if (curve.length == 6) { |
598 var A = r[2]; | 429 var A = r[2]; |
599 var B = r[1]; | 430 var B = r[1]; |
600 var C = r[0]; | 431 var C = r[0]; |
601 A += C - 2 * B; // A = a - 2*b + c | 432 A += C - 2 * B; // A = a - 2*b + c |
602 B -= C; // B = -(b - c) | 433 B -= C; // B = -(b - c) |
603 return quad_roots(A, 2 * B, C); | 434 return quad_roots(A, 2 * B, C); |
604 } | 435 } |
| 436 if (curve.length == 7) { |
| 437 var A = r[2]; |
| 438 var B = r[1] * curve[6]; |
| 439 var C = r[0]; |
| 440 A += C - 2 * B; // A = a - 2*b + c |
| 441 B -= C; // B = -(b - c) |
| 442 return quad_roots(A, 2 * B, C); |
| 443 } |
605 var A = r[3]; // d | 444 var A = r[3]; // d |
606 var B = r[2] * 3; // 3*c | 445 var B = r[2] * 3; // 3*c |
607 var C = r[1] * 3; // 3*b | 446 var C = r[1] * 3; // 3*b |
608 var D = r[0]; // a | 447 var D = r[0]; // a |
609 A -= D - C + B; // A = -a + 3*b - 3*c + d | 448 A -= D - C + B; // A = -a + 3*b - 3*c + d |
610 B += 3 * D - 2 * C; // B = 3*a - 6*b + 3*c | 449 B += 3 * D - 2 * C; // B = 3*a - 6*b + 3*c |
611 C -= 3 * D; // C = -3*a + 3*b | 450 C -= 3 * D; // C = -3*a + 3*b |
612 return cubic_roots(A, B, C, D); | 451 return cubic_roots(A, B, C, D); |
613 } | 452 } |
614 | 453 |
615 function x_at_t(curve, t) { | 454 function x_at_t(curve, t) { |
616 var one_t = 1 - t; | 455 var one_t = 1 - t; |
617 if (curve.length == 4) { | 456 if (curve.length == 4) { |
618 return one_t * curve[0] + t * curve[2]; | 457 return one_t * curve[0] + t * curve[2]; |
619 } | 458 } |
620 var one_t2 = one_t * one_t; | 459 var one_t2 = one_t * one_t; |
621 var t2 = t * t; | 460 var t2 = t * t; |
622 if (curve.length == 6) { | 461 if (curve.length == 6) { |
623 return one_t2 * curve[0] + 2 * one_t * t * curve[2] + t2 * curve[4]; | 462 return one_t2 * curve[0] + 2 * one_t * t * curve[2] + t2 * curve[4]; |
624 } | 463 } |
| 464 if (curve.length == 7) { |
| 465 var numer = one_t2 * curve[0] + 2 * one_t * t * curve[2] * curve[6] |
| 466 + t2 * curve[4]; |
| 467 var denom = one_t2 + 2 * one_t * t * curve[6] |
| 468 + t2; |
| 469 return numer / denom; |
| 470 } |
625 var a = one_t2 * one_t; | 471 var a = one_t2 * one_t; |
626 var b = 3 * one_t2 * t; | 472 var b = 3 * one_t2 * t; |
627 var c = 3 * one_t * t2; | 473 var c = 3 * one_t * t2; |
628 var d = t2 * t; | 474 var d = t2 * t; |
629 return a * curve[0] + b * curve[2] + c * curve[4] + d * curve[6]; | 475 return a * curve[0] + b * curve[2] + c * curve[4] + d * curve[6]; |
630 } | 476 } |
631 | 477 |
632 function y_at_t(curve, t) { | 478 function y_at_t(curve, t) { |
633 var one_t = 1 - t; | 479 var one_t = 1 - t; |
634 if (curve.length == 4) { | 480 if (curve.length == 4) { |
635 return one_t * curve[1] + t * curve[3]; | 481 return one_t * curve[1] + t * curve[3]; |
636 } | 482 } |
637 var one_t2 = one_t * one_t; | 483 var one_t2 = one_t * one_t; |
638 var t2 = t * t; | 484 var t2 = t * t; |
639 if (curve.length == 6) { | 485 if (curve.length == 6) { |
640 return one_t2 * curve[1] + 2 * one_t * t * curve[3] + t2 * curve[5]; | 486 return one_t2 * curve[1] + 2 * one_t * t * curve[3] + t2 * curve[5]; |
641 } | 487 } |
| 488 if (curve.length == 7) { |
| 489 var numer = one_t2 * curve[1] + 2 * one_t * t * curve[3] * curve[6] |
| 490 + t2 * curve[5]; |
| 491 var denom = one_t2 + 2 * one_t * t * curve[6] |
| 492 + t2; |
| 493 return numer / denom; |
| 494 } |
642 var a = one_t2 * one_t; | 495 var a = one_t2 * one_t; |
643 var b = 3 * one_t2 * t; | 496 var b = 3 * one_t2 * t; |
644 var c = 3 * one_t * t2; | 497 var c = 3 * one_t * t2; |
645 var d = t2 * t; | 498 var d = t2 * t; |
646 return a * curve[1] + b * curve[3] + c * curve[5] + d * curve[7]; | 499 return a * curve[1] + b * curve[3] + c * curve[5] + d * curve[7]; |
647 } | 500 } |
648 | 501 |
649 function drawPointAtT(curve) { | 502 function drawPointAtT(curve) { |
650 var x = x_at_t(curve, curveT); | 503 var x = x_at_t(curve, curveT); |
651 var y = y_at_t(curve, curveT); | 504 var y = y_at_t(curve, curveT); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 var boundsY = b - t; | 574 var boundsY = b - t; |
722 var boundsDist = boundsX * boundsX + boundsY * boundsY; | 575 var boundsDist = boundsX * boundsX + boundsY * boundsY; |
723 if (closestDist > boundsDist) { | 576 if (closestDist > boundsDist) { |
724 return -1; | 577 return -1; |
725 } | 578 } |
726 console.log("closestDist = " + closestDist + " boundsDist = " + boundsDi
st | 579 console.log("closestDist = " + closestDist + " boundsDist = " + boundsDi
st |
727 + " t = " + closest / 16); | 580 + " t = " + closest / 16); |
728 return closest / 16; | 581 return closest / 16; |
729 } | 582 } |
730 | 583 |
| 584 var kMaxConicToQuadPOW2 = 5; |
| 585 |
| 586 function computeQuadPOW2(curve, tol) { |
| 587 var a = curve[6] - 1; |
| 588 var k = a / (4 * (2 + a)); |
| 589 var x = k * (curve[0] - 2 * curve[2] + curve[4]); |
| 590 var y = k * (curve[1] - 2 * curve[3] + curve[5]); |
| 591 |
| 592 var error = Math.sqrt(x * x + y * y); |
| 593 var pow2; |
| 594 for (pow2 = 0; pow2 < kMaxConicToQuadPOW2; ++pow2) { |
| 595 if (error <= tol) { |
| 596 break; |
| 597 } |
| 598 error *= 0.25; |
| 599 } |
| 600 return pow2; |
| 601 } |
| 602 |
| 603 function subdivide_w_value(w) { |
| 604 return Math.sqrt(0.5 + w * 0.5); |
| 605 } |
| 606 |
| 607 function chop(curve, part1, part2) { |
| 608 var w = curve[6]; |
| 609 var scale = 1 / (1 + w); |
| 610 part1[0] = curve[0]; |
| 611 part1[1] = curve[1]; |
| 612 part1[2] = (curve[0] + curve[2] * w) * scale; |
| 613 part1[3] = (curve[1] + curve[3] * w) * scale; |
| 614 part1[4] = part2[0] = (curve[0] + (curve[2] * w) * 2 + curve[4]) * scale
* 0.5; |
| 615 part1[5] = part2[1] = (curve[1] + (curve[3] * w) * 2 + curve[5]) * scale
* 0.5; |
| 616 part2[2] = (curve[2] * w + curve[4]) * scale; |
| 617 part2[3] = (curve[3] * w + curve[5]) * scale; |
| 618 part2[4] = curve[4]; |
| 619 part2[5] = curve[5]; |
| 620 part1[6] = part2[6] = subdivide_w_value(w); |
| 621 } |
| 622 |
| 623 function subdivide(curve, level, pts) { |
| 624 if (0 == level) { |
| 625 pts.push(curve[2]); |
| 626 pts.push(curve[3]); |
| 627 pts.push(curve[4]); |
| 628 pts.push(curve[5]); |
| 629 } else { |
| 630 var part1 = [], part2 = []; |
| 631 chop(curve, part1, part2); |
| 632 --level; |
| 633 subdivide(part1, level, pts); |
| 634 subdivide(part2, level, pts); |
| 635 } |
| 636 } |
| 637 |
| 638 function chopIntoQuadsPOW2(curve, pow2, pts) { |
| 639 subdivide(curve, pow2, pts); |
| 640 return 1 << pow2; |
| 641 } |
| 642 |
| 643 function drawConic(curve, srcLeft, srcTop, scale) { |
| 644 var tol = 1 / scale; |
| 645 var pow2 = computeQuadPOW2(curve, tol); |
| 646 var pts = []; |
| 647 chopIntoQuadsPOW2(curve, pow2, pts); |
| 648 for (var i = 0; i < pts.length; i += 4) { |
| 649 ctx.quadraticCurveTo( |
| 650 (pts[i + 0] - srcLeft) * scale, (pts[i + 1] - srcTop) * scale, |
| 651 (pts[i + 2] - srcLeft) * scale, (pts[i + 3] - srcTop) * scale); |
| 652 } |
| 653 } |
| 654 |
731 function draw(test, title) { | 655 function draw(test, title) { |
732 ctx.font = "normal 50px Arial"; | 656 ctx.font = "normal 50px Arial"; |
733 ctx.textAlign = "left"; | 657 ctx.textAlign = "left"; |
734 ctx.fillStyle = "rgba(0,0,0, 0.1)"; | 658 ctx.fillStyle = "rgba(0,0,0, 0.1)"; |
735 ctx.fillText(title, 50, 50); | 659 ctx.fillText(title, 50, 50); |
736 ctx.font = "normal 10px Arial"; | 660 ctx.font = "normal 10px Arial"; |
737 // ctx.lineWidth = "1.001"; "0.999"; | 661 // ctx.lineWidth = "1.001"; "0.999"; |
738 var hullStarts = []; | 662 var hullStarts = []; |
739 var hullEnds = []; | 663 var hullEnds = []; |
740 var midSpokes = []; | 664 var midSpokes = []; |
741 var midDist = []; | 665 var midDist = []; |
742 var origin = []; | 666 var origin = []; |
743 var shortSpokes = []; | 667 var shortSpokes = []; |
744 var shortDist = []; | 668 var shortDist = []; |
745 var sweeps = []; | 669 var sweeps = []; |
746 drawnPts = []; | 670 drawnPts = []; |
747 for (var curves in test) { | 671 for (var curves in test) { |
748 var curve = test[curves]; | 672 var curve = test[curves]; |
749 origin.push(curve[0]); | 673 origin.push(curve[0]); |
750 origin.push(curve[1]); | 674 origin.push(curve[1]); |
751 var startPt = []; | 675 var startPt = []; |
752 startPt.push(curve[2]); | 676 startPt.push(curve[2]); |
753 startPt.push(curve[3]); | 677 startPt.push(curve[3]); |
754 hullStarts.push(startPt); | 678 hullStarts.push(startPt); |
755 var endPt = []; | 679 var endPt = []; |
756 if (curve.length == 4) { | 680 if (curve.length == 4) { |
757 endPt.push(curve[2]); | 681 endPt.push(curve[2]); |
758 endPt.push(curve[3]); | 682 endPt.push(curve[3]); |
759 } else if (curve.length == 6) { | 683 } else if (curve.length == 6 || curve.length == 7) { |
760 endPt.push(curve[4]); | 684 endPt.push(curve[4]); |
761 endPt.push(curve[5]); | 685 endPt.push(curve[5]); |
762 } else if (curve.length == 8) { | 686 } else if (curve.length == 8) { |
763 endPt.push(curve[6]); | 687 endPt.push(curve[6]); |
764 endPt.push(curve[7]); | 688 endPt.push(curve[7]); |
765 } | 689 } |
766 hullEnds.push(endPt); | 690 hullEnds.push(endPt); |
767 var sweep = crossPt(origin, startPt, endPt); | 691 var sweep = crossPt(origin, startPt, endPt); |
768 sweeps.push(sweep); | 692 sweeps.push(sweep); |
769 var midPt = []; | 693 var midPt = []; |
(...skipping 11 matching lines...) Expand all Loading... |
781 dx = shortPt[0] - origin[0]; | 705 dx = shortPt[0] - origin[0]; |
782 dy = shortPt[1] - origin[1]; | 706 dy = shortPt[1] - origin[1]; |
783 dist = Math.sqrt(dx * dx + dy * dy); | 707 dist = Math.sqrt(dx * dx + dy * dy); |
784 shortDist.push(dist); | 708 shortDist.push(dist); |
785 } | 709 } |
786 var intersect = []; | 710 var intersect = []; |
787 var useIntersect = false; | 711 var useIntersect = false; |
788 var maxWidth = Math.max(xmax - xmin, ymax - ymin); | 712 var maxWidth = Math.max(xmax - xmin, ymax - ymin); |
789 for (var curves in test) { | 713 for (var curves in test) { |
790 var curve = test[curves]; | 714 var curve = test[curves]; |
791 if (curve.length == 6 || curve.length == 8) { | 715 if (curve.length >= 6 && curve.length <= 8) { |
792 var opp = curves == 0 || curves == 1 ? 0 : 1; | 716 var opp = curves == 0 || curves == 1 ? 0 : 1; |
793 var sects = ray_curve_intersect(origin, hullEnds[opp], curve); | 717 var sects = ray_curve_intersect(origin, hullEnds[opp], curve); |
794 intersect.push(sects); | 718 intersect.push(sects); |
795 if (sects.length > 1) { | 719 if (sects.length > 1) { |
796 var intersection = sects[0]; | 720 var intersection = sects[0]; |
797 if (intersection == 0) { | 721 if (intersection == 0) { |
798 intersection = sects[1]; | 722 intersection = sects[1]; |
799 } | 723 } |
800 var ix = x_at_t(curve, intersection) - origin[0]; | 724 var ix = x_at_t(curve, intersection) - origin[0]; |
801 var iy = y_at_t(curve, intersection) - origin[1]; | 725 var iy = y_at_t(curve, intersection) - origin[1]; |
802 var ex = hullEnds[opp][0] - origin[0]; | 726 var ex = hullEnds[opp][0] - origin[0]; |
803 var ey = hullEnds[opp][1] - origin[1]; | 727 var ey = hullEnds[opp][1] - origin[1]; |
804 if (ix * ex >= 0 && iy * ey >= 0) { | 728 if (ix * ex >= 0 && iy * ey >= 0) { |
805 var iDist = Math.sqrt(ix * ix + iy * iy); | 729 var iDist = Math.sqrt(ix * ix + iy * iy); |
806 var eDist = Math.sqrt(ex * ex + ey * ey); | 730 var eDist = Math.sqrt(ex * ex + ey * ey); |
807 var delta = Math.abs(iDist - eDist) / maxWidth; | 731 var delta = Math.abs(iDist - eDist) / maxWidth; |
808 if (delta > (curve.length == 6 ? 1e-5 : 1e-4)) { | 732 if (delta > (curve.length != 8 ? 1e-5 : 1e-4)) { |
809 useIntersect ^= true; | 733 useIntersect ^= true; |
810 } | 734 } |
811 } | 735 } |
812 } | 736 } |
813 } | 737 } |
814 } | 738 } |
815 var midLeft = curves != 0 ? crossPt(origin, midSpokes[0], midSpokes[1])
: 0; | 739 var midLeft = curves != 0 ? crossPt(origin, midSpokes[0], midSpokes[1])
: 0; |
816 var firstInside; | 740 var firstInside; |
817 if (useIntersect) { | 741 if (useIntersect) { |
818 var sect1 = intersect[0].length > 1; | 742 var sect1 = intersect[0].length > 1; |
(...skipping 21 matching lines...) Expand all Loading... |
840 var shorter = midDist[1] < midDist[0]; | 764 var shorter = midDist[1] < midDist[0]; |
841 var shortLeft = shorter ? crossPt(origin, shortSpokes[0], midSpokes[1]) | 765 var shortLeft = shorter ? crossPt(origin, shortSpokes[0], midSpokes[1]) |
842 : crossPt(origin, midSpokes[0], shortSpokes[1]); | 766 : crossPt(origin, midSpokes[0], shortSpokes[1]); |
843 var startCross = crossPt(origin, hullStarts[0], hullStarts[1]); | 767 var startCross = crossPt(origin, hullStarts[0], hullStarts[1]); |
844 var disallowShort = midLeft == startCross && midLeft == sweeps[0] | 768 var disallowShort = midLeft == startCross && midLeft == sweeps[0] |
845 && midLeft == sweeps[1]; | 769 && midLeft == sweeps[1]; |
846 | 770 |
847 // console.log("midLeft=" + midLeft + " startCross=" + startCross); | 771 // console.log("midLeft=" + midLeft + " startCross=" + startCross); |
848 var intersectIndex = 0; | 772 var intersectIndex = 0; |
849 for (var curves in test) { | 773 for (var curves in test) { |
850 var curve = test[curves]; | 774 var curve = test[draw_id != 2 ? curves : test.length - curves - 1]; |
851 if (curve.length != 4 && curve.length != 6 && curve.length != 8) { | 775 if (curve.length != 4 && curve.length != 6 && curve.length != 7 && c
urve.length != 8) { |
852 continue; | 776 continue; |
853 } | 777 } |
854 ctx.lineWidth = 1; | 778 ctx.lineWidth = 1; |
855 if (draw_tangents != 0) { | 779 if (draw_tangents != 0) { |
856 if (draw_cubic_red ? curve.length == 8 : firstInside == curves)
{ | 780 if (draw_cubic_red ? curve.length == 8 : firstInside == curves)
{ |
857 ctx.strokeStyle = "rgba(255,0,0, 0.3)"; | 781 ctx.strokeStyle = "rgba(255,0,0, 0.3)"; |
858 } else { | 782 } else { |
859 ctx.strokeStyle = "rgba(0,0,255, 0.3)"; | 783 ctx.strokeStyle = "rgba(0,0,255, 0.3)"; |
860 } | 784 } |
861 drawLine(curve[0], curve[1], curve[2], curve[3]); | 785 drawLine(curve[0], curve[1], curve[2], curve[3]); |
862 if (draw_tangents != 2) { | 786 if (draw_tangents != 2) { |
863 if (curve.length > 4) drawLine(curve[2], curve[3], curve[4],
curve[5]); | 787 if (curve.length > 4) drawLine(curve[2], curve[3], curve[4],
curve[5]); |
864 if (curve.length > 6) drawLine(curve[4], curve[5], curve[6],
curve[7]); | 788 if (curve.length == 8) drawLine(curve[4], curve[5], curve[6]
, curve[7]); |
865 } | 789 } |
866 if (draw_tangents != 1) { | 790 if (draw_tangents != 1) { |
867 if (curve.length == 6) drawLine(curve[0], curve[1], curve[4]
, curve[5]); | 791 if (curve.length == 6 || curve.length == 7) { |
| 792 drawLine(curve[0], curve[1], curve[4], curve[5]); |
| 793 } |
868 if (curve.length == 8) drawLine(curve[0], curve[1], curve[6]
, curve[7]); | 794 if (curve.length == 8) drawLine(curve[0], curve[1], curve[6]
, curve[7]); |
869 } | 795 } |
870 } | 796 } |
871 ctx.beginPath(); | 797 ctx.beginPath(); |
872 ctx.moveTo((curve[0] - srcLeft) * scale, (curve[1] - srcTop) * scale
); | 798 ctx.moveTo((curve[0] - srcLeft) * scale, (curve[1] - srcTop) * scale
); |
873 if (curve.length == 4) { | 799 if (curve.length == 4) { |
874 ctx.lineTo((curve[2] - srcLeft) * scale, (curve[3] - srcTop) * s
cale); | 800 ctx.lineTo((curve[2] - srcLeft) * scale, (curve[3] - srcTop) * s
cale); |
875 } else if (curve.length == 6) { | 801 } else if (curve.length == 6) { |
876 ctx.quadraticCurveTo( | 802 ctx.quadraticCurveTo( |
877 (curve[2] - srcLeft) * scale, (curve[3] - srcTop) * scale, | 803 (curve[2] - srcLeft) * scale, (curve[3] - srcTop) * scale, |
878 (curve[4] - srcLeft) * scale, (curve[5] - srcTop) * scale); | 804 (curve[4] - srcLeft) * scale, (curve[5] - srcTop) * scale); |
| 805 } else if (curve.length == 7) { |
| 806 drawConic(curve, srcLeft, srcTop, scale); |
879 } else { | 807 } else { |
880 ctx.bezierCurveTo( | 808 ctx.bezierCurveTo( |
881 (curve[2] - srcLeft) * scale, (curve[3] - srcTop) * scale, | 809 (curve[2] - srcLeft) * scale, (curve[3] - srcTop) * scale, |
882 (curve[4] - srcLeft) * scale, (curve[5] - srcTop) * scale, | 810 (curve[4] - srcLeft) * scale, (curve[5] - srcTop) * scale, |
883 (curve[6] - srcLeft) * scale, (curve[7] - srcTop) * scale); | 811 (curve[6] - srcLeft) * scale, (curve[7] - srcTop) * scale); |
884 } | 812 } |
885 if (draw_cubic_red ? curve.length == 8 : firstInside == curves) { | 813 if (draw_cubic_red ? curve.length == 8 : firstInside == curves) { |
886 ctx.strokeStyle = "rgba(255,0,0, 1)"; | 814 ctx.strokeStyle = "rgba(255,0,0, 1)"; |
887 } else { | 815 } else { |
888 ctx.strokeStyle = "rgba(0,0,255, 1)"; | 816 ctx.strokeStyle = "rgba(0,0,255, 1)"; |
889 } | 817 } |
890 ctx.stroke(); | 818 ctx.stroke(); |
891 if (draw_endpoints > 0) { | 819 if (draw_endpoints > 0) { |
892 drawPoint(curve[0], curve[1]); | 820 drawPoint(curve[0], curve[1]); |
893 if (draw_endpoints > 1 || curve.length == 4) { | 821 if (draw_endpoints > 1 || curve.length == 4) { |
894 drawPoint(curve[2], curve[3]); | 822 drawPoint(curve[2], curve[3]); |
895 } | 823 } |
896 if (curve.length == 6 || (draw_endpoints > 1 && curve.length ==
8)) { | 824 if (curve.length == 6 || curve.length == 7 || |
| 825 (draw_endpoints > 1 && curve.length == 8)) { |
897 drawPoint(curve[4], curve[5]); | 826 drawPoint(curve[4], curve[5]); |
898 } | 827 } |
899 if (curve.length == 8) drawPoint(curve[6], curve[7]); | 828 if (curve.length == 8) drawPoint(curve[6], curve[7]); |
900 } | 829 } |
901 if (draw_midpoint != 0) { | 830 if (draw_midpoint != 0) { |
902 if ((curves == 0) == (midLeft == 0)) { | 831 if ((curves == 0) == (midLeft == 0)) { |
903 ctx.strokeStyle = "rgba(0,180,127, 0.6)"; | 832 ctx.strokeStyle = "rgba(0,180,127, 0.6)"; |
904 } else { | 833 } else { |
905 ctx.strokeStyle = "rgba(127,0,127, 0.6)"; | 834 ctx.strokeStyle = "rgba(127,0,127, 0.6)"; |
906 } | 835 } |
(...skipping 30 matching lines...) Expand all Loading... |
937 + " shorter=" + shorter + " midT=" + midT); | 866 + " shorter=" + shorter + " midT=" + midT); |
938 var midX = x_at_t(curve, midT); | 867 var midX = x_at_t(curve, midT); |
939 var midY = y_at_t(curve, midT); | 868 var midY = y_at_t(curve, midT); |
940 drawPointSolid(midX, midY); | 869 drawPointSolid(midX, midY); |
941 if (draw_sortpoint > 1) { | 870 if (draw_sortpoint > 1) { |
942 drawLine(curve[0], curve[1], midX, midY); | 871 drawLine(curve[0], curve[1], midX, midY); |
943 } | 872 } |
944 } | 873 } |
945 if (draw_ray_intersect != 0) { | 874 if (draw_ray_intersect != 0) { |
946 ctx.strokeStyle = "rgba(75,45,199, 0.6)"; | 875 ctx.strokeStyle = "rgba(75,45,199, 0.6)"; |
947 if (curve.length == 6 || curve.length == 8) { | 876 if (curve.length >= 6 && curve.length <= 8) { |
948 var intersections = intersect[intersectIndex]; | 877 var intersections = intersect[intersectIndex]; |
949 for (var i in intersections) { | 878 for (var i in intersections) { |
950 var intersection = intersections[i]; | 879 var intersection = intersections[i]; |
951 var x = x_at_t(curve, intersection); | 880 var x = x_at_t(curve, intersection); |
952 var y = y_at_t(curve, intersection); | 881 var y = y_at_t(curve, intersection); |
953 drawPointSolid(x, y); | 882 drawPointSolid(x, y); |
954 if (draw_ray_intersect > 1) { | 883 if (draw_ray_intersect > 1) { |
955 drawLine(curve[0], curve[1], x, y); | 884 drawLine(curve[0], curve[1], x, y); |
956 } | 885 } |
957 } | 886 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 if (!approximately_zero(scale - initScale)) { | 920 if (!approximately_zero(scale - initScale)) { |
992 ctx.font = "normal 20px Arial"; | 921 ctx.font = "normal 20px Arial"; |
993 ctx.fillStyle = "rgba(0,0,0, 0.3)"; | 922 ctx.fillStyle = "rgba(0,0,0, 0.3)"; |
994 ctx.textAlign = "right"; | 923 ctx.textAlign = "right"; |
995 ctx.fillText(scale.toFixed(decimal_places) + 'x', | 924 ctx.fillText(scale.toFixed(decimal_places) + 'x', |
996 screenWidth - 10, screenHeight - 5); | 925 screenWidth - 10, screenHeight - 5); |
997 } | 926 } |
998 if (draw_t) { | 927 if (draw_t) { |
999 drawPointAtT(curve); | 928 drawPointAtT(curve); |
1000 } | 929 } |
1001 if (draw_id) { | 930 if (draw_id != 0) { |
1002 var id = -1; | 931 var id = -1; |
1003 for (var i = 0; i < ids.length; i += 2) { | 932 for (var i = 0; i < ids.length; i += 2) { |
1004 if (ids[i + 1] == curve) { | 933 if (ids[i + 1] == curve) { |
1005 id = ids[i]; | 934 id = ids[i]; |
1006 break; | 935 break; |
1007 } | 936 } |
1008 } | 937 } |
1009 if (id >= 0) { | 938 if (id >= 0) { |
1010 var px = x_at_t(curve, 0.5); | 939 var px = x_at_t(curve, 0.5); |
1011 var py = y_at_t(curve, 0.5); | 940 var py = y_at_t(curve, 0.5); |
1012 var _px = (px - srcLeft) * scale; | 941 var _px = (px - srcLeft) * scale; |
1013 var _py = (py - srcTop) * scale; | 942 var _py = (py - srcTop) * scale; |
1014 ctx.beginPath(); | 943 ctx.beginPath(); |
1015 ctx.arc(_px, _py, 15, 0, Math.PI * 2, true); | 944 ctx.arc(_px, _py, 15, 0, Math.PI * 2, true); |
1016 ctx.closePath(); | 945 ctx.closePath(); |
1017 ctx.fillStyle = "white"; | 946 ctx.fillStyle = "white"; |
1018 ctx.fill(); | 947 ctx.fill(); |
1019 ctx.strokeStyle = "rgba(255,0,0, 1)"; | 948 ctx.strokeStyle = "rgba(255,0,0, 1)"; |
1020 ctx.fillStyle = "rgba(255,0,0, 1)"; | 949 ctx.fillStyle = "rgba(255,0,0, 1)"; |
1021 ctx.stroke(); | 950 ctx.stroke(); |
1022 ctx.font = "normal 16px Arial"; | 951 ctx.font = "normal 16px Arial"; |
1023 ctx.textAlign = "center"; | 952 ctx.textAlign = "center"; |
1024 ctx.fillText(id, _px, _py + 5); | 953 ctx.fillText(id, _px, _py + 5); |
1025 } | 954 } |
1026 } | 955 } |
1027 } | 956 } |
1028 if (draw_t) { | 957 if (draw_t) { |
1029 drawCurveTControl(); | 958 drawCurveTControl(); |
1030 } | 959 } |
| 960 if (draw_w) { |
| 961 drawCurveWControl(); |
| 962 } |
1031 } | 963 } |
1032 | 964 |
1033 function drawCurveTControl() { | 965 function drawCurveTControl() { |
1034 ctx.lineWidth = 2; | 966 ctx.lineWidth = 2; |
1035 ctx.strokeStyle = "rgba(0,0,0, 0.3)"; | 967 ctx.strokeStyle = "rgba(0,0,0, 0.3)"; |
1036 ctx.beginPath(); | 968 ctx.beginPath(); |
1037 ctx.rect(screenWidth - 80, 40, 28, screenHeight - 80); | 969 ctx.rect(screenWidth - 80, 40, 28, screenHeight - 80); |
1038 ctx.stroke(); | 970 ctx.stroke(); |
1039 var ty = 40 + curveT * (screenHeight - 80); | 971 var ty = 40 + curveT * (screenHeight - 80); |
1040 ctx.beginPath(); | 972 ctx.beginPath(); |
1041 ctx.moveTo(screenWidth - 80, ty); | 973 ctx.moveTo(screenWidth - 80, ty); |
1042 ctx.lineTo(screenWidth - 85, ty - 5); | 974 ctx.lineTo(screenWidth - 85, ty - 5); |
1043 ctx.lineTo(screenWidth - 85, ty + 5); | 975 ctx.lineTo(screenWidth - 85, ty + 5); |
1044 ctx.lineTo(screenWidth - 80, ty); | 976 ctx.lineTo(screenWidth - 80, ty); |
1045 ctx.fillStyle = "rgba(0,0,0, 0.6)"; | 977 ctx.fillStyle = "rgba(0,0,0, 0.6)"; |
1046 ctx.fill(); | 978 ctx.fill(); |
1047 var num = curveT.toFixed(decimal_places); | 979 var num = curveT.toFixed(decimal_places); |
1048 ctx.font = "normal 10px Arial"; | 980 ctx.font = "normal 10px Arial"; |
1049 ctx.textAlign = "left"; | 981 ctx.textAlign = "left"; |
1050 ctx.fillText(num, screenWidth - 78, ty); | 982 ctx.fillText(num, screenWidth - 78, ty); |
1051 } | 983 } |
1052 | 984 |
| 985 function drawCurveWControl() { |
| 986 var w = -1; |
| 987 var choice = 0; |
| 988 for (var curves in tests[testIndex]) { |
| 989 var curve = tests[testIndex][curves]; |
| 990 if (curve.length != 7) { |
| 991 continue; |
| 992 } |
| 993 if (choice == curveW) { |
| 994 w = curve[6]; |
| 995 break; |
| 996 } |
| 997 ++choice; |
| 998 } |
| 999 if (w < 0) { |
| 1000 return; |
| 1001 } |
| 1002 ctx.lineWidth = 2; |
| 1003 ctx.strokeStyle = "rgba(0,0,0, 0.3)"; |
| 1004 ctx.beginPath(); |
| 1005 ctx.rect(screenWidth - 40, 40, 28, screenHeight - 80); |
| 1006 ctx.stroke(); |
| 1007 var ty = 40 + w * (screenHeight - 80); |
| 1008 ctx.beginPath(); |
| 1009 ctx.moveTo(screenWidth - 40, ty); |
| 1010 ctx.lineTo(screenWidth - 45, ty - 5); |
| 1011 ctx.lineTo(screenWidth - 45, ty + 5); |
| 1012 ctx.lineTo(screenWidth - 40, ty); |
| 1013 ctx.fillStyle = "rgba(0,0,0, 0.6)"; |
| 1014 ctx.fill(); |
| 1015 var num = w.toFixed(decimal_places); |
| 1016 ctx.font = "normal 10px Arial"; |
| 1017 ctx.textAlign = "left"; |
| 1018 ctx.fillText(num, screenWidth - 38, ty); |
| 1019 } |
| 1020 |
1053 function ptInTControl() { | 1021 function ptInTControl() { |
1054 var e = window.event; | 1022 var e = window.event; |
1055 var tgt = e.target || e.srcElement; | 1023 var tgt = e.target || e.srcElement; |
1056 var left = tgt.offsetLeft; | 1024 var left = tgt.offsetLeft; |
1057 var top = tgt.offsetTop; | 1025 var top = tgt.offsetTop; |
1058 var x = (e.clientX - left); | 1026 var x = (e.clientX - left); |
1059 var y = (e.clientY - top); | 1027 var y = (e.clientY - top); |
1060 if (x < screenWidth - 80 || x > screenWidth - 50) { | 1028 if (x < screenWidth - 80 || x > screenWidth - 50) { |
1061 return false; | 1029 return false; |
1062 } | 1030 } |
1063 if (y < 40 || y > screenHeight - 80) { | 1031 if (y < 40 || y > screenHeight - 80) { |
1064 return false; | 1032 return false; |
1065 } | 1033 } |
1066 curveT = (y - 40) / (screenHeight - 120); | 1034 curveT = (y - 40) / (screenHeight - 120); |
1067 if (curveT < 0 || curveT > 1) { | 1035 if (curveT < 0 || curveT > 1) { |
1068 throw "stop execution"; | 1036 throw "stop execution"; |
1069 } | 1037 } |
1070 return true; | 1038 return true; |
1071 } | 1039 } |
1072 | 1040 |
| 1041 function ptInWControl() { |
| 1042 var e = window.event; |
| 1043 var tgt = e.target || e.srcElement; |
| 1044 var left = tgt.offsetLeft; |
| 1045 var top = tgt.offsetTop; |
| 1046 var x = (e.clientX - left); |
| 1047 var y = (e.clientY - top); |
| 1048 if (x < screenWidth - 40 || x > screenWidth - 10) { |
| 1049 return false; |
| 1050 } |
| 1051 if (y < 40 || y > screenHeight - 80) { |
| 1052 return false; |
| 1053 } |
| 1054 var w = (y - 40) / (screenHeight - 120); |
| 1055 if (w < 0 || w > 1) { |
| 1056 throw "stop execution"; |
| 1057 } |
| 1058 var choice = 0; |
| 1059 for (var curves in tests[testIndex]) { |
| 1060 var curve = tests[testIndex][curves]; |
| 1061 if (curve.length != 7) { |
| 1062 continue; |
| 1063 } |
| 1064 if (choice == curveW) { |
| 1065 curve[6] = w; |
| 1066 break; |
| 1067 } |
| 1068 ++choice; |
| 1069 } |
| 1070 return true; |
| 1071 } |
| 1072 |
1073 function drawTop() { | 1073 function drawTop() { |
1074 init(tests[testIndex]); | 1074 init(tests[testIndex]); |
1075 redraw(); | 1075 redraw(); |
1076 } | 1076 } |
1077 | 1077 |
1078 function redraw() { | 1078 function redraw() { |
1079 if (focus_on_selection > 0) { | 1079 if (focus_on_selection > 0) { |
1080 var focusXmin = focusYmin = Infinity; | 1080 var focusXmin = focusYmin = Infinity; |
1081 var focusXmax = focusYmax = -Infinity; | 1081 var focusXmax = focusYmax = -Infinity; |
1082 var choice = 0; | 1082 var choice = 0; |
1083 for (var curves in tests[testIndex]) { | 1083 for (var curves in tests[testIndex]) { |
1084 if (++choice != focus_on_selection) { | 1084 if (++choice != focus_on_selection) { |
1085 continue; | 1085 continue; |
1086 } | 1086 } |
1087 var curve = tests[testIndex][curves]; | 1087 var curve = tests[testIndex][curves]; |
1088 var last = curve.length; | 1088 var last = curve.length - (curve.length % 2 == 1 ? 1 : 0); |
1089 for (var idx = 0; idx < last; idx += 2) { | 1089 for (var idx = 0; idx < last; idx += 2) { |
1090 focusXmin = Math.min(focusXmin, curve[idx]); | 1090 focusXmin = Math.min(focusXmin, curve[idx]); |
1091 focusXmax = Math.max(focusXmax, curve[idx]); | 1091 focusXmax = Math.max(focusXmax, curve[idx]); |
1092 focusYmin = Math.min(focusYmin, curve[idx + 1]); | 1092 focusYmin = Math.min(focusYmin, curve[idx + 1]); |
1093 focusYmax = Math.max(focusYmax, curve[idx + 1]); | 1093 focusYmax = Math.max(focusYmax, curve[idx + 1]); |
1094 } | 1094 } |
1095 } | 1095 } |
1096 focusXmin -= Math.min(1, Math.max(focusXmax - focusXmin, focusYmax -
focusYmin)); | 1096 focusXmin -= Math.min(1, Math.max(focusXmax - focusXmin, focusYmax -
focusYmin)); |
1097 if (focusXmin < focusXmax && focusYmin < focusYmax) { | 1097 if (focusXmin < focusXmax && focusYmin < focusYmax) { |
1098 setScale(focusXmin, focusXmax, focusYmin, focusYmax); | 1098 setScale(focusXmin, focusXmax, focusYmin, focusYmax); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 redraw(); | 1248 redraw(); |
1249 break; | 1249 break; |
1250 case 'u': | 1250 case 'u': |
1251 draw_closest_t ^= true; | 1251 draw_closest_t ^= true; |
1252 redraw(); | 1252 redraw(); |
1253 break; | 1253 break; |
1254 case 'v': | 1254 case 'v': |
1255 draw_tangents = (draw_tangents + 1) % 4; | 1255 draw_tangents = (draw_tangents + 1) % 4; |
1256 redraw(); | 1256 redraw(); |
1257 break; | 1257 break; |
| 1258 case 'w': |
| 1259 ++curveW; |
| 1260 var choice = 0; |
| 1261 draw_w = false; |
| 1262 for (var curves in tests[testIndex]) { |
| 1263 var curve = tests[testIndex][curves]; |
| 1264 if (curve.length != 7) { |
| 1265 continue; |
| 1266 } |
| 1267 if (choice == curveW) { |
| 1268 draw_w = true; |
| 1269 break; |
| 1270 } |
| 1271 ++choice; |
| 1272 } |
| 1273 if (!draw_w) { |
| 1274 curveW = -1; |
| 1275 } |
| 1276 redraw(); |
| 1277 break; |
1258 case 'x': | 1278 case 'x': |
1259 draw_point_xy ^= true; | 1279 draw_point_xy ^= true; |
1260 redraw(); | 1280 redraw(); |
1261 break; | 1281 break; |
1262 case 'y': | 1282 case 'y': |
1263 draw_mouse_xy ^= true; | 1283 draw_mouse_xy ^= true; |
1264 redraw(); | 1284 redraw(); |
1265 break; | 1285 break; |
1266 case '\\': | 1286 case '\\': |
1267 retina_scale ^= true; | 1287 retina_scale ^= true; |
1268 drawTop(); | 1288 drawTop(); |
1269 break; | 1289 break; |
1270 case '`': | 1290 case '`': |
1271 ++focus_on_selection; | 1291 ++focus_on_selection; |
1272 if (focus_on_selection >= tests[testIndex].length) { | 1292 if (focus_on_selection >= tests[testIndex].length) { |
1273 focus_on_selection = 0; | 1293 focus_on_selection = 0; |
1274 } | 1294 } |
1275 setScale(xmin, xmax, ymin, ymax); | 1295 setScale(xmin, xmax, ymin, ymax); |
1276 redraw(); | 1296 redraw(); |
1277 break; | 1297 break; |
1278 case '.': | 1298 case '.': |
1279 draw_id ^= true; | 1299 draw_id = (draw_id + 1) % 3; |
1280 redraw(); | 1300 redraw(); |
1281 break; | 1301 break; |
1282 } | 1302 } |
1283 } | 1303 } |
1284 | 1304 |
1285 function doKeyDown(evt) { | 1305 function doKeyDown(evt) { |
1286 var char = evt.keyCode; | 1306 var char = evt.keyCode; |
1287 var preventDefault = false; | 1307 var preventDefault = false; |
1288 switch (char) { | 1308 switch (char) { |
1289 case 37: // left arrow | 1309 case 37: // left arrow |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 mouseX = (e.clientX - left) / scale + srcLeft; | 1348 mouseX = (e.clientX - left) / scale + srcLeft; |
1329 mouseY = (e.clientY - top) / scale + srcTop; | 1349 mouseY = (e.clientY - top) / scale + srcTop; |
1330 } | 1350 } |
1331 | 1351 |
1332 function calcLeftTop() { | 1352 function calcLeftTop() { |
1333 srcLeft = mouseX - screenWidth / 2 / scale; | 1353 srcLeft = mouseX - screenWidth / 2 / scale; |
1334 srcTop = mouseY - screenHeight / 2 / scale; | 1354 srcTop = mouseY - screenHeight / 2 / scale; |
1335 } | 1355 } |
1336 | 1356 |
1337 function handleMouseClick() { | 1357 function handleMouseClick() { |
1338 if (!draw_t || !ptInTControl()) { | 1358 if ((!draw_t || !ptInTControl()) && (!draw_w || !ptInWControl())) { |
1339 calcXY(); | 1359 calcXY(); |
1340 } else { | 1360 } else { |
1341 redraw(); | 1361 redraw(); |
1342 } | 1362 } |
1343 } | 1363 } |
1344 | 1364 |
1345 function initDown() { | 1365 function initDown() { |
1346 var test = tests[testIndex]; | 1366 var test = tests[testIndex]; |
1347 var bestDistance = 1000000; | 1367 var bestDistance = 1000000; |
1348 activePt = -1; | 1368 activePt = -1; |
1349 for (var curves in test) { | 1369 for (var curves in test) { |
1350 var testCurve = test[curves]; | 1370 var testCurve = test[curves]; |
1351 if (testCurve.length != 4 && testCurve.length != 6 && testCurve.leng
th != 8) { | 1371 if (testCurve.length != 4 && (testCurve.length < 6 || testCurve.leng
th > 8)) { |
1352 continue; | 1372 continue; |
1353 } | 1373 } |
1354 for (var i = 0; i < testCurve.length; i += 2) { | 1374 var testMax = testCurve.length == 7 ? 6 : testCurve.length; |
| 1375 for (var i = 0; i < testMax; i += 2) { |
1355 var testX = testCurve[i]; | 1376 var testX = testCurve[i]; |
1356 var testY = testCurve[i + 1]; | 1377 var testY = testCurve[i + 1]; |
1357 var dx = testX - mouseX; | 1378 var dx = testX - mouseX; |
1358 var dy = testY - mouseY; | 1379 var dy = testY - mouseY; |
1359 var dist = dx * dx + dy * dy; | 1380 var dist = dx * dx + dy * dy; |
1360 if (dist > bestDistance) { | 1381 if (dist > bestDistance) { |
1361 continue; | 1382 continue; |
1362 } | 1383 } |
1363 activeCurve = testCurve; | 1384 activeCurve = testCurve; |
1364 activePt = i; | 1385 activePt = i; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1430 <body onLoad="start();"> | 1451 <body onLoad="start();"> |
1431 | 1452 |
1432 <canvas id="canvas" width="750" height="500" | 1453 <canvas id="canvas" width="750" height="500" |
1433 onmousedown="mouseDown = true" | 1454 onmousedown="mouseDown = true" |
1434 onmouseup="mouseDown = false" | 1455 onmouseup="mouseDown = false" |
1435 onmousemove="handleMouseOver()" | 1456 onmousemove="handleMouseOver()" |
1436 onclick="handleMouseClick()" | 1457 onclick="handleMouseClick()" |
1437 ></canvas > | 1458 ></canvas > |
1438 </body> | 1459 </body> |
1439 </html> | 1460 </html> |
OLD | NEW |