Skip to content

Instantly share code, notes, and snippets.

@Pyknic
Created November 16, 2020 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pyknic/e758511f61de1735d2c8dbb4ee2dccbd to your computer and use it in GitHub Desktop.
Save Pyknic/e758511f61de1735d2c8dbb4ee2dccbd to your computer and use it in GitHub Desktop.
public struct Rect {
public Vector3 TopLeft, BottomRight;
public bool Intersects(Rect other) {
return !( this.TopLeft.X > other.BottomRight.X
|| this.TopLeft.Y > other.BottomRight.Y
|| this.TopLeft.Z > other.BottomRight.Z
|| this.BottomRight.X < other.TopLeft.X
|| this.BottomRight.Y < other.TopLeft.Y
|| this.BottomRight.Z < other.TopLeft.Z);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment