From: spellucci@mathematik.tu-darmstadt.de (Peter Spellucci) Subject: Re: Fitting a cylinder to a set of 3-D points Date: 16 Feb 1999 13:19:23 GMT Newsgroups: sci.math.num-analysis To: kluskens@crystal.nrl.navy.mil (Michael Kluskens) In article , kluskens@crystal.nrl.navy.mil (Michael Kluskens) writes: |> I need an algorithm to fit a cylinder to a set of 3-D points. Anyone got |> one already or good ideas. I have some ideas I'm going to try out as soon |> as possible. |> netlib/odrpack is a solution for your problem. see also http://plato.la.asu.edu/guide.html for a gui. however, this is a computational expensive approach. for a cylinder along the z-axis fitting a circle to the (x,y) -data of your points would be sufficient and this is quite simple: minimize sum_i {(x_i-x0)^2+(y_i-y0)^2-r2}^2 with respect to x0,y0,r2=(r^2), using a standard nonlinear least squares code (e.g. minpack in netlib or nlscon from elib. for a cylinder in general position we need also to find its axis of symmetry. this amounts in a linear transformation of 3-space, which could be added easily to the model above. if however you think about an elliptical cylinder, things become much more complicated and in this case i would prefer using odrpack. hope this helps peter