Skip to content

Instantly share code, notes, and snippets.

@Zerophase
Last active August 29, 2015 14:16
Show Gist options
  • Save Zerophase/4b40e9aa6ba81bfc6204 to your computer and use it in GitHub Desktop.
Save Zerophase/4b40e9aa6ba81bfc6204 to your computer and use it in GitHub Desktop.
AABB Intersection
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