Jump to content
• Advertisement

# AABB-Cylinder Intersection

This topic is 3798 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Hi! I have build a ray tracer that uses Kd-tree for optimization. It actually renders Spheres, Planes and Meshes, and now I'm planing to add Cylinders to it. The problem is that I can't find any AABB-Cylinder intersection algorithm to build the Kd-Tree structure. Can anyone help me solving these? My cylinder is defined by a radius and a height, and also a transformation matrix for rotation and translation. My AABB is defined by a position vector an a size vector for x, y, z sizes. Any help would be fine! Thanks!

#### Share this post

##### Share on other sites
Advertisement
There are many ways to do it. If it is a rough test you want, You could build an AABB box around it and test against AABB, or use a capsule (a segment with a radius).

I'd just use the AABB vs OBB test. It's easy and fast. I'm not 100% sure about using the SAT for a direct box-cylinder test.

#### Share this post

##### Share on other sites
I have code for an intersection test between cylinder and sphere here:
Static Intersection Test Between Cylinder and Sphere

It works by calculating the cylinder's closest point to the sphere. Maybe this can be adapted to find the closest point to an AABB instead?

You'd probably have do replace the simple sphere center vector with something more complicated, like a Line/AABB closest point finder.

#### Share this post

##### Share on other sites
Check out this document. Around page 14 they discuss Cylinder vs OOBB intersection.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
49
2. 2
3. 3
4. 4
5. 5
• Advertisement

• 10
• 28
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633410
• Total Posts
3011727
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!