# Fitting a Cylinder Around a Line

Assuming data like the following:

   x         y           z
61.451828 120.703318 53.891932
60.487655 120.451269 53.958880
59.553369 120.113391 53.937736
58.649164 119.742376 53.741179
57.748777 119.372535 53.518019
56.833270 118.988744 53.426859
55.916012 118.591941 53.398583
54.999395 118.212736 53.291697
54.076806 117.979776 53.029058
53.153013 117.982292 52.663368
52.202854 118.205061 52.445258
51.248874 118.454180 52.295180


Where each column represents a row represents a single point (x, y, z). These points represent a "tube", but these are just the points and I need to be able to find the area of this tube. I also need to be able to orient several iterations of data like this in the same direction, if that is of any relevance.

Note: Because I am not sure how to do this, I do not know what tags to apply to the question. Sorry if I misapplied any.

-
These points are on the surface of a cylinder, I presume? –  Ｊ. Ｍ. Apr 17 '12 at 18:27
These points are points of a line. I am trying to fit a cylinder around these points. –  Linell Apr 17 '12 at 18:30
Where would the cylinder's radius come from? –  Ｊ. Ｍ. Apr 17 '12 at 18:32
It can be arbitrary. The idea is that I need to be able to find the area of the "tube." I can't find the area of a line, but by making all of the lines into cylinders, I can. As far as I know, setting the radii to 1 would be fine, although there may be some reason that this wouldn't work. –  Linell Apr 17 '12 at 18:35
The usual method is to perform orthogonal regression on your points to obtain a parametric equation of the line of least perpendicular distance from your points. You can then use the direction numbers of that line to build the equation of your cylinder... –  Ｊ. Ｍ. Apr 17 '12 at 18:51