Thread: Need help to figure out a function for a curve

1. Need help to figure out a function for a curve

I encountered this problem when programming movement and rotation of a sprite. it's a train moving on a parabola curve. I figured out the movement function but have trouble on the rotation.
rotation is depend on the y variable of the movement function, let's call it variable a.

have a few points from placing the sprite at right position and rotation.

(a, r) // a is from y value on the parabola, r is the rotation value(the value i seek from the unknown function) r is dependent on y value;
will be (x,y) on a xy plane

 (7, 0) (43, -26.31) (85, -31.4) (189, -34.55) (351, -38.5) (493, -40.82) (740, -44.87)

I need to find the rotation function that takes a as an input.
from the look of it, the graph look like r=a^something, where something < 1;
Thank advance for any help from you guys.

2. Re: Need help to figure out a function for a curve

Hi !

it's not sure that it is a parabola. It could also be an hypernola with non-orthogonal asymptotes.
So, I suggest a quadratic curve regression with least squares fitting.
After computing the coefficients for the general equation of the quadratic curve, it is easy to identify a parabola or an hyperbola or etc. Then, the center, the axis,... can be determined and asympotes as well if they are some.