public BiomeRect Intersect(BiomeRect other) { var bottomLeft = BottomLeft.Clamp(other); var topRight = TopRight.Clamp(other); return(new BiomeRect(bottomLeft, topRight, other.Colour)); }
private static BiomeVector Clamp(BiomeRect biomeRect, BiomeVector biomeVector) { var x = Math.Max(Math.Min(biomeRect.TopRight.X, biomeVector.X), biomeRect.BottomLeft.X); var y = Math.Max(Math.Min(biomeRect.TopRight.Y, biomeVector.Y), biomeRect.BottomLeft.Y); return(new BiomeVector(x, y)); }
public bool Intersects(BiomeRect other) { return ((TopRight.X > other.BottomLeft.X) && (BottomLeft.X < other.TopRight.X) && (TopRight.Y > other.BottomLeft.Y) && (BottomLeft.Y < other.TopRight.Y)); }
public BiomeVector Clamp(BiomeRect biomeRect) { return(Clamp(biomeRect, this)); }