Sphere vs AABB where the sphere as no volume

Started by
5 comments, last by Zakwayda 13 years, 1 month ago
Hallo,

I am trying to find out if a sphere intersects a AABB, but in my case the sphere does not have a volume. Im only interested in intersections if the sphere edges intersects the AABB. Is there any known algorithms for this?

Thanks,
Advertisement
I actually just wrote some code for this recently (I don't have it handy at the moment, but I could probably dig it up if need be).

Unless I'm mistaken, the surface of the sphere intersects the box if the (solid) sphere intersects the box, and the sphere does not contain the box.

The solid-sphere-vs.-box test is straightforward; the containment test is fairly straightforward as well, but isn't as well documented.

If you need any further help with this, feel free to ask.
Some help would be greatly appreciated.

Im trying to write a function for creating a sparse octree voxel mesh from a sphere and I just cant seem to get it right.

Im trying to write a function for creating a sparse octree voxel mesh from a sphere and I just cant seem to get it right.

Yup, I was doing something similar :)

I'll try to post back with some more info tonight or tomorrow (if no one jumps in before then, that is).
I don't know if you still need help with this, but if so, do you already know how to perform the solid-sphere-vs.-box test? Or are you looking for help with that part as well?
I had the solid sphere working, but was struggling with the hollow sphere. I found the code for it on "http://www.realtimerendering.com/intersections.html". From what I can understand that approach is a bit different from yours, I would be interested to hear which one you think is the most efficient one.

I had the solid sphere working, but was struggling with the hollow sphere. I found the code for it on "http://www.realtimer...ersections.html". From what I can understand that approach is a bit different from yours, I would be interested to hear which one you think is the most efficient one.

I'm not quite clear on what part of the problem you've solved, and what part (if any :) you haven't yet solved. So are you saying you found code for the hollow-sphere-vs.-box test on the site you linked to and solved the problem? Or are you still trying to solve the containment problem?

This topic is closed to new replies.

Advertisement