Best JavaScript code snippet using wpt
moon.js
Source:moon.js
1/* global Trig, deg2rad */2var Moon = {3 elements: function(dat) {4 var t = (dat.jd - 2451545) / 36525,5 t2 = t * t,6 t3 = t * t2,7 t4 = t * t3,8 t5 = t * t4,9 t2e4 = t2 * 1e-4,10 t3e6 = t3 * 1e-6,11 t4e8 = t4 * 1e-8;12 // semimajor axis13 var sa = 3400.4 * Math.cos(deg2rad * (235.7004 + 890534.2230 * t - 32.601 * t2e4 14 + 3.664 * t3e6 - 1.769 * t4e8)) 15 - 635.6 * Math.cos(deg2rad * (100.7370 + 413335.3554 * t - 122.571 * t2e4 16 - 10.684 * t3e6 + 5.028 * t4e8)) 17 - 235.6 * Math.cos(deg2rad * (134.9634 + 477198.8676 * t + 89.970 * t2e4 18 + 14.348 * t3e6 - 6.797 * t4e8)) 19 + 218.1 * Math.cos(deg2rad * (238.1713 + 854535.1727 * t - 31.065 * t2e4 20 + 3.623 * t3e6 - 1.769 * t4e8)) 21 + 181.0 * Math.cos(deg2rad * (10.6638 + 1367733.0907 * t + 57.370 * t2e4 22 + 18.011 * t3e6 - 8.566 * t4e8)) 23 - 39.9 * Math.cos(deg2rad * (103.2079 + 377336.3051 * t - 121.035 * t2e4 24 - 10.724 * t3e6 + 5.028 * t4e8)) 25 - 38.4 * Math.cos(deg2rad * (233.2295 + 926533.2733 * t - 34.136 * t2e4 26 + 3.705 * t3e6 - 1.769 * t4e8)) 27 + 33.8 * Math.cos(deg2rad * (336.4374 + 1303869.5784 * t - 155.171 * t2e4 28 - 7.020 * t3e6 + 3.259 * t4e8)) 29 + 28.8 * Math.cos(deg2rad * (111.4008 + 1781068.4461 * t - 65.201 * t2e4 30 + 7.328 * t3e6 - 3.538 * t4e8)) 31 + 12.6 * Math.cos(deg2rad * (13.1347 + 1331734.0404 * t + 58.906 * t2e4 32 + 17.971 * t3e6 - 8.566 * t4e8)) 33 + 11.4 * Math.cos(deg2rad * (186.5442 + 966404.0351 * t - 68.058 * t2e4 34 - 0.567 * t3e6 + 0.232 * t4e8)) 35 - 11.1 * Math.cos(deg2rad * (222.5657 - 441199.8173 * t - 91.506 * t2e4 36 - 14.307 * t3e6 + 6.797 * t4e8)) 37 - 10.2 * Math.cos(deg2rad * (269.9268 + 954397.7353 * t + 179.941 * t2e4 38 + 28.695 * t3e6 - 13.594 * t4e8)) 39 + 9.7 * Math.cos(deg2rad * (145.6272 + 1844931.9583 * t + 147.340 * t2e4 40 + 32.359 * t3e6 - 15.363 * t4e8)) 41 + 9.6 * Math.cos(deg2rad * (240.6422 + 818536.1225 * t - 29.529 * t2e4 42 + 3.582 * t3e6 - 1.769 * t4e8)) 43 + 8.0 * Math.cos(deg2rad * (297.8502 + 445267.1115 * t - 16.300 * t2e4 44 + 1.832 * t3e6 - 0.884 * t4e8)) 45 - 6.2 * Math.cos(deg2rad * (132.4925 + 513197.9179 * t + 88.434 * t2e4 46 + 14.388 * t3e6 - 6.797 * t4e8)) 47 + 6.0 * Math.cos(deg2rad * (173.5506 + 1335801.3346 * t - 48.901 * t2e4 48 + 5.496 * t3e6 - 2.653 * t4e8)) 49 + 3.7 * Math.cos(deg2rad * (113.8717 + 1745069.3958 * t - 63.665 * t2e4 50 + 7.287 * t3e6 - 3.538 * t4e8)) 51 + 3.6 * Math.cos(deg2rad * (338.9083 + 1267870.5281 * t - 153.636 * t2e4 52 - 7.061 * t3e6 + 3.259 * t4e8)) 53 + 3.2 * Math.cos(deg2rad * (246.3642 + 2258267.3137 * t + 24.769 * t2e4 54 + 21.675 * t3e6 - 10.335 * t4e8)) 55 - 3.0 * Math.cos(deg2rad * (8.1929 + 1403732.1410 * t + 55.834 * t2e4 56 + 18.052 * t3e6 - 8.566 * t4e8)) 57 + 2.3 * Math.cos(deg2rad * (98.2661 + 449334.4057 * t - 124.107 * t2e4 58 - 10.643 * t3e6 + 5.028 * t4e8)) 59 - 2.2 * Math.cos(deg2rad * (357.5291 + 35999.0503 * t - 1.536 * t2e4 60 + 0.041 * t3e6 + 0.000 * t4e8)) 61 - 2.0 * Math.cos(deg2rad * (38.5872 + 858602.4669 * t - 138.871 * t2e4 62 - 8.852 * t3e6 + 4.144 * t4e8)) 63 - 1.8 * Math.cos(deg2rad * (105.6788 + 341337.2548 * t - 119.499 * t2e4 64 - 10.765 * t3e6 + 5.028 * t4e8)) 65 - 1.7 * Math.cos(deg2rad * (201.4740 + 826670.7108 * t - 245.142 * t2e4 66 - 21.367 * t3e6 + 10.057 * t4e8)) 67 + 1.6 * Math.cos(deg2rad * (184.1196 + 401329.0556 * t + 125.428 * t2e4 68 + 18.579 * t3e6 - 8.798 * t4e8)) 69 - 1.4 * Math.cos(deg2rad * (308.4192 - 489205.1674 * t + 158.029 * t2e4 70 + 14.915 * t3e6 - 7.029 * t4e8)) 71 + 1.3 * Math.cos(deg2rad * (325.7736 - 63863.5122 * t - 212.541 * t2e4 72 - 25.031 * t3e6 + 11.826 * t4e8));73 var sapp = - 0.55 * Math.cos(deg2rad * (238.2 + 854535.2 * t)) 74 + 0.10 * Math.cos(deg2rad * (103.2 + 377336.3 * t)) 75 + 0.10 * Math.cos(deg2rad * (233.2 + 926533.3 * t));76 var sma = 383397.6 + sa + sapp * t;77 // orbital eccentricity78 var se = 0.014217 * Math.cos(deg2rad * (100.7370 + 413335.3554 * t - 122.571 * t2e4 79 - 10.684 * t3e6 + 5.028 * t4e8)) 80 + 0.008551 * Math.cos(deg2rad * (325.7736 - 63863.5122 * t - 212.541 * t2e4 81 - 25.031 * t3e6 + 11.826 * t4e8)) 82 - 0.001383 * Math.cos(deg2rad * (134.9634 + 477198.8676 * t + 89.970 * t2e4 83 + 14.348 * t3e6 - 6.797 * t4e8)) 84 + 0.001353 * Math.cos(deg2rad * (10.6638 + 1367733.0907 * t + 57.370 * t2e4 85 + 18.011 * t3e6 - 8.566 * t4e8)) 86 - 0.001146 * Math.cos(deg2rad * (66.5106 + 349471.8432 * t - 335.112 * t2e4 87 - 35.715 * t3e6 + 16.854 * t4e8)) 88 - 0.000915 * Math.cos(deg2rad * (201.4740 + 826670.7108 * t - 245.142 * t2e4 89 - 21.367 * t3e6 + 10.057 * t4e8)) 90 + 0.000869 * Math.cos(deg2rad * (103.2079 + 377336.3051 * t - 121.035 * t2e4 91 - 10.724 * t3e6 + 5.028 * t4e8)) 92 - 0.000628 * Math.cos(deg2rad * (235.7004 + 890534.2230 * t - 32.601 * t2e4 93 + 3.664 * t3e6 - 1.769 * t4e8)) 94 - 0.000393 * Math.cos(deg2rad * (291.5472 - 127727.0245 * t - 425.082 * t2e4 95 - 50.062 * t3e6 + 23.651 * t4e8)) 96 + 0.000284 * Math.cos(deg2rad * (328.2445 - 99862.5625 * t - 211.005 * t2e4 97 - 25.072 * t3e6 + 11.826 * t4e8)) 98 - 0.000278 * Math.cos(deg2rad * (162.8868 - 31931.7561 * t - 106.271 * t2e4 99 - 12.516 * t3e6 + 5.913 * t4e8)) 100 - 0.000240 * Math.cos(deg2rad * (269.9268 + 954397.7353 * t + 179.941 * t2e4 101 + 28.695 * t3e6 - 13.594 * t4e8)) 102 + 0.000230 * Math.cos(deg2rad * (111.4008 + 1781068.4461 * t - 65.201 * t2e4 103 + 7.328 * t3e6 - 3.538 * t4e8)) 104 + 0.000229 * Math.cos(deg2rad * (167.2476 + 762807.1986 * t - 457.683 * t2e4 105 - 46.398 * t3e6 + 21.882 * t4e8)) 106 - 0.000202 * Math.cos(deg2rad * ( 83.3826 - 12006.2998 * t + 247.999 * t2e4 107 + 29.262 * t3e6 - 13.826 * t4e8)) 108 + 0.000190 * Math.cos(deg2rad * (190.8102 - 541062.3799 * t - 302.511 * t2e4 109 - 39.379 * t3e6 + 18.623 * t4e8)) 110 + 0.000177 * Math.cos(deg2rad * (357.5291 + 35999.0503 * t - 1.536 * t2e4 111 + 0.041 * t3e6 + 0.000 * t4e8)) 112 + 0.000153 * Math.cos(deg2rad * (32.2842 + 285608.3309 * t - 547.653 * t2e4 113 - 60.746 * t3e6 + 28.679 * t4e8)) 114 - 0.000137 * Math.cos(deg2rad * (44.8902 + 1431596.6029 * t + 269.911 * t2e4 115 + 43.043 * t3e6 - 20.392 * t4e8)) 116 + 0.000122 * Math.cos(deg2rad * (145.6272 + 1844931.9583 * t + 147.340 * t2e4 117 + 32.359 * t3e6 - 15.363 * t4e8)) 118 + 0.000116 * Math.cos(deg2rad * (302.2110 + 1240006.0662 * t - 367.713 * t2e4 119 - 32.051 * t3e6 + 15.085 * t4e8)) 120 - 0.000111 * Math.cos(deg2rad * (203.9449 + 790671.6605 * t - 243.606 * t2e4 121 - 21.408 * t3e6 + 10.057 * t4e8)) 122 - 0.000108 * Math.cos(deg2rad * (68.9815 + 313472.7929 * t - 333.576 * t2e4 123 - 35.756 * t3e6 + 16.854 * t4e8)) 124 + 0.000096 * Math.cos(deg2rad * (336.4374 + 1303869.5784 * t - 155.171 * t2e4 125 - 7.020 * t3e6 + 3.259 * t4e8)) 126 - 0.000090 * Math.cos(deg2rad * (98.2661 + 449334.4057 * t - 124.107 * t2e4 127 - 10.643 * t3e6 + 5.028 * t4e8)) 128 + 0.000090 * Math.cos(deg2rad * (13.1347 + 1331734.0404 * t + 58.906 * t2e4 129 + 17.971 * t3e6 - 8.566 * t4e8)) 130 + 0.000056 * Math.cos(deg2rad * (55.8468 - 1018261.2475 * t - 392.482 * t2e4 131 - 53.726 * t3e6 + 25.420 * t4e8)) 132 - 0.000056 * Math.cos(deg2rad * (238.1713 + 854535.1727 * t - 31.065 * t2e4 133 + 3.623 * t3e6 - 1.769 * t4e8)) 134 + 0.000052 * Math.cos(deg2rad * (308.4192 - 489205.1674 * t + 158.029 * t2e4 135 + 14.915 * t3e6 - 7.029 * t4e8)) 136 - 0.000050 * Math.cos(deg2rad * (133.0212 + 698943.6863 * t - 670.224 * t2e4 137 - 71.429 * t3e6 + 33.708 * t4e8)) 138 - 0.000049 * Math.cos(deg2rad * (267.9846 + 1176142.5540 * t - 580.254 * t2e4 139 - 57.082 * t3e6 + 26.911 * t4e8)) 140 - 0.000049 * Math.cos(deg2rad * (184.1196 + 401329.0556 * t + 125.428 * t2e4 141 + 18.579 * t3e6 - 8.798 * t4e8)) 142 - 0.000045 * Math.cos(deg2rad * (49.1562 - 75869.8120 * t + 35.458 * t2e4 143 + 4.231 * t3e6 - 2.001 * t4e8)) 144 + 0.000044 * Math.cos(deg2rad * (257.3208 - 191590.5367 * t - 637.623 * t2e4 145 - 75.093 * t3e6 + 35.477 * t4e8)) 146 + 0.000042 * Math.cos(deg2rad * (105.6788 + 341337.2548 * t - 119.499 * t2e4 147 - 10.765 * t3e6 + 5.028 * t4e8)) 148 + 0.000042 * Math.cos(deg2rad * (160.4159 + 4067.2942 * t - 107.806 * t2e4 149 - 12.475 * t3e6 + 5.913 * t4e8)) 150 + 0.000040 * Math.cos(deg2rad * (246.3642 + 2258267.3137 * t + 24.769 * t2e4 151 + 21.675 * t3e6 - 10.335 * t4e8)) 152 - 0.000040 * Math.cos(deg2rad * (156.5838 - 604925.8921 * t - 515.053 * t2e4 153 - 64.410 * t3e6 + 30.448 * t4e8)) 154 + 0.000036 * Math.cos(deg2rad * (169.7185 + 726808.1483 * t - 456.147 * t2e4 155 - 46.439 * t3e6 + 21.882 * t4e8)) 156 + 0.000029 * Math.cos(deg2rad * (113.8717 + 1745069.3958 * t - 63.665 * t2e4 157 + 7.287 * t3e6 - 3.538 * t4e8)) 158 - 0.000029 * Math.cos(deg2rad * (297.8502 + 445267.1115 * t - 16.300 * t2e4 159 + 1.832 * t3e6 - 0.884 * t4e8)) 160 - 0.000028 * Math.cos(deg2rad * (294.0181 - 163726.0747 * t - 423.546 * t2e4 161 - 50.103 * t3e6 + 23.651 * t4e8)) 162 + 0.000027 * Math.cos(deg2rad * (263.6238 + 381403.5993 * t - 228.841 * t2e4 163 - 23.199 * t3e6 + 10.941 * t4e8)) 164 - 0.000026 * Math.cos(deg2rad * (358.0578 + 221744.8187 * t - 760.194 * t2e4 165 - 85.777 * t3e6 + 40.505 * t4e8)) 166 - 0.000026 * Math.cos(deg2rad * (8.1929 + 1403732.1410 * t + 55.834 * t2e4 167 + 18.052 * t3e6 - 8.566 * t4e8));168 var sedp = -0.0022 * Math.cos(deg2rad * (103.2 + 377336.3 * t));169 var ecc = 0.055544 + se + 1e-3 * t * sedp;170 // sine of half the inclination171 var sg = 0.0011776 * Math.cos(deg2rad * (49.1562 - 75869.8120 * t + 35.458 * t2e4 172 + 4.231 * t3e6 - 2.001 * t4e8)) 173 - 0.0000971 * Math.cos(deg2rad * (235.7004 + 890534.2230 * t - 32.601 * t2e4 174 + 3.664 * t3e6 - 1.769 * t4e8)) 175 + 0.0000908 * Math.cos(deg2rad * (186.5442 + 966404.0351 * t - 68.058 * t2e4 176 - 0.567 * t3e6 + 0.232 * t4e8)) 177 + 0.0000623 * Math.cos(deg2rad * (83.3826 - 12006.2998 * t + 247.999 * t2e4 178 + 29.262 * t3e6 - 13.826 * t4e8)) 179 + 0.0000483 * Math.cos(deg2rad * (51.6271 - 111868.8623 * t + 36.994 * t2e4 180 + 4.190 * t3e6 - 2.001 * t4e8)) 181 + 0.0000348 * Math.cos(deg2rad * (100.7370 + 413335.3554 * t - 122.571 * t2e4 182 - 10.684 * t3e6 + 5.028 * t4e8)) 183 - 0.0000316 * Math.cos(deg2rad * (308.4192 - 489205.1674 * t + 158.029 * t2e4 184 + 14.915 * t3e6 - 7.029 * t4e8)) 185 - 0.0000253 * Math.cos(deg2rad * (46.6853 - 39870.7617 * t + 33.922 * t2e4 186 + 4.272 * t3e6 - 2.001 * t4e8)) 187 - 0.0000141 * Math.cos(deg2rad * (274.1928 - 553068.6797 * t - 54.513 * t2e4 188 - 10.116 * t3e6 + 4.797 * t4e8)) 189 + 0.0000127 * Math.cos(deg2rad * (325.7736 - 63863.5122 * t - 212.541 * t2e4 190 - 25.031 * t3e6 + 11.826 * t4e8)) 191 + 0.0000117 * Math.cos(deg2rad * (184.1196 + 401329.0556 * t + 125.428 * t2e4 192 + 18.579 * t3e6 - 8.798 * t4e8)) 193 - 0.0000078 * Math.cos(deg2rad * (98.3124 - 151739.6240 * t + 70.916 * t2e4 194 + 8.462 * t3e6 - 4.001 * t4e8)) 195 - 0.0000063 * Math.cos(deg2rad * (238.1713 + 854535.1727 * t - 31.065 * t2e4 196 + 3.623 * t3e6 - 1.769 * t4e8)) 197 + 0.0000063 * Math.cos(deg2rad * (134.9634 + 477198.8676 * t + 89.970 * t2e4 198 + 14.348 * t3e6 - 6.797 * t4e8)) 199 + 0.0000036 * Math.cos(deg2rad * (321.5076 + 1443602.9027 * t + 21.912 * t2e4 200 + 13.780 * t3e6 - 6.566 * t4e8)) 201 - 0.0000035 * Math.cos(deg2rad * (10.6638 + 1367733.0907 * t + 57.370 * t2e4 202 + 18.011 * t3e6 - 8.566 * t4e8)) 203 + 0.0000024 * Math.cos(deg2rad * (149.8932 + 337465.5434 * t - 87.113 * t2e4 204 - 6.453 * t3e6 + 3.028 * t4e8)) 205 + 0.0000024 * Math.cos(deg2rad * (170.9849 - 930404.9848 * t + 66.523 * t2e4 206 + 0.608 * t3e6 - 0.232 * t4e8));207 var sgp = - 0.0203 * Math.cos(deg2rad * (125.0 - 1934.1 * t)) 208 + 0.0034 * Math.cos(deg2rad * (220.2 - 1935.5 * t));209 var gamma = 0.0449858 + sg + 1e-3 * sgp;210 // longitude of perigee211 var sp = - 15.448 * Math.sin(deg2rad * (100.7370 + 413335.3554 * t - 122.571 * t2e4 212 - 10.684 * t3e6 + 5.028 * t4e8))213 - 9.642 * Math.sin(deg2rad * (325.7736 - 63863.5122 * t - 212.541 * t2e4 214 - 25.031 * t3e6 + 11.826 * t4e8)) 215 - 2.721 * Math.sin(deg2rad * (134.9634 + 477198.8676 * t + 89.970 * t2e4 216 + 14.348 * t3e6 - 6.797 * t4e8)) 217 + 2.607 * Math.sin(deg2rad * (66.5106 + 349471.8432 * t - 335.112 * t2e4 218 - 35.715 * t3e6 + 16.854 * t4e8)) 219 + 2.085 * Math.sin(deg2rad * (201.4740 + 826670.7108 * t - 245.142 * t2e4 220 - 21.367 * t3e6 + 10.057 * t4e8)) 221 + 1.477 * Math.sin(deg2rad * (10.6638 + 1367733.0907 * t + 57.370 * t2e4 222 + 18.011 * t3e6 - 8.566 * t4e8)) 223 + 0.968 * Math.sin(deg2rad * (291.5472 - 127727.0245 * t - 425.082 * t2e4 224 - 50.062 * t3e6 + 23.651 * t4e8)) 225 - 0.949 * Math.sin(deg2rad * (103.2079 + 377336.3051 * t - 121.035 * t2e4 226 - 10.724 * t3e6 + 5.028 * t4e8)) 227 - 0.703 * Math.sin(deg2rad * (167.2476 + 762807.1986 * t - 457.683 * t2e4 228 - 46.398 * t3e6 + 21.882 * t4e8)) 229 - 0.660 * Math.sin(deg2rad * (235.7004 + 890534.2230 * t - 32.601 * t2e4 230 + 3.664 * t3e6 - 1.769 * t4e8)) 231 - 0.577 * Math.sin(deg2rad * (190.8102 - 541062.3799 * t - 302.511 * t2e4 232 - 39.379 * t3e6 + 18.623 * t4e8)) 233 - 0.524 * Math.sin(deg2rad * (269.9268 + 954397.7353 * t + 179.941 * t2e4 234 + 28.695 * t3e6 - 13.594 * t4e8)) 235 - 0.482 * Math.sin(deg2rad * (32.2842 + 285608.3309 * t - 547.653 * t2e4 236 - 60.746 * t3e6 + 28.679 * t4e8)) 237 + 0.452 * Math.sin(deg2rad * (357.5291 + 35999.0503 * t - 1.536 * t2e4 238 + 0.041 * t3e6 + 0.000 * t4e8)) 239 - 0.381 * Math.sin(deg2rad * (302.2110 + 1240006.0662 * t - 367.713 * t2e4 240 - 32.051 * t3e6 + 15.085 * t4e8)) 241 - 0.342 * Math.sin(deg2rad * (328.2445 - 99862.5625 * t - 211.005 * t2e4 242 - 25.072 * t3e6 + 11.826 * t4e8)) 243 - 0.312 * Math.sin(deg2rad * (44.8902 + 1431596.6029 * t + 269.911 * t2e4 244 + 43.043 * t3e6 - 20.392 * t4e8)) 245 + 0.282 * Math.sin(deg2rad * (162.8868 - 31931.7561 * t - 106.271 * t2e4 246 - 12.516 * t3e6 + 5.913 * t4e8)) 247 + 0.255 * Math.sin(deg2rad * (203.9449 + 790671.6605 * t - 243.606 * t2e4 248 - 21.408 * t3e6 + 10.057 * t4e8)) 249 + 0.252 * Math.sin(deg2rad * (68.9815 + 313472.7929 * t - 333.576 * t2e4 250 - 35.756 * t3e6 + 16.854 * t4e8)) 251 - 0.211 * Math.sin(deg2rad * (83.3826 - 12006.2998 * t + 247.999 * t2e4 252 + 29.262 * t3e6 - 13.826 * t4e8)) 253 + 0.193 * Math.sin(deg2rad * (267.9846 + 1176142.5540 * t - 580.254 * t2e4 254 - 57.082 * t3e6 + 26.911 * t4e8)) 255 + 0.191 * Math.sin(deg2rad * (133.0212 + 698943.6863 * t - 670.224 * t2e4 256 - 71.429 * t3e6 + 33.708 * t4e8)) 257 - 0.184 * Math.sin(deg2rad * (55.8468 - 1018261.2475 * t - 392.482 * t2e4 258 - 53.726 * t3e6 + 25.420 * t4e8)) 259 + 0.182 * Math.sin(deg2rad * (145.6272 + 1844931.9583 * t + 147.340 * t2e4 260 + 32.359 * t3e6 - 15.363 * t4e8)) 261 - 0.158 * Math.sin(deg2rad * (257.3208 - 191590.5367 * t - 637.623 * t2e4 262 - 75.093 * t3e6 + 35.477 * t4e8)) 263 + 0.148 * Math.sin(deg2rad * (156.5838 - 604925.8921 * t - 515.053 * t2e4 264 - 64.410 * t3e6 + 30.448 * t4e8)) 265 - 0.111 * Math.sin(deg2rad * (169.7185 + 726808.1483 * t - 456.147 * t2e4 266 - 46.439 * t3e6 + 21.882 * t4e8)) 267 + 0.101 * Math.sin(deg2rad * (13.1347 + 1331734.0404 * t + 58.906 * t2e4 268 + 17.971 * t3e6 - 8.566 * t4e8)) 269 + 0.100 * Math.sin(deg2rad * (358.0578 + 221744.8187 * t - 760.194 * t2e4 270 - 85.777 * t3e6 + 40.505 * t4e8)) 271 + 0.087 * Math.sin(deg2rad * (98.2661 + 449334.4057 * t - 124.107 * t2e4 272 - 10.643 * t3e6 + 5.028 * t4e8)) 273 + 0.080 * Math.sin(deg2rad * (42.9480 + 1653341.4216 * t - 490.283 * t2e4 274 - 42.734 * t3e6 + 20.113 * t4e8)) 275 + 0.080 * Math.sin(deg2rad * (222.5657 - 441199.8173 * t - 91.506 * t2e4 276 - 14.307 * t3e6 + 6.797 * t4e8)) 277 + 0.077 * Math.sin(deg2rad * (294.0181 - 163726.0747 * t - 423.546 * t2e4 278 - 50.103 * t3e6 + 23.651 * t4e8)) 279 - 0.073 * Math.sin(deg2rad * (280.8834 - 1495460.1151 * t - 482.452 * t2e4 280 - 68.074 * t3e6 + 32.217 * t4e8)) 281 - 0.071 * Math.sin(deg2rad * (304.6819 + 1204007.0159 * t - 366.177 * t2e4 282 - 32.092 * t3e6 + 15.085 * t4e8)) 283 - 0.069 * Math.sin(deg2rad * (233.7582 + 1112279.0417 * t - 792.795 * t2e4 284 - 82.113 * t3e6 + 38.736 * t4e8)) 285 - 0.067 * Math.sin(deg2rad * (34.7551 + 249609.2807 * t - 546.117 * t2e4 286 - 60.787 * t3e6 + 28.679 * t4e8)) 287 - 0.067 * Math.sin(deg2rad * (263.6238 + 381403.5993 * t - 228.841 * t2e4 288 - 23.199 * t3e6 + 10.941 * t4e8)) 289 + 0.055 * Math.sin(deg2rad * (21.6203 - 1082124.7597 * t - 605.023 * t2e4 290 - 78.757 * t3e6 + 37.246 * t4e8)) 291 + 0.055 * Math.sin(deg2rad * (308.4192 - 489205.1674 * t + 158.029 * t2e4 292 + 14.915 * t3e6 -7.029 * t4e8)) 293 - 0.054 * Math.sin(deg2rad * (8.7216 + 1589477.9094 * t - 702.824 * t2e4 294 - 67.766 * t3e6 + 31.939 * t4e8)) 295 - 0.052 * Math.sin(deg2rad * (179.8536 + 1908795.4705 * t + 359.881 * t2e4 296 + 57.390 * t3e6 - 27.189 * t4e8)) 297 - 0.050 * Math.sin(deg2rad * (98.7948 + 635080.1741 * t - 882.765 * t2e4 298 - 96.461 * t3e6 + 45.533 * t4e8)) 299 - 0.049 * Math.sin(deg2rad * (128.6604 - 95795.2683 * t - 318.812 * t2e4 300 - 37.547 * t3e6 + 17.738 * t4e8)) 301 - 0.047 * Math.sin(deg2rad * (17.3544 + 425341.6552 * t - 370.570 * t2e4 302 - 39.946 * t3e6 + 18.854 * t4e8)) 303 - 0.044 * Math.sin(deg2rad * (160.4159 + 4067.2942 * t - 107.806 * t2e4 304 - 12.475 * t3e6 + 5.913 * t4e8)) 305 - 0.043 * Math.sin(deg2rad * (238.1713 + 854535.1727 * t - 31.065 * t2e4 306 + 3.623 * t3e6 - 1.769 * t4e8)) 307 + 0.042 * Math.sin(deg2rad * (270.4555 + 1140143.5037 * t - 578.718 * t2e4 308 - 57.123 * t3e6 + 26.911 * t4e8)) 309 - 0.042 * Math.sin(deg2rad * (132.4925 + 513197.9179 * t + 88.434 * t2e4 310 + 14.388 * t3e6 - 6.797 * t4e8)) 311 - 0.041 * Math.sin(deg2rad * (122.3573 - 668789.4043 * t - 727.594 * t2e4 312 - 89.441 * t3e6 + 42.274 * t4e8)) 313 - 0.040 * Math.sin(deg2rad * (105.6788 + 341337.2548 * t - 119.499 * t2e4 314 - 10.765 * t3e6 + 5.028 * t4e8)) 315 + 0.038 * Math.sin(deg2rad * (135.4921 + 662944.6361 * t - 668.688 * t2e4 316 - 71.470 * t3e6 + 33.708 * t4e8)) 317 - 0.037 * Math.sin(deg2rad * (242.3910 - 51857.2124 * t - 460.540 * t2e4 318 - 54.293 * t3e6 + 25.652 * t4e8)) 319 + 0.036 * Math.sin(deg2rad * (336.4374 + 1303869.5784 * t - 155.171 * t2e4 320 - 7.020 * t3e6 + 3.259 * t4e8)) 321 + 0.035 * Math.sin(deg2rad * (223.0943 - 255454.0489 * t - 850.164 * t2e4 322 - 100.124 * t3e6 + 47.302 * t4e8)) 323 - 0.034 * Math.sin(deg2rad * (193.2811 - 577061.4302 * t - 300.976 * t2e4 324 - 39.419 * t3e6 + 18.623 * t4e8)) 325 + 0.031 * Math.sin(deg2rad * (87.6023 - 918398.6850 * t - 181.476 * t2e4 326 - 28.654 * t3e6 + 13.594 * t4e8));327 var spp = 2.4 * Math.sin(deg2rad * (103.2 + 377336.3 * t));328 var lp = 83.353 + 4069.0137 * t - 103.238 * t2e4 329 - 12.492 * t3e6 + 5.263 * t4e8 + sp + 1e-3 * t * spp;330 // longitude of the ascending node331 var sr = - 1.4979 * Math.sin(deg2rad * (49.1562 - 75869.8120 * t + 35.458 * t2e4 332 + 4.231 * t3e6 - 2.001 * t4e8)) 333 - 0.1500 * Math.sin(deg2rad * (357.5291 + 35999.0503 * t - 1.536 * t2e4 334 + 0.041 * t3e6 + 0.000 * t4e8)) 335 - 0.1226 * Math.sin(deg2rad * (235.7004 + 890534.2230 * t - 32.601 * t2e4 336 + 3.664 * t3e6 - 1.769 * t4e8)) 337 + 0.1176 * Math.sin(deg2rad * (186.5442 + 966404.0351 * t - 68.058 * t2e4 338 - 0.567 * t3e6 + 0.232 * t4e8)) 339 - 0.0801 * Math.sin(deg2rad * (83.3826 - 12006.2998 * t + 247.999 * t2e4 340 + 29.262 * t3e6 - 13.826 * t4e8)) 341 - 0.0616 * Math.sin(deg2rad * (51.6271 - 111868.8623 * t + 36.994 * t2e4 342 + 4.190 * t3e6 - 2.001 * t4e8)) 343 + 0.0490 * Math.sin(deg2rad * (100.7370 + 413335.3554 * t - 122.571 * t2e4 344 - 10.684 * t3e6 + 5.028 * t4e8)) 345 + 0.0409 * Math.sin(deg2rad * (308.4192 - 489205.1674 * t + 158.029 * t2e4 346 + 14.915 * t3e6 - 7.029 * t4e8)) 347 + 0.0327 * Math.sin(deg2rad * (134.9634 + 477198.8676 * t + 89.970 * t2e4 348 + 14.348 * t3e6 - 6.797 * t4e8)) 349 + 0.0324 * Math.sin(deg2rad * (46.6853 - 39870.7617 * t + 33.922 * t2e4 350 + 4.272 * t3e6 - 2.001 * t4e8)) 351 + 0.0196 * Math.sin(deg2rad * (98.3124 - 151739.6240 * t + 70.916 * t2e4 352 + 8.462 * t3e6 - 4.001 * t4e8)) 353 + 0.0180 * Math.sin(deg2rad * (274.1928 - 553068.6797 * t - 54.513 * t2e4 354 - 10.116 * t3e6 + 4.797 * t4e8)) 355 + 0.0150 * Math.sin(deg2rad * (325.7736 - 63863.5122 * t - 212.541 * t2e4 356 - 25.031 * t3e6 + 11.826 * t4e8)) 357 - 0.0150 * Math.sin(deg2rad * (184.1196 + 401329.0556 * t + 125.428 * t2e4 358 + 18.579 * t3e6 - 8.798 * t4e8)) 359 - 0.0078 * Math.sin(deg2rad * (238.1713 + 854535.1727 * t - 31.065 * t2e4 360 + 3.623 * t3e6 - 1.769 * t4e8)) 361 - 0.0045 * Math.sin(deg2rad * (10.6638 + 1367733.0907 * t + 57.370 * t2e4 362 + 18.011 * t3e6 - 8.566 * t4e8)) 363 + 0.0044 * Math.sin(deg2rad * (321.5076 + 1443602.9027 * t + 21.912 * t2e4 364 + 13.780 * t3e6 - 6.566 * t4e8)) 365 - 0.0042 * Math.sin(deg2rad * (162.8868 - 31931.7561 * t - 106.271 * t2e4 366 - 12.516 * t3e6 + 5.913 * t4e8)) 367 - 0.0031 * Math.sin(deg2rad * (170.9849 - 930404.9848 * t + 66.523 * t2e4 368 + 0.608 * t3e6 - 0.232 * t4e8)) 369 + 0.0031 * Math.sin(deg2rad * (103.2079 + 377336.3051 * t - 121.035 * t2e4 370 - 10.724 * t3e6 + 5.028 * t4e8)) 371 + 0.0029 * Math.sin(deg2rad * (222.6120 - 1042273.8471 * t + 103.516 * t2e4 372 + 4.798 * t3e6 - 2.232 * t4e8)) 373 + 0.0028 * Math.sin(deg2rad * (184.0733 + 1002403.0853 * t - 69.594 * t2e4 374 - 0.526 * t3e6 + 0.232 * t4e8));375 var srp = 25.9 * Math.sin(deg2rad * (125.0 - 1934.1 * t)) 376 - 4.3 * Math.sin(deg2rad * (220.2 - 1935.5 * t));377 var srpp = 0.38 * Math.sin(deg2rad * (357.5 + 35999.1 * t));378 var raan = 125.0446 - 1934.13618 * t + 20.762 * t2e4 379 + 2.139 * t3e6 - 1.650 * t4e8 + sr 380 + 1e-3 * (srp + srpp * t);381 // mean longitude382 var sl = - 0.92581 * Math.sin(deg2rad * (235.7004 + 890534.2230 * t - 32.601 * t2e4 383 + 3.664 * t3e6 - 1.769 * t4e8)) 384 + 0.33262 * Math.sin(deg2rad * (100.7370 + 413335.3554 * t - 122.571 * t2e4 385 - 10.684 * t3e6 + 5.028 * t4e8)) 386 - 0.18402 * Math.sin(deg2rad * (357.5291 + 35999.0503 * t - 1.536 * t2e4 387 + 0.041 * t3e6 + 0.000 * t4e8)) 388 + 0.11007 * Math.sin(deg2rad * (134.9634 + 477198.8676 * t + 89.970 * t2e4 389 + 14.348 * t3e6 - 6.797 * t4e8)) 390 - 0.06055 * Math.sin(deg2rad * (238.1713 + 854535.1727 * t - 31.065 * t2e4 391 + 3.623 * t3e6 - 1.769 * t4e8)) 392 + 0.04741 * Math.sin(deg2rad * (325.7736 - 63863.5122 * t - 212.541 * t2e4 393 - 25.031 * t3e6 + 11.826 * t4e8)) 394 - 0.03086 * Math.sin(deg2rad * (10.6638 + 1367733.0907 * t + 57.370 * t2e4 395 + 18.011 * t3e6 - 8.566 * t4e8)) 396 + 0.02184 * Math.sin(deg2rad * (103.2079 + 377336.3051 * t - 121.035 * t2e4 397 - 10.724 * t3e6 + 5.028 * t4e8)) 398 + 0.01645 * Math.sin(deg2rad * (49.1562 - 75869.8120 * t + 35.458 * t2e4 399 + 4.231 * t3e6 - 2.001 * t4e8)) 400 + 0.01022 * Math.sin(deg2rad * (233.2295 + 926533.2733 * t - 34.136 * t2e4 401 + 3.705 * t3e6 - 1.769 * t4e8)) 402 - 0.00756 * Math.sin(deg2rad * (336.4374 + 1303869.5784 * t - 155.171 * t2e4 403 - 7.020 * t3e6 + 3.259 * t4e8)) 404 - 0.00530 * Math.sin(deg2rad * (222.5657 - 441199.8173 * t - 91.506 * t2e4 405 - 14.307 * t3e6 + 6.797 * t4e8)) 406 - 0.00496 * Math.sin(deg2rad * (162.8868 - 31931.7561 * t - 106.271 * t2e4 407 - 12.516 * t3e6 + 5.913 * t4e8)) 408 - 0.00472 * Math.sin(deg2rad * (297.8502 + 445267.1115 * t - 16.300 * t2e4 409 + 1.832 * t3e6 - 0.884 * t4e8)) 410 - 0.00271 * Math.sin(deg2rad * (240.6422 + 818536.1225 * t - 29.529 * t2e4 411 + 3.582 * t3e6 - 1.769 * t4e8)) 412 + 0.00264 * Math.sin(deg2rad * (132.4925 + 513197.9179 * t + 88.434 * t2e4 413 + 14.388 * t3e6 - 6.797 * t4e8)) 414 - 0.00254 * Math.sin(deg2rad * (186.5442 + 966404.0351 * t - 68.058 * t2e4 415 - 0.567 * t3e6 + 0.232 * t4e8)) 416 + 0.00234 * Math.sin(deg2rad * (269.9268 + 954397.7353 * t + 179.941 * t2e4 417 + 28.695 * t3e6 - 13.594 * t4e8)) 418 - 0.00220 * Math.sin(deg2rad * (13.1347 + 1331734.0404 * t + 58.906 * t2e4 419 + 17.971 * t3e6 - 8.566 * t4e8)) 420 - 0.00202 * Math.sin(deg2rad * (355.0582 + 71998.1006 * t - 3.072 * t2e4 421 + 0.082 * t3e6 + 0.000 * t4e8)) 422 + 0.00167 * Math.sin(deg2rad * (328.2445 - 99862.5625 * t - 211.005 * t2e4 423 - 25.072 * t3e6 + 11.826 * t4e8)) 424 - 0.00143 * Math.sin(deg2rad * (173.5506 + 1335801.3346 * t - 48.901 * t2e4 425 + 5.496 * t3e6 - 2.653 * t4e8)) 426 - 0.00121 * Math.sin(deg2rad * (98.2661 + 449334.4057 * t - 124.107 * t2e4 427 - 10.643 * t3e6 + 5.028 * t4e8)) 428 - 0.00116 * Math.sin(deg2rad * (145.6272 + 1844931.9583 * t + 147.340 * t2e4 429 + 32.359 * t3e6 - 15.363 * t4e8)) 430 + 0.00102 * Math.sin(deg2rad * (105.6788 + 341337.2548 * t - 119.499 * t2e4 431 - 10.765 * t3e6 + 5.028 * t4e8)) 432 - 0.00090 * Math.sin(deg2rad * (184.1196 + 401329.0556 * t + 125.428 * t2e4 433 + 18.579 * t3e6 - 8.798 * t4e8)) 434 - 0.00086 * Math.sin(deg2rad * (338.9083 + 1267870.5281 * t - 153.636 * t2e4 435 - 7.061 * t3e6 + 3.259 * t4e8)) 436 - 0.00078 * Math.sin(deg2rad * (111.4008 + 1781068.4461 * t - 65.201 * t2e4 437 + 7.328 * t3e6 - 3.538 * t4e8)) 438 + 0.00069 * Math.sin(deg2rad * (323.3027 - 27864.4619 * t - 214.077 * t2e4 439 - 24.990 * t3e6 + 11.826 * t4e8)) 440 + 0.00066 * Math.sin(deg2rad * (51.6271 - 111868.8623 * t + 36.994 * t2e4 441 + 4.190 * t3e6 - 2.001 * t4e8)) 442 + 0.00065 * Math.sin(deg2rad * (38.5872 + 858602.4669 * t - 138.871 * t2e4 443 - 8.852 * t3e6 + 4.144 * t4e8)) 444 - 0.00060 * Math.sin(deg2rad * (83.3826 - 12006.2998 * t + 247.999 * t2e4 445 + 29.262 * t3e6 - 13.826 * t4e8)) 446 + 0.00054 * Math.sin(deg2rad * (201.4740 + 826670.7108 * t - 245.142 * t2e4 447 - 21.367 * t3e6 + 10.057 * t4e8)) 448 - 0.00052 * Math.sin(deg2rad * (308.4192 - 489205.1674 * t + 158.029 * t2e4 449 + 14.915 * t3e6 - 7.029 * t4e8)) 450 + 0.00048 * Math.sin(deg2rad * (8.1929 + 1403732.1410 * t + 55.834 * t2e4 451 + 18.052 * t3e6 - 8.566 * t4e8)) 452 - 0.00041 * Math.sin(deg2rad * (46.6853 - 39870.7617 * t + 33.922 * t2e4 453 + 4.272 * t3e6 - 2.001 * t4e8)) 454 - 0.00033 * Math.sin(deg2rad * (274.1928 - 553068.6797 * t - 54.513 * t2e4 455 - 10.116 * t3e6 + 4.797 * t4e8)) 456 + 0.00030 * Math.sin(deg2rad * (160.4159 + 4067.2942 * t - 107.806 * t2e4 457 - 12.475 * t3e6 + 5.913 * t4e8));458 var slp = 3.96 * Math.sin(deg2rad * (119.7 + 131.8 * t)) 459 + 1.96 * Math.sin(deg2rad * (125.0 - 1934.1 * t));460 var slpp = 0.463 * Math.sin(deg2rad * (357.5 + 35999.1 * t)) 461 + 0.152 * Math.sin(deg2rad * (238.2 + 854535.2 * t)) 462 - 0.071 * Math.sin(deg2rad * (27.8 + 131.8 * t)) 463 - 0.055 * Math.sin(deg2rad * (103.2 + 377336.3 * t)) 464 - 0.026 * Math.sin(deg2rad * (233.2 + 926533.3 * t));465 var slppp = 14 * Math.sin(deg2rad * (357.5 + 35999.1 * t)) 466 + 5 * Math.sin(deg2rad * (238.2 + 854535.2 * t));467 var lambda = 218.31665 + 481267.88134 * t - 13.268 * t2e4 468 + 1.856 * t3e6 - 1.534 * t4e8 + sl 469 + 1e-3 * (slp + slpp * t + slppp * t2e4);470 dat.a = sma;471 dat.e = ecc;472 dat.i = 2.0 * Math.asin(gamma);473 dat.w = Trig.normalize(deg2rad * (lp - raan));474 dat.N = Trig.normalize(deg2rad * raan);475 dat.M = Trig.normalize(deg2rad * (lambda - lp));476 return dat;477 },478 corr: function(dat, sol) {479 var M = Trig.normalize(sol.M + Math.PI),480 w = Trig.normalize(sol.w + Math.PI),481 L = dat.M + dat.w, // Argument of latitude 482 E = L + dat.N - M - w; // Mean elongation483 484 var lon = 485 -0.022234 * Math.sin(dat.M - 2*E) + // Evection486 0.011494 * Math.sin(2*E) + // Variation487 -0.003246 * Math.sin(M) + // Yearly Equation488 -0.001029 * Math.sin(2*dat.M - 2*E) +489 -9.94838e-4 * Math.sin(dat.M - 2*E + M) +490 9.25025e-4 * Math.sin(dat.M + 2*E) +491 8.02851e-4 * Math.sin(2*E - M) +492 7.15585e-4 * Math.sin(dat.M - M) +493 -6.10865e-4 * Math.sin(E) + 494 -5.41052e-4 * Math.sin(dat.M + M) +495 -2.61799e-4 * Math.sin(2*L - 2*E) +496 1.91986e-4 * Math.sin(dat.M - 4*E);497 dat.ra += lon;498 var lat =499 -0.003019 * Math.sin(L - 2*E) +500 -9.59931e-4 * Math.sin(dat.M - L - 2*E) +501 -8.02851e-4 * Math.sin(dat.M + L - 2*E) +502 5.75958e-4 * Math.sin(L + 2*E) +503 2.96706e-4 * Math.sin(2*dat.M + L); 504 dat.dec += lat;505 506 dat.age = Trig.normalize(dat.l - sol.l + Math.PI); 507 dat.phase = 0.5 * (1 - Math.cos(dat.age));508 return dat;509 }...
constants.js
Source:constants.js
1// It appears sitTarpHt and chairTarpHt are the same for many configs2// Consider global var for diagonal = 2 * len * len3const lean_to = {4 configName: "Lean-To",5 type: "Lean-To",6 angles: [30, 60],7 tarpTypes: [square, rectangle],8 sleepClear: len - height,9 cover(angle) {10 return Math.round(Math.cos(angle * deg2Rad) * wid);11 },12 ridgeHeight(angle) {13 return Math.round(Math.sin(angle * deg2Rad) * wid);14 },15 sitTarpHt(angle) {16 return Math.round(Math.tan(angle * deg2Rad) * sitCover);17 },18 chairTarpHt(angle) {19 return Math.round(Math.tan(angle * deg2Rad) * chairCover);20 }21};22// what about frlt 67 and 75? and should this one be Flat Roof LT 50?23const flat_roof_LT50 = {24 configName: "Flat Roof LT",25 type: "Lean-To",26 angles: [30, 60],27 tarpTypes: [square, rectangle],28 sleepClear: len - height,29 cover(angle) {30 return Math.round(Math.cos(angle * deg2Rad) * (wid * 0.5) + wid * 0.5);31 },32 ridgeHeight(angle) {33 return Math.round(Math.sin(angle * deg2Rad) * (wid * 0.5));34 },35 // get the ridgeHeight at the 50 mark and then test36 sitTarpHt(angle) {37 return Math.round(Math.tan(angle * deg2Rad) * sitCover);38 },39 // get the ridgeHeight at the 50 mark and then test40 chairTarpHt(angle) {41 return Math.round(Math.tan(angle * deg2Rad) * chairCover);42 }43};44const flat_roof_LT67 = {45 configName: "Flat Roof LT",46 type: "Lean-To",47 angles: [30, 60],48 tarpTypes: [square, rectangle],49 sleepClear: len - height,50 cover(angle) {51 return Math.round(Math.cos(angle * deg2Rad) * (wid * 0.667) + wid * 0.333);52 },53 ridgeHeight(angle) {54 return Math.round(Math.sin(angle * deg2Rad) * (wid * 0.667));55 },56 // get the ridgeHeight at the 2/3rds mark and then test57 sitTarpHt(angle) {58 return Math.round(Math.tan(angle * deg2Rad) * sitCover);59 },60 // get the ridgeHeight at the 2/3rds mark and then test61 chairTarpHt(angle) {62 return Math.round(Math.tan(angle * deg2Rad) * chairCover);63 }64};65const flat_roof_LT75 = {66 configName: "Flat Roof LT",67 type: "Lean-To",68 angles: [30, 60],69 tarpTypes: [square, rectangle],70 sleepClear: len - height,71 cover(angle) {72 return Math.round(Math.cos(angle * deg2Rad) * (wid * 0.75) + wid * 0.25);73 },74 ridgeHeight(angle) {75 return Math.round(Math.sin(angle * deg2Rad) * (wid * 0.75));76 },77 // get the ridgeHeight at the 75 mark and then test78 sitTarpHt(angle) {79 return Math.round(Math.tan(angle * deg2Rad) * sitCover);80 },81 // get the ridgeHeight at the 75 mark and then test82 chairTarpHt(angle) {83 return Math.round(Math.tan(angle * deg2Rad) * chairCover);84 }85};86const back_wall_LT25 = {87 configName: "Back Wall LT 25",88 type: "Lean-To",89 angles: [30, 60],90 tarpTypes: [square, rectangle],91 sleepClear: len - height,92 cover(angle) {93 return Math.round(Math.cos(angle * deg2Rad) * (wid * 0.75));94 },95 ridgeHeight(angle) {96 return Math.round(Math.sin(angle * deg2Rad) * (wid * 0.75) + wid * 0.25);97 },98 sitTarpHt(angle) {99 return Math.round(Math.tan(angle * deg2Rad) * sitCover);100 },101 chairTarpHt(angle) {102 return Math.round(Math.tan(angle * deg2Rad) * chairCover);103 }104};105const back_wall_LT33 = {106 configName: "Back Wall LT 33",107 type: "Lean-To",108 angles: [30, 45, 60],109 tarpTypes: [square, rectangle],110 sleepClear: len - height,111 cover(angle) {112 return Math.round(Math.cos(angle * deg2Rad) * (wid * 0.667));113 },114 ridgeHeight(angle) {115 return Math.round(Math.sin(angle * deg2Rad) * (wid * 0.667) + wid * 0.333);116 },117 sitTarpHt(angle) {118 return Math.round(Math.tan(angle * deg2Rad) * sitCover);119 },120 chairTarpHt(angle) {121 return Math.round(Math.tan(angle * deg2Rad) * chairCover);122 }123};124const bwfr_LT25 = {125 configName: "BWFR LT 25",126 type: "Lean-To",127 angles: [30, 45, 60],128 tarpTypes: [square, rectangle],129 sleepClear: len - height,130 cover(angle) {131 return Math.round(Math.cos(angle * deg2Rad) * (wid * 0.5) + wid * 0.25);132 },133 ridgeHeight(angle) {134 return Math.round(Math.sin(angle * deg2Rad) * (wid * 0.5) + wid * 0.25);135 },136 sitTarpHt(angle) {137 return Math.round(Math.tan(angle * deg2Rad) * sitCover);138 },139 chairTarpHt(angle) {140 return Math.round(Math.tan(angle * deg2Rad) * chairCover);141 }142};143const bwfr_LT33 = {144 configName: "BWFR LT 33",145 type: "Lean-To",146 angles: [30, 45, 60],147 tarpTypes: [square, rectangle],148 sleepClear: len - height,149 cover(angle) {150 return Math.round(Math.cos(angle * deg2Rad) * (wid * 0.333) + wid * 0.333);151 },152 ridgeHeight(angle) {153 return Math.round(Math.sin(angle * deg2Rad) * (wid * 0.667) + wid * 0.333);154 },155 sitTarpHt(angle) {156 return Math.round(Math.tan(angle * deg2Rad) * sitCover);157 },158 chairTarpHt(angle) {159 return Math.round(Math.tan(angle * deg2Rad) * chairCover);160 }161};162// Move all A-Frames to under Lean-Tos163const aframe = {164 configName: "A-Frame",165 type: "A-Frame",166 angles: [45, 60],167 tarpTypes: [square, rectangle],168 sleepClear: len - height,169 cover(angle) {170 return Math.round(Math.cos(angle * deg2Rad) * wid);171 },172 ridgeHeight(angle) {173 return Math.round(Math.sin(angle * deg2Rad) * (wid * 0.5));174 },175 sitTarpHt(angle) {176 return Math.round(Math.tan(angle * deg2Rad) * sitCover);177 },178 chairTarpHt(angle) {179 return Math.round(Math.tan(angle * deg2Rad) * chairCover);180 }181};182const tube_tent = {183 configName: "Tube Tent",184 type: "A-Frame",185 angles: [45, 60],186 tarpTypes: [rectangle.rect1to2],187 sleepClear: len - height,188 cover(angle) {189 return Math.round(Math.cos(angle * deg2Rad) * wid * 0.667);190 },191 ridgeHeight(angle) {192 return Math.round(Math.sin(angle * deg2Rad) * wid * 0.333);193 },194 sitTarpHt(angle) {195 return Math.round(Math.tan(angle * deg2Rad) * sitCover);196 },197 chairTarpHt(angle) {198 return Math.round(Math.tan(angle * deg2Rad) * chairCover);199 }200};201const aframe_LT75 = {202 configName: "A-Frame LT 75",203 type: "A-Frame",204 angles: [45, 60],205 tarpTypes: [square, rectangle],206 sleepClear: len - height,207 cover(angle) {208 // Wrong, s\b Math.round(Math.cos(i * deg2Rad) * wid); same as A-frame209 return Math.round(Math.cos(angle * deg2Rad) * wid * 0.75 + Math.cos(angle * deg2Rad) * wid * 0.25);210 },211 ridgeHeight(angle) {212 return Math.round(Math.sin(angle * deg2Rad) * wid * 0.75);213 },214 sitTarpHt(angle) {215 return Math.round(Math.tan(angle * deg2Rad) * sitCover);216 },217 chairTarpHt(angle) {218 return Math.round(Math.tan(angle * deg2Rad) * chairCover);219 }220};221const aframe_LT67 = {222 configName: "A-Frame LT 67",223 type: "A-Frame",224 angles: [45, 60],225 tarpTypes: [square, rectangle],226 sleepClear: len - height,227 cover(angle) {228 // Wrong, s\b Math.round(Math.cos(i * deg2Rad) * wid); same as A-frame229 return Math.round(Math.cos(angle * deg2Rad) * wid * 0.667 + Math.cos(angle * deg2Rad) * wid * 0.333);230 },231 ridgeHeight(angle) {232 return Math.round(Math.sin(angle * deg2Rad) * wid * 0.667);233 },234 sitTarpHt(angle) {235 return Math.round(Math.tan(angle * deg2Rad) * sitCover);236 },237 chairTarpHt(angle) {238 return Math.round(Math.tan(angle * deg2Rad) * chairCover);239 }240};241const open_stall = {242 configName: "Open Stall",243 type: "A-Frame",244 angles: [45, 60],245 tarpTypes: [square, rectangle],246 sleepClear: len - height,247 cover(angle) {248 // not 0.333 *2, but 0.667249 return Math.round(Math.cos(angle * deg2Rad) * wid * 0.333 * 2);250 },251 ridgeHeight(angle) {252 return Math.round(Math.sin(angle * deg2Rad) * wid * 0.333 + wid * 0.333);253 },254 sitTarpHt(angle) {255 return Math.round(Math.tan(angle * deg2Rad) * sitCover);256 },257 chairTarpHt(angle) {258 return Math.round(Math.tan(angle * deg2Rad) * chairCover);259 }260};261const side_wallAF50 = {262 configName: "Side Wall AF",263 type: "A-Frame",264 angles: [45, 60],265 tarpTypes: [square, rectangle],266 sleepClear: len - height,267 cover(angle) {268 return Math.round(Math.cos(angle * deg2Rad) * wid * 0.5);269 },270 ridgeHeight(angle) {271 return Math.round(Math.sin(angle * deg2Rad) * wid * 0.25 + wid * 0.25);272 },273 sitTarpHt(angle) {274 return Math.round(Math.tan(angle * deg2Rad) * sitCover);275 },276 chairTarpHt(angle) {277 return Math.round(Math.tan(angle * deg2Rad) * chairCover);278 }279};280const side_wallAF33 = {281 configName: "Side Wall AF",282 type: "A-Frame",283 angles: [45, 60],284 tarpTypes: [square, rectangle],285 sleepClear: len - height,286 cover(angle) {287 return Math.round(Math.cos(angle * deg2Rad) * wid * 0.333);288 },289 ridgeHeight(angle) {290 return Math.round(Math.sin(angle * deg2Rad) * wid * 0.333 + wid * 0.333);291 },292 sitTarpHt(angle) {293 return Math.round(Math.tan(angle * deg2Rad) * sitCover);294 },295 chairTarpHt(angle) {296 return Math.round(Math.tan(angle * deg2Rad) * chairCover);297 }298};299const open_tube50 = {300 configName: "Open Tube Tent 50",301 type: "A-Frame",302 angles: [30, 60],303 tarpTypes: [rectangle.rect1to2],304 sleepClear: len - height,305 cover(angle) {306 return Math.round(Math.cos(angle * deg2Rad) * wid * 0.5 + Math.cos(angle * deg2Rad) * wid * 0.25);307 },308 ridgeHeight(angle) {309 return Math.round(Math.sin(angle * deg2Rad) * wid * 0.5 + wid * 0.25);310 },311 sitTarpHt(angle) {312 return Math.round(Math.tan(angle * deg2Rad) * sitCover);313 },314 chairTarpHt(angle) {315 return Math.round(Math.tan(angle * deg2Rad) * chairCover);316 }317};318const open_tube33 = {319 configName: "Open Tube Tent 33",320 type: "A-Frame",321 angles: [30, 45, 60, 75],322 tarpTypes: [rectangle.rect1to2],323 sleepClear: len - height,324 // I chose to make it a flat roof: open_tube_fr33325 cover(angle) {326 return Math.round(Math.cos(angle * deg2Rad) * wid * 0.333 + wid * 0.333);327 },328 ridgeHeight(angle) {329 return Math.round(Math.sin(angle * deg2Rad) * wid * 0.333);330 },331 sitTarpHt(angle) {332 return Math.round(Math.tan(angle * deg2Rad) * sitCover);333 },334 chairTarpHt(angle) {335 return Math.round(Math.tan(angle * deg2Rad) * chairCover);336 }337};338// Sleep clearance change339const plow_point = {340 configName: "Plow Point 33",341 type: "Diagonal",342 angles: [33],343 tarpTypes: [square],344 // sleepClear: Math.cos(33 * deg2Rad) * Math.sqrt(2 * len * len) - ht,345 sleepClear(angle) {346 return Math.round(Math.cos(angle * deg2Rad) * Math.sqrt(2 * len * len) - height);347 },348 // Is cover correct? NO!349 cover(angle) {350 return Math.round(Math.cos(angle * deg2Rad) * len * 2);351 },352 ridgeHeight(angle) {353 return Math.round(Math.sin(angle * deg2Rad) * len);354 },355 sitTarpHt(angle) {356 return Math.round(Math.tan(angle * deg2Rad) * sitCover);357 },358 chairTarpHt(angle) {359 return Math.round(Math.tan(angle * deg2Rad) * chairCover);360 }361};362const adirondack = {363 configName: "Adirondack 45",364 type: "Diagonal",365 angles: [45],366 tarpTypes: [square],367 // sleepClear: len / 2 / Math.sin(x) - ht,368 sleepClear(angle) {369 return Math.round(len / 2 / Math.sin(angle * deg2Rad) - height);370 },371 cover(angle) {372 return Math.round(Math.cos(angle * deg2Rad) * Math.sqrt(2 * len * len));373 },374 ridgeHeight(angle) {375 return Math.round(Math.sin(angle * deg2Rad) * Math.sqrt(2 * len * len));376 },377 sitTarpHt(angle) {378 return Math.round(Math.tan(angle * deg2Rad) * sitCover);379 },380 chairTarpHt(angle) {381 return Math.round(Math.tan(angle * deg2Rad) * chairCover);382 }383};384const diamond = {385 configName: "Diamond",386 type: "Diagonal",387 angles: [45, 60],388 tarpTypes: [square],389 // sleepClear: Math.sqrt(2 * len * len) - ht,390 sleepClear(angle) {391 return Math.round(Math.sqrt(2 * len * len) - height);392 },393 cover(angle) {394 return Math.round(Math.cos(angle * deg2Rad) * Math.sqrt(2 * len * len) * 2);395 },396 ridgeHeight(angle) {397 return Math.round((Math.sin(angle * deg2Rad) * Math.sqrt(2 * len * len)) / 2);398 },399 sitTarpHt(angle) {400 return Math.round(Math.tan(angle * deg2Rad) * sitCover);401 },402 chairTarpHt(angle) {403 return Math.round(Math.tan(angle * deg2Rad) * chairCover);404 }405};406const hex_diamond = {407 configName: "Hex Diamond 45",408 type: "Diagonal",409 angles: [45, 60],410 tarpTypes: [square],411 // sleepClear: Math.sqrt(2 * len * len) - ht,412 sleepClear(angle) {413 return Math.round(Math.sqrt(2 * len * len) - height);414 },415 cover(angle) {416 return Math.round(((Math.cos(angle * deg2Rad) * len) / 2) * 2);417 },418 ridgeHeight(angle) {419 return Math.round(((Math.sin(angle * deg2Rad) * len) / 2) * 2);420 },421 sitTarpHt(angle) {422 return Math.round(Math.tan(angle * deg2Rad) * sitCover);423 },424 chairTarpHt(angle) {425 return Math.round(Math.tan(angle * deg2Rad) * chairCover);426 }427};428const half_cone = {429 configName: "Half Cone Fly 22.5",430 type: "Diagonal",431 angles: [22.5],432 tarpTypes: [square],433 // sleepClear: Math.sqrt(2 * len * len),434 sleepClear(angle) {435 return Math.round(Math.sqrt(2 * len * len) - height);436 },437 // my spreadsheet has sin instead of cos and 45 instead of 22.5?438 cover(angle) {439 return Math.round((Math.sin(angle * 2 * deg2Rad) * len) / 2);440 },441 ridgeHeight(angle) {442 return Math.round(Math.sin(angle * deg2Rad) * Math.sqrt(2 * len * len));443 },444 sitTarpHt(angle) {445 return Math.round(Math.tan(angle * deg2Rad) * sitCover);446 },447 chairTarpHt(angle) {448 return Math.round(Math.tan(angle * deg2Rad) * chairCover);449 }450};451const arrowhead = {452 configName: "Arrowhead Wedge 22.5",453 type: "Diagonal",454 angles: [22.5],455 tarpTypes: [square],456 // sleepClear: ridgeHeight? that makes no sense???457 // sleepClear: Math.sqrt(2 * len * len) - ridgeHeight - ht,458 sleepClear(angle) {459 return Math.round(Math.sqrt(2 * len * len) - ridgeHeight - height);460 },461 // my spreadsheet has sin instead of cos and 45 instead of 22.5?462 cover(angle) {463 return Math.round((Math.sin(angle * 2 * deg2Rad) * len) / 2);464 },465 // my spreadsheet has cos instead of sin and 45 instead of 22.5?466 ridgeHeight(angle) {467 return Math.round((Math.cos(angle * 2 * deg2Rad) * len) / 2);468 },469 sitTarpHt(angle) {470 return Math.round(Math.tan(angle * deg2Rad) * sitCover);471 },472 chairTarpHt(angle) {473 return Math.round(Math.tan(angle * deg2Rad) * chairCover);474 }475};476const lavvu = {477 configName: "Lavvu",478 type: "Tent",479 angles: [60],480 tarpTypes: [rectangle.rect1to2],481 sleepClear: wid / 3 - height,482 cover(angle) {483 return Math.round(Math.sin(angle * deg2Rad) * wid * 0.333);484 },485 ridgeHeight(angle) {486 return Math.round(Math.sin(angle * deg2Rad) * len);487 },488 sitTarpHt(angle) {489 return Math.round(Math.tan(angle * deg2Rad) * sitCover);490 },491 chairTarpHt(angle) {492 return Math.round(Math.tan(angle * deg2Rad) * chairCover);493 }494};495const miners = {496 configName: "Miners Tent",497 type: "Tent",498 angles: [67.5],499 tarpTypes: [rectangle],500 // Geek37 double-check my hard-coded #'s501 sleepClear: 0.75 * len - height,502 cover: 0.678 * len,503 ridgeHeight: 0.857 * len,504 sitTarpHt(angle) {505 return Math.round(Math.tan(angle * deg2Rad) * sitCover);506 },507 chairTarpHt(angle) {508 return Math.round(Math.tan(angle * deg2Rad) * chairCover);509 }510};511const bakers = {512 configName: "Bakers WS 27.5",513 type: "Lean-To",514 angles: [27.5],515 tarpTypes: [rectangle],516 sleepClear: wid / 2 - height,517 cover(angle) {518 return Math.round(Math.cos(angle * deg2Rad) * len);519 },520 ridgeHeight(angle) {521 return Math.round(Math.sin(angle * deg2Rad) * len);522 },523 sitTarpHt(angle) {524 return Math.round(Math.tan(angle * deg2Rad) * sitCover);525 },526 chairTarpHt(angle) {527 return Math.round(Math.tan(angle * deg2Rad) * chairCover);528 }529};530const side_wall12 = {531 configName: "Side-Wall LT 1:2",532 type: "Lean-To",533 angles: [60, 33.3],534 tarpTypes: [rectangle],535 sleepClear(angle) {536 return Math.round(wid - (0.375 * height) / (Math.tan(angle[0]) * 2) - height);537 },538 cover(angle) {539 return Math.round(Math.cos(angle[1] * deg2Rad) * len);540 },541 ridgeHeight(angle) {542 return Math.round(Math.sin(angle[1] * deg2Rad) * len);543 },544 sitTarpHt(angle) {545 return Math.round(Math.tan(angle * deg2Rad) * sitCover);546 },547 chairTarpHt(angle) {548 return Math.round(Math.tan(angle * deg2Rad) * chairCover);549 }550};551const side_wall35 = {552 configName: "Side-Wall LT 3:5",553 type: "Lean-To",554 angles: [55, 29],555 tarpTypes: [rectangle],556 sleepClear(angle) {557 return Math.round(wid - (0.375 * height) / (Math.tan(angle[0]) * 2) - height);558 },559 cover(angle) {560 return Math.round(Math.cos(angle[1] * deg2Rad) * len);561 },562 ridgeHeight(angle) {563 return Math.round(Math.sin(angle[1] * deg2Rad) * len);564 },565 sitTarpHt(angle) {566 return Math.round(Math.tan(angle * deg2Rad) * sitCover);567 },568 chairTarpHt(angle) {569 return Math.round(Math.tan(angle * deg2Rad) * chairCover);570 }571};572const side_wall23 = {573 configName: "Side-Wall LT 2:3",574 type: "Lean-To",575 angles: [58, 27],576 tarpTypes: [rectangle],577 sleepClear(angle) {578 return Math.round(wid - (0.375 * height) / (Math.tan(angle[0]) * 2) - height);579 },580 cover(angle) {581 return Math.round(Math.cos(angle[1] * deg2Rad) * len);582 },583 ridgeHeight(angle) {584 return Math.round(Math.sin(angle[1] * deg2Rad) * len);585 },586 sitTarpHt(angle) {587 return Math.round(Math.tan(angle * deg2Rad) * sitCover);588 },589 chairTarpHt(angle) {590 return Math.round(Math.tan(angle * deg2Rad) * chairCover);591 }592};593// Double check angle[0] - they should decrease594const holden45 = {595 configName: "Holden Tent 4:5",596 type: "Lean-To",597 angles: [58, 30],598 tarpTypes: [rectangle],599 sleepClear(angle) {600 return Math.round(wid - (0.375 * height) / (Math.tan(angle[0]) * 2) - height);601 },602 cover(angle) {603 return Math.round(Math.cos(angle[1] * deg2Rad) * len);604 },605 ridgeHeight(angle) {606 return Math.round(Math.sin(angle[1] * deg2Rad) * len);607 },608 sitTarpHt(angle) {609 return Math.round(Math.tan(angle * deg2Rad) * sitCover);610 },611 chairTarpHt(angle) {612 return Math.round(Math.tan(angle * deg2Rad) * chairCover);613 }614};615const holden34 = {616 configName: "Holden Tent 3:4",617 type: "Lean-To",618 angles: [55, 33],619 tarpTypes: [rectangle],620 sleepClear(angle) {621 return Math.round(wid - (0.375 * height) / (Math.tan(angle[0]) * 2) - height);622 },623 cover(angle) {624 return Math.round(Math.cos(angle[1] * deg2Rad) * len);625 },626 ridgeHeight(angle) {627 return Math.round(Math.sin(angle[1] * deg2Rad) * len);628 },629 sitTarpHt(angle) {630 return Math.round(Math.tan(angle * deg2Rad) * sitCover);631 },632 chairTarpHt(angle) {633 return Math.round(Math.tan(angle * deg2Rad) * chairCover);634 }635};636const holden23 = {637 configName: "Holden Tent 2:3",638 type: "Lean-To",639 angles: [56, 38],640 tarpTypes: [square, rectangle],641 sleepClear(angle) {642 return Math.round(wid - (0.375 * height) / (Math.tan(angle[0]) * 2) - height);643 },644 cover(angle) {645 return Math.round(Math.cos(angle[1] * deg2Rad) * len);646 },647 ridgeHeight(angle) {648 return Math.round(Math.sin(angle[1] * deg2Rad) * len);649 },650 sitTarpHt(angle) {651 return Math.round(Math.tan(angle * deg2Rad) * sitCover);652 },653 chairTarpHt(angle) {654 return Math.round(Math.tan(angle * deg2Rad) * chairCover);655 }656};657const holden35 = {658 configName: "Holden Tent 3:5",659 type: "Lean-To",660 angles: [45, 40],661 tarpTypes: [square, rectangle],662 sleepClear(angle) {663 return Math.round(wid - (0.375 * height) / (Math.tan(angle[0]) * 2) - height);664 },665 cover(angle) {666 return Math.round(Math.cos(angle[1] * deg2Rad) * len);667 },668 ridgeHeight(angle) {669 return Math.round(Math.sin(angle[1] * deg2Rad) * len);670 },671 sitTarpHt(angle) {672 return Math.round(Math.tan(angle * deg2Rad) * sitCover);673 },674 chairTarpHt(angle) {675 return Math.round(Math.tan(angle * deg2Rad) * chairCover);676 }677};678const holden12 = {679 configName: "Holden Tent 1:2",680 type: "Lean-To",681 angles: [50, 45],682 tarpTypes: [square, rectangle],683 sleepClear(angle) {684 return Math.round(wid - (0.375 * height) / (Math.tan(angle[0]) * 2) - height);685 },686 cover(angle) {687 return Math.round(Math.cos(angle[1] * deg2Rad) * len);688 },689 ridgeHeight(angle) {690 return Math.round(Math.sin(angle[1] * deg2Rad) * len);691 },692 sitTarpHt(angle) {693 return Math.round(Math.tan(angle * deg2Rad) * sitCover);694 },695 chairTarpHt(angle) {696 return Math.round(Math.tan(angle * deg2Rad) * chairCover);697 }698};699const allTarps = [700 {701 configName: "Half Pyramid",702 type: "A-Frame",703 angles: [45, 60],704 tarpTypes: [square, rectangle],705 // need 2nd angle for lean - is this a holden tent? What is X?706 sleepClear: len - "X" - height,707 //708 cover: Math.cos(angle) * wid,709 //710 ridgeHeight: Math.sin(angle) * (wid / 2)711 },712 {713 configName: "Tetra",714 type: "Tent",715 angles: [],716 tarpTypes: [rectangle.rect1to2],717 //718 sleepClear: null,719 //720 cover: null,721 //722 ridgeHeight: null723 },724 {725 configName: "Trapezoid",726 type: "Tent",727 angles: [],728 tarpTypes: [square],729 //730 sleepClear: null,731 //732 cover: null,733 //734 ridgeHeight: null735 }736];...
test.ts
Source:test.ts
...20// The function returns an array-like object containing numbers...21{22 const x = new Float64Array( 10 );23 const y = new Float64Array( 10 );24 deg2rad( x.length, 'float64', x, 1, 'float64', y, 1 ); // $ExpectType ArrayLike<number>25}26// The compiler throws an error if the function is provided a first argument which is not a number...27{28 const x = new Float64Array( 10 );29 const y = new Float64Array( 10 );30 deg2rad( '10', 'float64', x, 1, 'float64', y, 1 ); // $ExpectError31 deg2rad( true, 'float64', x, 1, 'float64', y, 1 ); // $ExpectError32 deg2rad( false, 'float64', x, 1, 'float64', y, 1 ); // $ExpectError33 deg2rad( null, 'float64', x, 1, 'float64', y, 1 ); // $ExpectError34 deg2rad( undefined, 'float64', x, 1, 'float64', y, 1 ); // $ExpectError35 deg2rad( [], 'float64', x, 1, 'float64', y, 1 ); // $ExpectError36 deg2rad( {}, 'float64', x, 1, 'float64', y, 1 ); // $ExpectError37 deg2rad( ( x: number ): number => x, 'float64', x, 1, 'float64', y, 1 ); // $ExpectError38}39// The compiler throws an error if the function is provided a third argument which is not an array-like object containing numbers...40{41 const x = new Float64Array( 10 );42 const y = new Float64Array( 10 );43 deg2rad( x.length, 'float64', 10, 1, 'float64', y, 1 ); // $ExpectError44 deg2rad( x.length, 'float64', '10', 1, 'float64', y, 1 ); // $ExpectError45 deg2rad( x.length, 'float64', true, 1, 'float64', y, 1 ); // $ExpectError46 deg2rad( x.length, 'float64', false, 1, 'float64', y, 1 ); // $ExpectError47 deg2rad( x.length, 'float64', null, 1, 'float64', y, 1 ); // $ExpectError48 deg2rad( x.length, 'float64', undefined, 1, 'float64', y, 1 ); // $ExpectError49 deg2rad( x.length, 'float64', [ '1' ], 1, 'float64', y, 1 ); // $ExpectError50 deg2rad( x.length, 'float64', {}, 1, 'float64', y, 1 ); // $ExpectError51 deg2rad( x.length, 'float64', ( x: number ): number => x, 1, 'float64', y, 1 ); // $ExpectError52}53// The compiler throws an error if the function is provided a fourth argument which is not a number...54{55 const x = new Float64Array( 10 );56 const y = new Float64Array( 10 );57 deg2rad( x.length, 'float64', x, '10', 'float64', y, 1 ); // $ExpectError58 deg2rad( x.length, 'float64', x, true, 'float64', y, 1 ); // $ExpectError59 deg2rad( x.length, 'float64', x, false, 'float64', y, 1 ); // $ExpectError60 deg2rad( x.length, 'float64', x, null, 'float64', y, 1 ); // $ExpectError61 deg2rad( x.length, 'float64', x, undefined, 'float64', y, 1 ); // $ExpectError62 deg2rad( x.length, 'float64', x, [], 'float64', y, 1 ); // $ExpectError63 deg2rad( x.length, 'float64', x, {}, 'float64', y, 1 ); // $ExpectError64 deg2rad( x.length, 'float64', x, ( x: number ): number => x, 'float64', y, 1 ); // $ExpectError65}66// The compiler throws an error if the function is provided a sixth argument which is not an array-like object containing numbers...67{68 const x = new Float64Array( 10 );69 deg2rad( x.length, 'float64', x, 1, 'float64', 10, 1 ); // $ExpectError70 deg2rad( x.length, 'float64', x, 1, 'float64', '10', 1 ); // $ExpectError71 deg2rad( x.length, 'float64', x, 1, 'float64', true, 1 ); // $ExpectError72 deg2rad( x.length, 'float64', x, 1, 'float64', false, 1 ); // $ExpectError73 deg2rad( x.length, 'float64', x, 1, 'float64', null, 1 ); // $ExpectError74 deg2rad( x.length, 'float64', x, 1, 'float64', undefined, 1 ); // $ExpectError75 deg2rad( x.length, 'float64', x, 1, 'float64', [ '1' ], 1 ); // $ExpectError76 deg2rad( x.length, 'float64', x, 1, 'float64', {}, 1 ); // $ExpectError77 deg2rad( x.length, 'float64', x, 1, 'float64', ( x: number ): number => x, 1 ); // $ExpectError78}79// The compiler throws an error if the function is provided a seventh argument which is not a number...80{81 const x = new Float64Array( 10 );82 const y = new Float64Array( 10 );83 deg2rad( x.length, 'float64', x, 1, 'float64', y, '10' ); // $ExpectError84 deg2rad( x.length, 'float64', x, 1, 'float64', y, true ); // $ExpectError85 deg2rad( x.length, 'float64', x, 1, 'float64', y, false ); // $ExpectError86 deg2rad( x.length, 'float64', x, 1, 'float64', y, null ); // $ExpectError87 deg2rad( x.length, 'float64', x, 1, 'float64', y, undefined ); // $ExpectError88 deg2rad( x.length, 'float64', x, 1, 'float64', y, [] ); // $ExpectError89 deg2rad( x.length, 'float64', x, 1, 'float64', y, {} ); // $ExpectError90 deg2rad( x.length, 'float64', x, 1, 'float64', y, ( x: number ): number => x ); // $ExpectError91}92// The compiler throws an error if the function is provided an unsupported number of arguments...93{94 const x = new Float64Array( 10 );95 const y = new Float64Array( 10 );96 deg2rad(); // $ExpectError97 deg2rad( x.length ); // $ExpectError98 deg2rad( x.length, 'float64' ); // $ExpectError99 deg2rad( x.length, 'float64', x ); // $ExpectError100 deg2rad( x.length, 'float64', x, 1 ); // $ExpectError101 deg2rad( x.length, 'float64', x, 1, 'float64' ); // $ExpectError102 deg2rad( x.length, 'float64', x, 1, 'float64', y ); // $ExpectError103 deg2rad( x.length, 'float64', x, 1, 'float64', y, 1, 10 ); // $ExpectError104}105// Attached to main export is an `ndarray` method which returns an array-like object containing numbers...106{107 const x = new Float64Array( 10 );108 const y = new Float64Array( 10 );109 deg2rad.ndarray( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0 ); // $ExpectType ArrayLike<number>110}111// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...112{113 const x = new Float64Array( 10 );114 const y = new Float64Array( 10 );115 deg2rad.ndarray( '10', 'float64', x, 1, 0, 'float64', y, 1, 0 ); // $ExpectError116 deg2rad.ndarray( true, 'float64', x, 1, 0, 'float64', y, 1, 0 ); // $ExpectError117 deg2rad.ndarray( false, 'float64', x, 1, 0, 'float64', y, 1, 0 ); // $ExpectError...
Using AI Code Generation
1var wpt = require('wpt');2var lat1 = 51.508515;3var lon1 = -0.1254872;4var lat2 = 51.508515;5var lon2 = -0.1254872;6var distance = wpt.getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2);7console.log(distance);
Using AI Code Generation
1var wpt = require("wpt");2var lat1 = 51.508530;3var lon1 = -0.076132;4var lat2 = 48.856614;5var lon2 = 2.352222;6var d = wpt.getDistance(lat1, lon1, lat2, lon2);7console.log("Distance: " + d);
Using AI Code Generation
1var wptools = require('wikipedia-tools');2var lat1 = 28.6139;3var lon1 = 77.2090;4var lat2 = 28.7041;5var lon2 = 77.1025;6var distance = wptools.deg2rad(lat1,lon1,lat2,lon2);7### deg2rad(lat1, lon1, lat2, lon2)8MIT © [Anshul Verma](
Using AI Code Generation
1var wpt = require('./wpt.js');2var lat1 = 41.9027835;3var lon1 = 12.4963655;4var lat2 = 41.9027835;5var lon2 = 12.4963655;6var distance = wpt.getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2);7console.log(distance);8var wpt = require('./wpt.js');9var lat1 = 41.9027835;10var lon1 = 12.4963655;11var lat2 = 41.9027835;12var lon2 = 12.4963655;13var distance = wpt.getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2);14console.log(distance);15var wpt = require('./wpt.js');16var lat1 = 41.9027835;17var lon1 = 12.4963655;18var lat2 = 41.9027835;19var lon2 = 12.4963655;20var distance = wpt.getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2);21console.log(distance);22var wpt = require('./wpt.js');23var lat1 = 41.9027835;24var lon1 = 12.4963655;25var lat2 = 41.9027835;26var lon2 = 12.4963655;27var distance = wpt.getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2);28console.log(distance);29var wpt = require('./wpt.js');30var lat1 = 41.9027835;31var lon1 = 12.4963655;32var lat2 = 41.9027835;33var lon2 = 12.4963655;34var distance = wpt.getDistanceFromLatLonInKm(lat1
Using AI Code Generation
1const wptools = require('wptools')2- [deg2rad](#deg2rad)3 - [Parameters](#parameters)4- [rad2deg](#rad2deg)5 - [Parameters](#parameters-1)6MIT © [Sam Reed](
Using AI Code Generation
1var wptools = require('wptools');2var lat = 40.7128;3var lon = -74.0059;4var distance = 0.5;5var radius = wptools.deg2rad(distance);6var bbox = wptools.bbox(lat, lon, radius);7console.log(bbox);8var wptools = require('wptools');9var lat = 40.7128;10var lon = -74.0059;11var distance = 0.5;12var radius = wptools.deg2rad(distance);13var bbox = wptools.bbox(lat, lon, radius);14console.log(bbox);15var wptools = require('wptools');16var lat = 40.7128;17var lon = -74.0059;18var distance = 0.5;19var radius = wptools.deg2rad(distance);20var bbox = wptools.bbox(lat, lon, radius);21console.log(bbox);22var wptools = require('wptools');23var lat = 40.7128;24var lon = -74.0059;25var distance = 0.5;26var radius = wptools.deg2rad(distance);27var bbox = wptools.bbox(lat, lon, radius);28console.log(bbox);
Using AI Code Generation
1var wptools = require('wptools');2var lat = 52.516;3var lon = 13.377;4var latlon = wptools.deg2rad(lat, lon);5console.log(latlon);6var wptools = require('wptools');7var lat = 52.516;8var lon = 13.377;9var latlon = wptools.deg2rad(lat, lon);10console.log(latlon);11var wptools = require('wptools');12var lat = 52.516;13var lon = 13.377;14var latlon = wptools.deg2rad(lat, lon);15console.log(latlon);16var wptools = require('wptools');17var lat = 52.516;18var lon = 13.377;19var latlon = wptools.deg2rad(lat, lon);20console.log(latlon);21var wptools = require('wptools');22var lat = 52.516;23var lon = 13.377;24var latlon = wptools.deg2rad(lat, lon);25console.log(latlon);26var wptools = require('wptools');27var lat = 52.516;28var lon = 13.377;29var latlon = wptools.deg2rad(lat, lon);30console.log(latlon);31var wptools = require('wptools');32var lat = 52.516;33var lon = 13.377;34var latlon = wptools.deg2rad(lat, lon);35console.log(latlon);36var wptools = require('wptools');37var lat = 52.516;38var lon = 13.377;
Using AI Code Generation
1var wptools = require('wptools');2var lat = 40.7127837;3var lon = -74.0059413;4var radius = 1;5var limit = 10;6var format = 'json';7var results = wptools.nearby(lat, lon, radius, limit, format);8console.log(results);9module.exports = {10 nearby: function(lat, lon, radius, limit, format) {11 var results = [];12 var deg2rad = this.deg2rad;13 return results;14 },15 deg2rad: function(deg) {16 return deg * (Math.PI/180);17 }18}19I am new to node.js and I am trying to make a simple node.js app using express.js. I am trying to use the express.js router to separate my routes. I have a file called index.js which I am using to start my app. This is where I am requiring the express module and creating my express app. I am also requiring my routes file (routes.js) and using the express router to handle the routes. I am also requiring my api routes file (api-routes.js) and using the express router to handle the api routes. I am using the express router to handle the routes because I want to separate my routes from my app. I am using the express router to handle the api routes because I want to separate my api routes from my app. I am using the express router to handle the routes because I want to separate my routes from my app. I am using the express router to handle the api routes because I want to separate my api routes from my app. I am using the express router to handle the routes because I want to separate my routes from my app. I am using the express router to handle the api routes because I want to separate my api routes from my app. I am using the express router to handle the routes because I want to separate my routes from my app. I am using the express router to handle the api routes because I want to separate my api routes from my app. I am using the express router to handle the routes because I want to separate my routes from my app. I am using the express router to handle the api routes because I want to separate my api routes from my app. I am using the express router to handle the routes because I want to separate my routes from my app. I
Using AI Code Generation
1var wptools = require('wptools');2var lat = 34.055737;3var lng = -118.242727;4var rad = 10;5var lat1 = wptools.deg2rad(lat);6var lng1 = wptools.deg2rad(lng);7var rad1 = wptools.deg2rad(rad);8var wptools = {9 deg2rad: function(deg) {10 return deg * (Math.PI/180);11 }12};13module.exports = wptools;14 at Object.<anonymous> (/Users/.../test.js:5:24)15 at Module._compile (module.js:456:26)16 at Object.Module._extensions..js (module.js:474:10)17 at Module.load (module.js:356:32)18 at Function.Module._load (module.js:312:12)19 at Function.Module.runMain (module.js:497:10)20 at startup (node.js:119:16)21@Gordon, I figured out the problem. I was exporting the wrong variable. I was exporting wptools instead of the deg2rad method. This is the correct code: var wptools = { deg2rad: function(deg) { return deg * (Math.PI/180); } }; module.exports = wptools.deg2rad; Thanks for all your help!
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!