Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Plotting arcs in 3D space 2

Status
Not open for further replies.

xwb

Programmer
Jul 11, 2002
6,828
0
36
GB
I've got 3 points in 3D space that I want to fit a curve to. I can figure out the math in 2D space but not in 3D space. I've searched for 3D, points, plotting but haven't been very successful. I'm basically looking for the math around the problem so I can work out the points along the path. I'm not interested in plotting it: just in working out the points.

What keywords should I be googling for?
 
Have you Googled "spline", or "NURBS" (Nonuniform rational B-spline)?

Good Luck,

Greg
 
mmm splines - haven't heard that term for almost 25 years. I'll give that a try.

I also tried linear regression - gave me a load of stuff on straight lines: nothing n a quadratic on a slanting plane which is what I really want.
 
NURBS - that stuff is brilliant. Doesn't really give me what I want but I can see a use for it.
 
I'm not a mathematician, but here goes:

(1) If you're working in 3 dimensions, you have to distinguish between a line of best fit, and a plane of best fit. You're clearly looking for a line, but many methods will be aiming to fit a plane.

(2) Since you have only 3 points, they must lie in a flat plane. Probably step 1 is to find that plane.

(3) Having found the plane, you can map your points on the plane, and draw the line through them using the normal 2d methods. Then you simply step along the line and add the appropriate coordinates for the plane to get the coordinates in "real" space.

Good luck!
 
Basically I was planning on doing that but just wondered; instead of using transformations, to move from a 3D space to a 2D space, do regression analysis, work out points then transform them back into 3D space, would it be possible to find the formula of a curved line in 3D space.

It is just something I never covered in A level further maths. Did a lot on planes and transformational geometry but not the formula for a quadratic or an ellipse in 3D space.

I'm keeping that as a pet project to do on a rainy day or after the project panic has died down. In the mean time it is just transformational geometry and curve fits.
 
Another thought then:

Because you're looking for a line, you are not trying to fit one equation of the sort
z = f(x, y)
Instead you're trying to fit two equations
z=f(x), y=f(x) in order to return a line of points (z,y) from x

This being the case, you could simply do two two-dimensional fittings. Forget y altogether, and fit a curve for z. Do the same for x. Then calculate your points z,y,x from x using both equations.
 
lonehill - I never thought of that - that's a brilliant idea. And it is so simple.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top