Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect Line segment intersection with Cylinder? [duplicate]

Say we have a 3d space, Line segment defined by its start and end points (A {Ax, Ay, Az}, B {Bx, By, Bz}) and cylinder defined by its center position C {Cx, Cy, Cz}, radius R and height H. How to get a fact of intersection and if intersection happened than where?

like image 774
myWallJSON Avatar asked Oct 16 '25 05:10

myWallJSON


1 Answers

Try this. Google for the win - the answer is even here on SO. This even has source code and links to more information for you to use. With just a little bit of searching, you could have got this yourself.

This is based on @DuckQueen's answer - it just adds projecting the intersection point - if any - to see if it falls within the height of the cylinder.

like image 195
Michael Dorgan Avatar answered Oct 18 '25 06:10

Michael Dorgan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!