public BoundingBox2D(IShape2D obj, Point2D topLeft) { shape = obj; TopLeft = topLeft; Width = obj.GetWidth(); Height = obj.GetHeight(); }
public bool Contains(Point2D p) { float centerX = Left + HorizontalRadius; float centerY = Top + VerticalRadius; return Math.Pow(p.X - centerX, 2) / Math.Pow(HorizontalRadius, 2) + Math.Pow(p.Y - centerY, 2) / Math.Pow(VerticalRadius, 2) <= 1; }
public bool ShapeContains(Point2D p) { return shape.Contains(p); }
public bool Contains(Point2D p) { return p.X >= TopLeft.X && p.X <= TopLeft.X + Width && p.Y >= TopLeft.Y && p.Y <= TopLeft.Y + Height; }