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

  • 3
    $\begingroup$ What does "wrapping a grid of points around the cylinder" mean? $\endgroup$ – Wolfgang Bangerth Jun 28 '15 at 22:08
  • 4
    $\begingroup$ 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. $\endgroup$ – Doug Lipinski Jun 28 '15 at 22:24

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.

  • $\begingroup$ Shouldn't equation 4 be like this: Pa = (P.a) * a $\endgroup$ – nurabha Jul 1 '15 at 15:11
  • $\begingroup$ Yes. The value there now is a scalar. You want a vector. Thanks, will correct. $\endgroup$ – dpmcmlxxvi Jul 1 '15 at 15:13
  • $\begingroup$ 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. $\endgroup$ – nurabha Jul 1 '15 at 15:17
  • $\begingroup$ Correct. I've fixed the answer. $\endgroup$ – 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:


  • $\begingroup$ 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. $\endgroup$ – nurabha Jul 1 '15 at 15:09
  • $\begingroup$ Clearly I did not understand your question; sorry. $\endgroup$ – Joseph O'Rourke Jul 1 '15 at 15:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.