AABB-Cylinder Intersection
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!
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.
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement