3d points curve fitting (from real life data)

Hi All,

I have a series of 3d points that represent a ball moving in all 3 dimensions. Basically a ball has been thrown, it has been tracked, and have obtained automatically obtained the centre of the ball in 3d. During the motion, the also hits the ground and bounces at one point.

I want to find a curve / curves fitting algorithm that will fit this motion best with the results i have gathered. I know that this motion is basically just a simple projectile motion, but I must also state that the ball swings / curves in the air, due to its make up.

Also I want to then extend the motion beyond the range i have values for. My main concern with an algorithm is to minimise the error / accuracy, rather than any nice looking curves etc!

Adam

[774 byte] By [oracle3001a] at [2007-9-29 14:45:50]
# 1

Oracle, how good to hear from you again! The SVD problem has still not been addressed by Sun. Let's see if you can do better with this one.

"Numerical Recipes" by Bill Press et. al. is the best book I know of on numerical methods. It's got some great curve-fitting algorithms, along with a lot of other stuff (including SVD):

http://www.amazon.com/exec/obidos/tg/detail/-/0521431085/qid=1067124828/sr=1-1/ref=sr_1_1/002-2093144-0097641?v=glance&s=books

Google turned up stuff, too:

http://www.mathcom.com/corpdir/techinfo.mdir/scifaq/q230.html

The bouncing will make your task interesting. You won't be fitting one curve, but two: one before the bounce and another after. The bounce is a change in direction that will make it difficult, if not impossible, for a single curve to describe the motion of the ball.

Another thing to try would be directly integrating the equations of motion to see if you could come up with a closed-form solution. It might be in 3D, but a suitable choice of coordinates might make it a 2D problem.You could then get the 3D trajectory via transformation.

A last alternative would be numerical integration of the equations of motion, with a rigid boundary condition for the floor the ball bounces off of.

Good problem. Sorry I'm not more helpful. - MOD

duffymoa at 2007-7-15 5:37:38 > top of Java-index,Other Topics,Algorithms...
# 2

> The bouncing will make your task interesting. You

> won't be fitting one curve, but two: one before the

> bounce and another after. The bounce is a change in

> direction that will make it difficult, if not

> impossible, for a single curve to describe the motion

> of the ball.

Yes, you need a set of separate curves to describe the

parts between bounces. For a smooth surface, the bounce

is quite easy. Assume a particluar coefficient of

restitution between 0 and 1 and there are simple formulae

that I'm sure your Google search came up with. For a

rough surface you need a random variation on this.

> Another thing to try would be directly integrating the

> equations of motion to see if you could come up with a

> closed-form solution.

I doubt it. Again, in the simple case, neglecting air

resistance it's easy and well known. But once you have

a spinning ball in air it's much harder.

> A last alternative would be numerical integration of

> the equations of motion...

This is feasible, and how ballistics calculations work.

For big guns it's not so easy because the atmospheric

conditions vary in an unpredictable way over typical

distances, but if you're simulating baseball or cricket

that's not such a problem.

As you have experimental data, you should be able to fit

cubic splines. These should match the curve to

reasonable accuracy. One way would be to fit three

splines, one for each of the x, y and z coordinates,

with time as the independent variable. If the path

curves too sharply, you could get loops, but otherwise

this should work well. If you don't have data on time

you could fit two splines for two of the coordinates

as functions of the horizontal distance.

TerryMoorea at 2007-7-15 5:37:38 > top of Java-index,Other Topics,Algorithms...
# 3
Wow, TerryMoore, you're bringing in a lot of difficult physics. I guess I was doing the easy problem (smooth surface, neglect fluid/structure interaction effects of variable air pressure on a spinning ball) because I thought the "full problem" was too hard. - MOD
duffymoa at 2007-7-15 5:37:38 > top of Java-index,Other Topics,Algorithms...
# 4

I have found a neat solution to my problem, but only for 2d curve fitting. It is titled, least square curve fitting with confidences.

The equation of the parabolic fit version is as following:-

y = b0 + b1*z + b2*(z^2)

where b0, b1, and b2 are calculated from the least squares solution of the following matrix set up.

| s0 , sz, szz| | b0 || sy|

| sz , szz , szzz | | b1 |= | szy |

| szz , szzz , szzzz | | b2 || szzy |

where s0 = Sum between i = 1 and n of pi

sy = Sum between i = 1 and n of (yi * pi)

sz = Sum between i = 1 and n of (zi * pi)

szz = Sum between i = 1 and n of ( zi * zi * pi)

pi is a confidence constant.

I now need to expand is idea to 3d, I have been told it is possible, but not how to do it.

Any idea folks?

Adam

oracle3001a at 2007-7-15 5:37:38 > top of Java-index,Other Topics,Algorithms...
# 5

> Wow, TerryMoore, you're bringing in a lot of difficult

> physics. I guess I was doing the easy problem (smooth

> surface, neglect fluid/structure interaction effects

> of variable air pressure on a spinning ball) because I

> thought the "full problem" was too hard. - MOD

I was merely pointing out that the physics was difficult--

not the bouncing, but certainly the air resistance.

Fitting curves to the observed data is easier. In the

Graphics2D class there is a 2D cubic spline. I haven't

tried Graphics3D (or whatever it's called), but the

documentation says that there are 4D splines. So my

other suggestion of fitting splines should be possible

using the java class libraries.

Why are 4D splines in Graphics3D? Probably for exactly

this purpose--we have a point moving in three dimensions

and you want to plot its position as a function of a

fourth dimension (time).

TerryMoorea at 2007-7-15 5:37:38 > top of Java-index,Other Topics,Algorithms...
# 6
Thank you for the information, but I have just looked in the offical java api's and can't find the classes you were talking about.COuld you post a link to them, as I am a little puzzled about where the things you mentioned are?Adam
oracle3001a at 2007-7-15 5:37:38 > top of Java-index,Other Topics,Algorithms...
# 7
I thought I'd seen it somewhere, but I can't find it in Vecmath where I thought it was. However, there is com.sun.j3d.utils.behaviors.interpolators.CubicSplineSegment
TerryMoorea at 2007-7-15 5:37:38 > top of Java-index,Other Topics,Algorithms...