This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
BigSHinyToys's profile picture

[ICBM] missile parth prediction Math probblem ?

Started by BigSHinyToys, 06 November 2012 - 11:30 PM
BigSHinyToys #1
Posted 07 November 2012 - 12:30 AM
http://pastebin.com/YigPX1A3

So something is wrong with gravity the X Y is fine but Z is a pain.

usage place a radar on top of a computer ant run this program. If you have problems with power low error then run the radar from batteries not directly from generators.

any help would be useful.

Thanks in advance
Orwell #2
Posted 07 November 2012 - 01:36 AM
You have very few comments in your code, so it takes me a while to figure out what you're doing. :P/>/> If you're thinking about actually predicting the trajectory.. I decompiled ICBM last week to look into that. The code was mostly in Japanese >.< but I came to the conclusion that the 'parabola' isn't physically correct. I also read a post from the author once, kinda saying the same thing. Also, wouldn't you need velocity and starting angle to calculate the trajectory as well?
Kolpa #3
Posted 07 November 2012 - 04:48 AM
You have very few comments in your code, so it takes me a while to figure out what you're doing. :P/>/> If you're thinking about actually predicting the trajectory.. I decompiled ICBM last week to look into that. The code was mostly in Japanese >.< but I came to the conclusion that the 'parabola' isn't physically correct. I also read a post from the author once, kinda saying the same thing. Also, wouldn't you need velocity and starting angle to calculate the trajectory as well?

how is java Japanese o.O
Sammich Lord #4
Posted 07 November 2012 - 07:21 AM
You have very few comments in your code, so it takes me a while to figure out what you're doing. :P/>/> If you're thinking about actually predicting the trajectory.. I decompiled ICBM last week to look into that. The code was mostly in Japanese >.< but I came to the conclusion that the 'parabola' isn't physically correct. I also read a post from the author once, kinda saying the same thing. Also, wouldn't you need velocity and starting angle to calculate the trajectory as well?

how is java Japanese o.O
Not sure if he means the comment or if there is a Japanese version of Java, or maybe the code is impossible to read so he uses that as a metaphor.
Mads #5
Posted 07 November 2012 - 07:38 AM
Just use a constant X and Y velocity, and for Z, you will do something like this:

g is in this case 9.8
velZ = velZ + g * 0.16 -- 0.16 is equal to about 60 FPS 

Then, to find the rotation of the object, you would do this:

local _x = lastX - x
local _y = lastY - y
local len = math.sqrt(_x ^ 2 + _y ^ 2)
rotation = math.acos(_x / len)

if y < lastY then
	rotation = 2 * math.pi - rotation
end

radians = 2 * pi - rotation
rotation = math.deg(radians) -- get rotation in degrees

lastX, lastY = x, y
You would apply this to x/z as well, and so on…

To apply all of this to the current game state, do this:

x = x + velX
y = y + velY
z = z + velZ
Cloudy #6
Posted 07 November 2012 - 08:31 AM
The author of ICBM deliberately uses words in a language other than English in order to confuse people decompiling it - as he had been bitten by people stealing code before.
BigSHinyToys #7
Posted 07 November 2012 - 11:05 AM
I did some testing on the flight path the rate of change over time on the X and Y is a constant so i gain that by averaging the difference between data points in the set. my problem is following the curve current accuracy is about 400 meters.data recorded from a real ICBM launch using Computer craft.

data set
Spoiler

