2
$\begingroup$

this is a bit more complicated than the post title suggests because I was running out of words. I suppose the full title would be: "Finding the distance between the centre of an arbitrarily rotated cylinder and a point on that cylinder which is the intersection of a ray projected from the centre of the cylinder at angles a and b, which are relative to the absolute axes."

To break it down a little:

I have a circular cylinder, which is rotated to an arbitrary orientation in 3D. I have the radius of the cylinder and I have a vector which is the vector along the cylinder's length (essentially the cylinder's orientation). The cylinder's height is infinite.

I also know the coordinates of the centre of the cylinder, let's call that point p. From p I draw a line in 3D in a direction specified by two angles, alpha and beta, which are angles of rotation in the cardinal axes of x and y (i.e. the absolute axes, and not relative to the cylinder). I would like to work out the point at which this line intersects the cylinder and also the distance between the two points.

So to break it down further:

1) I need to rotate the cylinder back to the origin, and then rotate the line by the exact same same angles to get them relative to the cylinder while the cylinder is at the origin.

2) Using this new point of reference, I need to calculate the point of intersection between the now transformed cylinder and the line made from the two transformed angles I have.

I can get x and y of this point by using rCosAlpha,rSinAlpha and I can get z by using rtanBeta (I have the adjacent - r (the radius) - and need the opposite)

And then I simply use Pythagoras' theorem to get the distance.

The problem is working this all out using these two frames of reference: absolute orientations and relative orientations. Or solving problem (1) so I don't have

Does anybody have any ideas?

  • 1
    One thing you could consider for rotating your cylinder to be, say, aligned to the $z$-axis would be to use spherical coordinates. If you take two points on the axis of your cylinder and set up a spherical coordinate system with respect to one of your points, you can reckon the angles you need to rotate your cylinder to a more tractable orientation.2012-05-08

1 Answers 1

2

The distance should be easy to determine in closed-form from $r$ (cylinder radius), $\overline{C}$ (a vector along the cylinder's center) and $\overline{P}$ (a vector representing a ray from that centerline to the point $p$).

My first stab...

$ d = r \tan\left(\arccos{\left(\! \frac{\overline{C}\cdot\overline{P}}{|\overline{C}| |\overline{P}|} \!\right)}\right) $

  • 0
    I managed to solve my problem by finding a way of generating my rays at angles offset from the cylinder's orientation. I'll keep this question open for a bit first, though, as it's an interesting problem.2012-05-22