Speed formules
#1

Hi. I want to talk about speed formules. I have some:

Код:
1.floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 180.3;
Код:
2.floatsqroot(floatpower(ST[0], 2) + floatpower(ST[1], 2) + floatpower(ST[2], 2)) * 200;
Which is better for use? Maybe you have someone new please post here.
Reply
#2

floatabs is not needed, as squared numbers will always be positive. Also I do not recommend to use the floatpower function for this, as it is way slower than just doing: ST[0] * ST[0]
So my choice would be simply
floatsqroot(ST[0] * ST[0] + ST[1] * ST[1] + ST[2] * ST[2]) * FACTOR

Where FACTOR is 200 or 180 or whatever, im not sure what factor is correct for getting kmh/mph
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)