So for some reason I my brain seems be failing me :(
Anyway....I have a cylinder object in 3D space and inside of the cylinder I have line objects originating at the origin (0,0,0) (which is also the centre point of the cylinder).
I would like to find the exact point of intersection when a line crosses either of the end-caps of the cylinder but I'm not sure how to do this....

I already determine whether or not a line will actually cross the end-cap so I'm not bothered about checking this.
I should probably also mention that the line objects aren't straight. I can however get a vector that describes a line segment that crosses an end-cap.

I feel I have the basic ingredients for the calculation(s) needed but my brain refuses to help me on this. Any help would be greatly appreciated :)

Recommended Answers

All 2 Replies

I'm assuming that the cylinder is oriented with its axis along the z-axis of your co-ordinate system. So, your function that describes the line will be a vector function of some dummy variable, t, say: f(t) = (f_x(t), f_y(t), f_z(t)). So, you just need to find the point where

f_z(t) = L

Where L is the position of the end cap along the z-axis. How you do this will depend on the function f_z(t), you may need to solve it numerically. Usually, this would mean getting it in the form

f_z(t) - L = 0

and then using a root-finding algorithm.

Hope that helps at least a bit

This (and a few hours of sleep) has actually been very helpful to me

Thanks a lot :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.