# Wrapping grid of points around curvature of an infinitely long cylinder [closed]

I have an infinitely long cylinder defined using

• radius
• a point in 3d
• Axis defined using a 3d vector

I have a set of points with 3d coordinates placed in a grid.

I want to wrap this grid of points around the curvature of my cylinder. How to do it

• What does "wrapping a grid of points around the cylinder" mean? – Wolfgang Bangerth Jun 28 '15 at 22:08
• I think you're going to have to give a lot more detail than this to make it an good, answerable question. I have a picture in my head of what you might be describing, but there's not nearly enough information to know what you're really trying to achieve. – Doug Lipinski Jun 28 '15 at 22:24

## 2 Answers

It seems like you are trying to project the grid points onto the cylindrical surface. You can do this via a few vector projections.

1. Let r be the cylinder radius
2. Let P be a grid point.
3. Let a be the cylinder axis unit vector.
4. Project P along a

 Pa = (P · a) * a

5. Compute projection of grid point perpendicular to axis

 P⊥ = P - Pa

6. Compute unit vector of perpendicular projection

 p⊥ = P⊥ / ||P⊥||

7. Compute the projection of the grid point on the cylinder

 Pcyl = Pa + r * p⊥


Pcyl is the value you want. Compute it for each grid point.

Basically, you are moving up the cylinder axis until you reach the grid point in that direction, then you move toward the grid point until you hit the cylinder, then you stop.

• Shouldn't equation 4 be like this: Pa = (P.a) * a – nurabha Jul 1 '15 at 15:11
• Yes. The value there now is a scalar. You want a vector. Thanks, will correct. – dpmcmlxxvi Jul 1 '15 at 15:13
• I am just following the vector projection link you shared. Even if a is a unit vector, I think Pa should be (P.a)* a. – nurabha Jul 1 '15 at 15:17
• Correct. I've fixed the answer. – dpmcmlxxvi Jul 1 '15 at 15:18

It might be easiest to first place the cylinder in some standard position, e.g., base on the $xy$-plane and axis along $z$, generate the grid of points as $(r\cos \theta, r\sin \theta, z)$, and then translate & rotate both cylinder and points out to wherever it should reside: • Not sure I understood your answer. I am not looking for method to generate grid of points representing the surface of the cylinder. Rather. the position of grid of points is pre-defined (say in shape of a smile placed in xy plane). I want to wrap(projecting) the smile shape onto surface of the cylinder whose radius, point on axis and axis direction vector is given. – nurabha Jul 1 '15 at 15:09
• Clearly I did not understand your question; sorry. – Joseph O'Rourke Jul 1 '15 at 15:15