curve on surface of a cylinder

82 Views Asked by At

How can we constrain a 3D curve to be on the surface of cylinder?
I have a array of 3D points $[x_c, y_c, z_c]$ which take a helix kind of curve (not exactly helix) and a cylinder with given diameter $d$ (for simplicity assume that it has $z$ axis as its axis and origin as center).
I want to apply some forces on the curve in order to conform to cylinder's surface.
I used the equality constrain that the distance between the points $[x_c, y_c]$ and $[0,0]$ is equal to $d/2$. The issue is, with this constraints, the optimization sometimes gets the curve to cross the cylinder internally. Is there any other condition which needs to be taken care of?

1

There are 1 best solutions below

0
On BEST ANSWER

Essentially the same condition as yours but differently written. For any point on the curve $\left(X, Y, Z\right)$ the triple must satisfy $X^2 +Y^2 = \frac{d^2}{4}$ and $Z \in [0, H]$ to keep it on the cylinder. Assuming the diameter is $d$ and the height of the cylinder is $H$. Of course the coordinate axes here are assumed to be on one of the ends of the cylinder and the $z$ axes is aligned with the axis of the cylinder.

It sounds like you are doing this on a computer, you may be having this issue due to round off errors is you are not doing things to adequate precision.