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 BiomeRect(BiomeVector bottomLeft, BiomeVector topRight, Color colour) { BottomLeft = bottomLeft; TopRight = topRight; Colour = colour; Debug.Assert(Width > 0); Debug.Assert(Height > 0); }
public BiomeRect(float bottomX, float bottomY, float topX, float topY, Color colour) { BottomLeft = new BiomeVector(bottomX, bottomY); TopRight = new BiomeVector(topX, topY); Colour = colour; Debug.Assert(Math.Abs(bottomX - topX) > 0); Debug.Assert(Math.Abs(bottomY - topY) > 0); Debug.Assert(topX > bottomX); Debug.Assert(topY > bottomY); }