Example #1
0
        public BiomeRect Intersect(BiomeRect other)
        {
            var bottomLeft = BottomLeft.Clamp(other);
            var topRight   = TopRight.Clamp(other);

            return(new BiomeRect(bottomLeft, topRight, other.Colour));
        }
Example #2
0
        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));
        }
Example #3
0
 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));
 }
Example #4
0
 public BiomeVector Clamp(BiomeRect biomeRect)
 {
     return(Clamp(biomeRect, this));
 }