Jump to content
  • Advertisement
Sign in to follow this  
h3ro

Sphere vs AABB where the sphere as no volume

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

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,

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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).

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

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?

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!