speed?

Blitz3D Forums/Blitz3D Beginners Area/speed?

mindstorms(Posted 2006) [#1]
I am doing an interpolation along a curve using the parabolic function(s):

y = ax^4+bx^3+cx^2+dx+e

I have figured out how to do it up to the ax^5..., but was wondering how far I would need to go to get a good balance between accuracy and speed...I do this about 21 times a loop and the data is accurately to the pixel represented at the ax^5.....


b32(Posted 2006) [#2]
I don't understand maths this good, but if the formula is within a certain range, you could precalculate it maybe into an array. And as I understood, using ax*ax*ax*ax is faster that ax^4.


H&K(Posted 2006) [#3]
A(X*X*X*X) would have the benifit of giving the right answer tho


mindstorms(Posted 2006) [#4]
Precalculating into an array is difficult, seeing as though the curve changes throughout the program....

Thanks for the input, I think I will go with A(X*X*X*X)....


puki(Posted 2006) [#5]
I don't understand any of this - I'd like to see a working example - from all parties.

Tomorrow is fine by me.


mindstorms(Posted 2006) [#6]
This is just an overly complicated way to interpolate. For example, to linearly interpolate you can use the equation y = mx + b. If you can find how the line represents the data sets, then you can set it up so that perhaps for how fast you are going (x) then you can figure out how much drag the car will recieve (y)...Taking the data sets, find m(slope) and b(yintecept) (this part easy in calculater) then plug in your x to the equation and it will return for whatever y is at position x. the equations a(X*X*X*X)+b(X*X*X)+c(X*X)+d(X)+e is just a more complicated version of the linear way, that can include a parabolic curve. In other words, it is more acurate. The more times x is multiplied means more accuracy (a,b,c...e have to be recalculated for each accuracy level...where graphing calculater comes in)


b32(Posted 2006) [#7]