Jump to content
  • Advertisement
Sign in to follow this  
FiPoO

AABB-Cylinder Intersection

This topic is 3649 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


Link to 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


Link to 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


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!