public bool CanContain(Shape s) { if (this.LeftEdge > s.LeftEdge || this.RightEdge < s.RightEdge || this.TopEdge < s.TopEdge || this.BottomEdge > s.BottomEdge) return false; if (this.GetAreaOfSpace() <= s.GetAreaOfSpace()) return false; Point rightest = ShapeMaker.InvalidPoint; foreach (Point ps in s.Points) { if (ps.X == s.RightEdge) { rightest = ps; break; } } if (rightest == ShapeMaker.InvalidPoint) return false; ILine ray = new Line(rightest, new Point(Int32.MaxValue, rightest.Y)); int intersections = 0; foreach (ILine l in this.GetLines()) { if (Line.Crosses(ray, l)) intersections++; } return (intersections % 2) != 0; }