30.12.2014, 17:14
the result will not be the same to add those floats, you're summing the x, y and z velocity and the result will not be the real velocity. To get the real velocity you need to use the pitagora's or whatever formula.
example:
Let's use a real life example. Supose you're seeing the ground from the top and imagine X and Y coordinates there, the car is moving on a straight line diagonally (not 45є but not 90є o 0є from the X line) for 100 KM and the speedo counts constantly 100 KM/H. In total he had taken 1 Hour. So in X let's suppose he went 70KMs, so in Y he went : 100*100 = 70*70 + y*y <=> y = sqrt(5100) <=> y ~=71 KMs.
Therefor he went at a speed of 70Km/h in the X and 71 Km/h in the y. 70+71 = 141. 141 is not 100. There you get it. So now you can do the other way around to get the first value: speed = sqrt(70*70+71*71) ~= 99 Km/h (I just used int and not float to show you, with floats it will give a more exact value).
Hope you understood. If you didn't, pm me, and I'll explain it to you in portuguese.
example:
Let's use a real life example. Supose you're seeing the ground from the top and imagine X and Y coordinates there, the car is moving on a straight line diagonally (not 45є but not 90є o 0є from the X line) for 100 KM and the speedo counts constantly 100 KM/H. In total he had taken 1 Hour. So in X let's suppose he went 70KMs, so in Y he went : 100*100 = 70*70 + y*y <=> y = sqrt(5100) <=> y ~=71 KMs.
Therefor he went at a speed of 70Km/h in the X and 71 Km/h in the y. 70+71 = 141. 141 is not 100. There you get it. So now you can do the other way around to get the first value: speed = sqrt(70*70+71*71) ~= 99 Km/h (I just used int and not float to show you, with floats it will give a more exact value).
Hope you understood. If you didn't, pm me, and I'll explain it to you in portuguese.