Jump to content
  • Advertisement
Sign in to follow this  
jzbradley

SAT Revisited

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

Hello all!

I'm building a SAT test method for two polytopes, and got to wondering: why must I test every edge axis? If I have the center point of each polytope, why can't I project onto the axis formed by the line between the centers? Could anyone give me an example of why that wouldn't always work?

Sorry if that's a silly question, but I have the most amazing migraine right now and thinking hurts.

Share this post


Link to post
Share on other sites
Advertisement
Ha, never mind! Migrane went away and I figured out why shortly later.

Just for anyone else who might have the same question:

If you rotate each shape around its center you can end up with false positives. Same if one shape is significantly smaller and very close.

Share this post


Link to post
Share on other sites
Even though you already figured it out, here is my favorite example for people who read this thread in the future. It's just two boxes close to each other but offset:
TmUUm.png

Share this post


Link to post
Share on other sites
What you can do, is use the direction vector from one center to the other to discard faces unlikely to form a separating axis.

Say if you have convex shapes A and B with d as the vector (Center of B) - (Center of A) any faces from A with a Normal 'Na' for which Dot(d,Na) is a negative number and any faces of B with Normal 'Nb' for which Dot(d,Nb) is a positive number can be discarded as separating axis.

This is something I came up with as an optimization so use it at your own risk biggrin.png, the logic is that you are discarding the faces that are farther away from a posible instersection point and keeping the ones that are closest to it.

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!