public bool Overlaps(AABB other) { if (other.Lo.X > Hi.X || other.Hi.X < Lo.X) return false; if (other.Lo.Y > Hi.Y || other.Hi.Y < Hi.Y) return false; if (other.Lo.Z > Hi.Z || other.Hi.Z < Hi.Z) return false; return true; }
public void SetUnion(AABB other) { Lo.X = Math.Min(Lo.X, other.Lo.X); Lo.Y = Math.Min(Lo.Y, other.Lo.Y); Lo.Z = Math.Min(Lo.Z, other.Lo.Z); Hi.X = Math.Max(Hi.X, other.Hi.X); Hi.Y = Math.Max(Hi.Y, other.Hi.Y); Hi.Z = Math.Max(Hi.Z, other.Hi.Z); }
public bool SetIntersection(AABB other) { Lo.X = Math.Max(Lo.X, other.Lo.X); Lo.Y = Math.Max(Lo.Y, other.Lo.Y); Lo.Z = Math.Max(Lo.Z, other.Lo.Z); Hi.X = Math.Min(Hi.X, other.Hi.X); Hi.Y = Math.Min(Hi.Y, other.Hi.Y); Hi.Z = Math.Min(Hi.Z, other.Hi.Z); if (Hi.X >= Lo.X && Hi.Y >= Lo.Y && Hi.Z >= Lo.Z) return true; Hi = Lo; return false; }