Beispiel #1
0
        public AxisAlignedBox2f Intersect(AxisAlignedBox2f box)
        {
            AxisAlignedBox2f intersect = new AxisAlignedBox2f(
                Math.Max(Min.x, box.Min.x), Math.Max(Min.y, box.Min.y),
                Math.Min(Max.x, box.Max.x), Math.Min(Max.y, box.Max.y));

            if (intersect.Height <= 0 || intersect.Width <= 0)
            {
                return(AxisAlignedBox2f.Empty);
            }
            else
            {
                return(intersect);
            }
        }
Beispiel #2
0
 public AxisAlignedBox2f(AxisAlignedBox2f o)
 {
     Min = new Vector2F(o.Min);
     Max = new Vector2F(o.Max);
 }
Beispiel #3
0
 public bool Intersects(AxisAlignedBox2f box)
 {
     return(!((box.Max.x < Min.x) || (box.Min.x > Max.x) || (box.Max.y < Min.y) || (box.Min.y > Max.y)));
 }
Beispiel #4
0
 public void Contain(AxisAlignedBox2f box)
 {
     Contain(box.Min);
     Contain(box.Max);
 }