public Box2d(AxisAlignedBox2d aaBox) { Extent = 0.5 * aaBox.Diagonal; Center = aaBox.Min + Extent; AxisX = Vector2D.AxisX; AxisY = Vector2D.AxisY; }
public AxisAlignedBox2d Intersect(AxisAlignedBox2d box) { AxisAlignedBox2d intersect = new AxisAlignedBox2d( 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(AxisAlignedBox2d.Empty); } else { return(intersect); } }
public AxisAlignedBox2d(AxisAlignedBox2d o) { Min = new Vector2D(o.Min); Max = new Vector2D(o.Max); }
public bool Intersects(AxisAlignedBox2d box) { return(!((box.Max.x < Min.x) || (box.Min.x > Max.x) || (box.Max.y < Min.y) || (box.Min.y > Max.y))); }
public bool Contains(AxisAlignedBox2d box2) { return(Contains(box2.Min) && Contains(box2.Max)); }
public void Contain(AxisAlignedBox2d box) { Contain(box.Min); Contain(box.Max); }