1.5 4.06 1.5
1.5 4.492 1.5
1.5 5.128 1.5
1.5 6.16 1.5
1.5 7.684 1.5
1.5 9.796 1.5
1.5 12.592 1.5
1.5 16.168 1.5
1.5 18.22 1.5
2.4999955 21.529955 1.496991
3.499991 24.82659 1.493982
4.499986 28.109907 1.490973
5.499982 31.379902 1.4879639
6.499977 34.636578 1.484955
7.499973 37.879936 1.4819459
8.499969 41.109974 1.4789369
9.499964 44.32669 1.475928
10.499959 47.530087 1.4729189
11.499954 50.720165 1.4699099
12.49995 53.896923 1.4669008
13.499946 57.060364 1.4638919
14.499941 60.21048 1.4608828
15.499936 63.347282 1.4578738
16.499931 66.47076 1.4548647
17.499928 69.58092 1.4518558
18.499924 72.67776 1.4488468
19.499918 75.761284 1.4458377
20.499914 78.83148 1.4428288
21.499908 81.88837 1.4398197
22.499905 84.93192 1.4368107
23.999899 89.47229 1.4322972
24.999893 92.48255 1.4292881
25.99989 95.4795 1.4262792
26.999884 98.46312 1.4232701
27.99988 101.433426 1.4202611
28.999876 104.3904 1.4172522
29.99987 107.33407 1.4142431
30.999866 110.26441 1.4112341
31.999863 113.18144 1.408225
32.99986 116.085144 1.4052161
33.99985 118.97553 1.402207
34.999847 121.85259 1.399198
35.999844 124.71634 1.3961891
36.99984 127.566765 1.39318
37.999836 130.40387 1.390171
38.99983 133.22766 1.387162
39.999825 136.03813 1.384153
40.99982 138.83528 1.3811439
41.999817 141.61911 1.378135
43.49981 145.76987 1.3736215
44.499805 148.5204 1.3706124
45.4998 151.25761 1.3676034
46.499798 153.98149 1.3645943
47.49979 156.69206 1.3615854
48.499786 159.38931 1.3585764
49.499783 162.07324 1.3555673
50.49978 164.74385 1.3525584
51.499775 167.40115 1.3495493
52.499767 170.04512 1.3465403
53.499763 172.67577 1.3435313
54.49976 175.2931 1.3405223
55.499756 177.89711 1.3375133
56.499752 180.48781 1.3345042
57.499744 183.06519 1.3314953
58.99974 186.90627 1.3269818
59.999737 189.45033 1.3239727
60.99973 191.9811 1.3209637
61.999725 194.49852 1.3179547
62.99972 197.00264 1.3149457
63.999718 199.49344 1.3119366
64.99971 201.97092 1.3089277
65.99971 204.43507 1.3059186
66.9997 206.88591 1.3029096
67.9997 209.32343 1.2999007
68.999695 211.74762 1.2968916
69.99969 214.1585 1.2938826
70.99969 216.55605 1.2908735
71.99968 218.94029 1.2878646
72.99968 221.3112 1.2848555
73.99967 223.66881 1.2818465
74.999664 226.01308 1.2788376
75.999664 228.34404 1.2758285
76.99966 230.66168 1.2728195
77.99966 232.966 1.2698104
78.99965 235.257 1.2668015
79.99964 237.53468 1.2637924
80.99964 239.79904 1.2607834
81.99963 242.05008 1.2577745
82.99963 244.2878 1.2547654
83.999626 246.5122 1.2517564
84.99962 248.72328 1.2487473
85.99962 250.92105 1.2457384
86.99961 253.10548 1.2427293
87.99961 255.27661 1.2397203
88.9996 257.43442 1.2367113
90.499596 260.64615 1.2321978
91.99959 263.8279 1.2276843
92.99959 265.93243 1.2246753
93.99958 268.02362 1.2216662
94.99957 270.1015 1.2186573
95.99957 272.16608 1.2156482
96.999565 274.21732 1.2126392
97.999565 276.25525 1.2096303
98.99956 278.27985 1.2066212
99.99956 280.29114 1.2036122
100.99955 282.28912 1.2006031
101.99954 284.27377 1.1975942
102.99954 286.2451 1.1945851
103.999535 288.2031 1.1915761
104.999535 290.1478 1.1885672
105.99953 292.07916 1.1855581
106.99952 293.9972 1.1825491
107.99952 295.90192 1.17954
108.99951 297.79333 1.1765311
109.99951 299.67142 1.173522
110.999504 301.5362 1.170513
111.9995 303.38763 1.1675041
112.9995 305.22577 1.164495
113.99949 307.0506 1.161486
114.99949 308.8621 1.158477
115.99948 310.66025 1.155468
116.99947 312.4451 1.1524589
117.99947 314.21664 1.14945
118.999466 315.97485 1.1464409
119.999466 317.71973 1.1434319
120.99946 319.45132 1.1404229
121.99945 321.16956 1.1374139
122.99945 322.8745 1.1344049
123.99944 324.56613 1.1313958
124.99944 326.24442 1.1283869
125.999435 327.9094 1.1253778
126.99943 329.56104 1.1223688
127.99943 331.19937 1.1193599
128.99942 332.8244 1.1163508
129.99942 334.4361 1.1133418
130.99942 336.03445 1.1103327
131.9994 337.6195 1.1073238
132.9994 339.19125 1.1043147
133.9994 340.74966 1.1013057
134.99939 342.29477 1.0982968
135.99939 343.82654 1.0952877
136.99939 345.345 1.0922787
137.99937 346.85016 1.0892696
138.99937 348.34198 1.0862607
139.99937 349.82047 1.0832516
140.99937 351.28564 1.0802426
141.99936 352.73752 1.0772336
142.99936 354.17606 1.0742246
143.99936 355.60126 1.0712156
144.99934 357.01315 1.0682065
145.99934 358.41174 1.0651976
146.99934 359.797 1.0621885
147.99934 361.16895 1.0591795
148.99933 362.5276 1.0561705
149.99933 363.87286 1.0531615
150.99933 365.20486 1.0501525
151.99931 366.52353 1.0471435
152.99931 367.82886 1.0441345
153.99931 369.12088 1.0411254
154.9993 370.3996 1.0381165
155.9993 371.66498 1.0351074
156.9993 372.91705 1.0320984
157.9993 374.1558 1.0290895
158.99928 375.38123 1.0260804
159.99928 376.59332 1.0230714
160.99928 377.7921 1.0200623
161.99927 378.97757 1.0170534
162.99927 380.14972 1.0140443
163.99927 381.30853 1.0110353
164.99925 382.45404 1.0080262
165.99925 383.58624 1.0050173
166.99925 384.7051 1.0020083
167.99925 385.81067 0.99899924
168.99924 386.9029 0.9959903
170.49924 388.51627 0.9914767
171.49924 389.5752 0.9884677
172.49922 390.6208 0.9854587
173.49922 391.65308 0.9824497
174.49922 392.67206 0.9794407
175.4992 393.6777 0.97643167
176.4992 394.67004 0.97342265
177.4992 395.64905 0.9704136
178.49919 396.61475 0.9674046
179.49919 397.5671 0.9643956
180.49919 398.50616 0.9613866
181.49919 399.4319 0.9583776
182.49918 400.3443 0.9553686
183.49918 401.2434 0.95235956
184.49918 402.12918 0.94935054
185.49916 403.00162 0.9463415
186.49916 403.86078 0.9433325
187.49916 404.70657 0.9403235
188.49915 405.53906 0.9373145
189.49915 406.35825 0.9343055
190.49915 407.1641 0.93129647
191.49915 407.95663 0.92828745
192.49913 408.73587 0.9252784
193.49913 409.50174 0.9222694
194.49913 410.25433 0.9192604
195.49911 410.9936 0.91625136
196.49911 411.7195 0.9132424
197.49911 412.43213 0.9102334
198.49911 413.13144 0.90722436
199.4991 413.8174 0.90421534
200.4991 414.49008 0.9012063
201.4991 415.1494 0.8981973
202.49908 415.79544 0.8951883
203.49908 416.42813 0.8921793
204.49908 417.04752 0.8891703
205.49907 417.65356 0.88616127
206.49907 418.2463 0.88315225
207.49907 418.82574 0.8801432
208.49907 419.39185 0.8771342
209.49905 419.9446 0.8741252
210.49905 420.48407 0.87111616
211.49905 421.01022 0.8681072
212.49904 421.52304 0.8650982
213.49904 422.02255 0.86208916
214.49904 422.50873 0.85908014
215.49902 422.9816 0.8560711
216.49902 423.44113 0.8530621
217.49902 423.88736 0.8500531
218.49902 424.32028 0.8470441
219.49901 424.73987 0.8440351
220.49901 425.14612 0.84102607
221.49901 425.53906 0.83801705
222.499 425.9187 0.835008
223.499 426.285 0.831999
224.499 426.63797 0.82899
225.49898 426.97766 0.82598096
226.49898 427.304 0.822972
227.49898 427.61703 0.819963
228.49898 427.91672 0.81695396
229.49896 428.20312 0.81394494
230.49896 428.4762 0.8109359
231.49896 428.73593 0.8079269
232.49895 428.98236 0.8049179
233.49895 429.21548 0.80190885
234.49895 429.43527 0.7988999
235.49895 429.64172 0.79589087
236.49893 429.8349 0.79288185
237.49893 430.0147 0.7898728
238.49893 430.1812 0.7868638
239.49892 430.3344 0.7838548
240.49892 430.4743 0.78084576
241.49892 430.60083 0.7778368
242.4989 430.71408 0.7748278
243.4989 430.814 0.77181876
244.4989 430.90057 0.76880974
245.4989 430.97385 0.7658007
246.49889 431.0338 0.7627917
247.49889 431.08044 0.7597827
248.49889 431.11374 0.75677365
249.49887 431.13376 0.7537647
250.49887 431.1404 0.75075567
251.49887 431.1338 0.74774665
252.49886 431.1138 0.7447376
253.49886 431.08054 0.7417286
254.49886 431.03394 0.7387196
255.49886 430.974 0.73571056
256.49884 430.90076 0.7327016
257.49884 430.8142 0.7296926
258.49884 430.71432 0.72668356
259.49884 430.6011 0.72367454
260.49884 430.47458 0.7206655
261.4988 430.33475 0.7176565
262.4988 430.18158 0.7146475
263.4988 430.0151 0.71163845
264.4988 429.8353 0.7086295
265.4988 429.64218 0.70562047
266.4988 429.43573 0.70261145
267.4988 429.21597 0.6996024
268.49878 428.9829 0.6965934
269.49878 428.7365 0.6935844
270.49878 428.47678 0.69057536
271.49878 428.20374 0.68756634
272.49878 427.9174 0.6845574
273.49878 427.6177 0.68154836
274.49875 427.30472 0.67853934
275.49875 426.9784 0.6755303
276.49875 426.63876 0.6725213
277.49875 426.2858 0.6695123
278.49875 425.91953 0.66650325
279.49875 425.53995 0.6634943
280.49875 425.147 0.66048527
281.49872 424.74078 0.65747625
282.49872 424.32123 0.6544672
283.49872 423.88837 0.6514582
284.49872 423.44217 0.6484492
285.49872 422.98264 0.64544016
286.49872 422.5098 0.64243114
287.49872 422.02365 0.6394222
288.4987 421.52417 0.63641316
289.4987 421.01138 0.63340414
290.4987 420.4853 0.6303951
291.4987 419.94586 0.6273861
292.4987 419.3931 0.6243771
293.4987 418.82703 0.62136805
294.4987 418.24762 0.6183591
295.49866 417.6549 0.61535007
296.49866 417.0489 0.61234105
297.49866 416.42953 0.609332
298.49866 415.79688 0.606323
299.49866 415.15088 0.603314
300.49866 414.49158 0.60030496
301.49863 413.81894 0.59729594
302.49863 413.133 0.594287
303.49863 412.43372 0.59127796
304.49863 411.72113 0.58826894
305.49863 410.99524 0.5852599
306.49863 410.256 0.5822509
307.49863 409.50345 0.5792419
308.4986 408.73758 0.57623285
309.4986 407.9584 0.5732238
310.4986 407.1659 0.57021487
311.4986 406.36008 0.56720585
312.4986 405.54092 0.5641968
313.4986 404.70847 0.5611878
314.4986 403.86267 0.5581788
315.49857 403.00357 0.55516976
316.49857 402.13116 0.55216074
317.49857 401.24542 0.5491518
318.49857 400.34634 0.54614276
319.49857 399.43396 0.54313374
320.49857 398.50827 0.5401247
321.49854 397.56924 0.5371157
322.49854 396.61688 0.5341067
323.49854 395.65125 0.53109765
324.49854 394.67224 0.5280886
325.49854 393.67996 0.52507967
326.49854 392.67432 0.52207065
327.49854 391.6554 0.5190616
328.4985 390.62314 0.5160526
329.4985 389.57755 0.5130436
330.4985 388.51865 0.51003456
331.4985 387.44644 0.50702554
332.4985 386.3609 0.5040165
333.4985 385.26202 0.50100756
334.4985 384.14984 0.49799854
335.49847 383.02435 0.4949895
336.49847 381.88553 0.4919805
337.49847 380.7334 0.48897147
338.49847 379.56793 0.48596248
339.49847 378.38916 0.48295346
340.49847 377.19708 0.47994444
341.49847 375.99167 0.47693542
342.49844 374.77292 0.47392642
343.49844 373.54086 0.4709174
344.49844 372.2955 0.46790838
345.49844 371.0368 0.46489936
346.49844 369.76477 0.46189037
347.49844 368.47946 0.45888135
348.4984 367.1808 0.45587233
349.4984 365.8688 0.4528633
350.4984 364.54352 0.4498543
351.4984 363.20493 0.4468453
352.4984 361.853 0.44383627
353.4984 360.48773 0.44082728
354.4984 359.10916 0.43781826
355.49838 357.71725 0.43480924
356.49838 356.31204 0.43180022
357.49838 354.89352 0.42879122
358.49838 353.46167 0.4257822
359.49838 352.0165 0.42277318
360.49838 350.558 0.41976416
361.49838 349.0862 0.41675517
362.49835 347.60107 0.41374615
363.49835 346.10263 0.41073713
364.49835 344.59085 0.4077281
365.49835 343.06577 0.4047191
366.49835 341.52737 0.4017101
367.49835 339.97565 0.39870107
368.49835 338.41058 0.39569205
369.49832 336.8322 0.39268306
370.49832 335.24054 0.38967404
371.49832 333.63553 0.38666502
372.49832 332.0172 0.38365602
373.49832 330.38556 0.380647
374.49832 328.7406 0.37763798
375.4983 327.0823 0.37462896
376.4983 325.4107 0.37161997
377.4983 323.72577 0.36861095
378.4983 322.02753 0.36560193
379.4983 320.31598 0.3625929
380.4983 318.5911 0.3595839
381.4983 316.85287 0.3565749
382.49826 315.10135 0.35356587
383.49826 313.33652 0.35055685
384.49826 311.55835 0.34754786
385.49826 309.76688 0.34453884
386.49826 307.96207 0.34152982
387.49826 306.14395 0.3385208
388.49826 304.3125 0.3355118
389.49823 302.46774 0.33250278
390.49823 300.60968 0.32949376
391.49823 298.73828 0.32648474
392.49823 296.85355 0.32347575
393.49823 294.9555 0.32046673
394.49823 293.04416 0.3174577
395.49823 291.11948 0.3144487
396.4982 289.1815 0.3114397
397.4982 287.23016 0.30843067
398.4982 285.2655 0.30542165
399.4982 283.28757 0.30241266
400.4982 281.2963 0.29940364
401.4982 279.2917 0.29639462
402.49817 277.27377 0.2933856
403.49817 275.24252 0.2903766
404.49817 273.19797 0.28736758
406.49817 269.0689 0.28134954
407.49817 266.9844 0.27834055
408.49817 264.88657 0.27533153
409.49814 262.7754 0.2723225
410.49814 260.65094 0.26931348
411.49814 258.51315 0.2663045
412.49814 256.36203 0.26329547
413.49814 254.19759 0.26028645
414.49814 252.01984 0.25727746
415.49814 249.82877 0.25426844
416.4981 247.62437 0.25125942
417.4981 245.40666 0.24825041
418.4981 243.17563 0.24524139
419.4981 240.93129 0.24223238
420.4981 238.67361 0.23922336
421.4981 236.40262 0.23621435
422.4981 234.11832 0.23320533
423.49808 231.82068 0.23019633
424.49808 229.50974 0.2271873
425.49808 227.18547 0.2241783
426.49808 224.84787 0.22116928
427.49808 222.49696 0.21816027
428.49808 220.13274 0.21515125
429.49805 217.75519 0.21214224
430.49805 215.36432 0.20913322
431.49805 212.96014 0.20612422
432.49805 210.54263 0.20311521
433.49805 208.1118 0.20010619
434.49805 205.66766 0.19709718
435.49805 203.21019 0.19408816
436.49802 200.73941 0.19107915
437.49802 198.2553 0.18807013
438.49802 195.75787 0.18506113
439.49802 193.24713 0.1820521
440.49802 190.72307 0.1790431
441.49802 188.18568 0.17603408
442.49802 185.63498 0.17302507
443.498 183.07095 0.17001605
444.498 180.49362 0.16700704
445.498 177.90295 0.16399802
446.498 175.29897 0.16098902
447.498 172.68167 0.15798
448.498 170.05104 0.15497099
449.49796 167.4071 0.15196197
450.49796 164.74985 0.14895296
451.49796 162.07927 0.14594395
452.49796 159.39537 0.14293493
453.49796 156.69815 0.13992593
454.49796 153.98761 0.1369169
455.49796 151.26375 0.1339079
456.49792 148.52657 0.13089888
457.49792 145.77606 0.12788987
458.49792 143.01225 0.12488085
459.49792 140.2351 0.12187184
460.49792 137.44466 0.11886283
461.49792 134.64087 0.115853816
462.49792 131.82378 0.1128448
463.4979 128.99336 0.10983579
464.4979 126.14963 0.106826775
465.4979 123.29257 0.10381776
466.4979 120.422195 0.10080875
467.4979 117.5385 0.09779973
468.4979 114.64148 0.09479072
469.4979 111.73115 0.091781706
470.49786 108.807495 0.08877269
471.49786 105.87052 0.08576368
472.49786 102.92023 0.082754664
473.49786 99.95661 0.07974565
474.49786 96.979675 0.07673664
475.49786 93.989426 0.07372762
476.49783 90.985855 0.07071861
477.49783 87.96896 0.067709595
478.49783 84.93875 0.06470058
479.49783 81.89522 0.06169157
480.49783 78.83836 0.058682557
481.49783 75.768196 0.055673543
482.49783 72.68471 0.05266453
483.4978 69.5879 0.049655516
484.4978 66.47777 0.046646502
485.4978 63.354317 0.04363749
486.4978 60.217545 0.040628478
487.4978 57.067455 0.037619464
488.4978 53.90405 0.03461045
489.4978 50.727318 0.031601436
490.49777 47.53727 0.028592423
491.49777 44.333904 0.025583409
492.49777 41.117218 0.022574397
493.49777 37.88721 0.019565383
494.49777 34.643883 0.01655637
495.49777 31.387236 0.013547356
496.49777 28.11727 0.010538342
497.49774 24.833984 0.007529329
498.49774 21.537378 0.004520315
499.49774 18.227453 0.001511302
500.49774 14.904208 -0.001497712
as for code commenting sorry I'm used to working on my own and have a near photographic memory here is commented ver.
http://pastebin.com/Wkc9mcJR