Last active
August 29, 2015 14:16
-
-
Save Zerophase/4b40e9aa6ba81bfc6204 to your computer and use it in GitHub Desktop.
AABB Intersection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AABBIntersection | |
{ | |
public bool Intersect(AABB3D a, AABB3D b) | |
{ | |
if (Math.Abs(a.Center.x - b.Center.x) > (a.HalfWidth + b.HalfWidth)) | |
return false; | |
if (Math.Abs(a.Center.y - b.Center.y) > (a.HalfHeight + b.HalfHeight)) | |
return false; | |
if (Math.Abs(a.Center.z - b.Center.z) > (a.HalfDepth + b.HalfDepth)) | |
return false; | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment