AABB-Cylinder Intersection

Started by
2 comments, last by Lord Crc 15 years, 10 months ago
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!
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.

Everything is better with Metal.

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.
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Check out this document. Around page 14 they discuss Cylinder vs OOBB intersection.

This topic is closed to new replies.

Advertisement