public Rectangle GetRectangleInBoundary(Rectangle boundary) { Vector2 realCenter = GetCenterInBoundary(boundary); float realWidth = boundary.Width * Width; float realHeight = boundary.Height * Height * ((float)boundary.Width / (float)boundary.Height); FloatRectangle realRectangle = new FloatRectangle(realCenter.X - realWidth / 2f, realCenter.Y - realHeight / 2f, realWidth, realHeight); return realRectangle.ToRectangle(); }
public MoveableRectangle(FloatRectangle startRectangle) { current = startRectangle; }
public void SetRectangle(Rectangle rectangle) { current = new FloatRectangle(rectangle); }
public static FloatRectangle CreateRectangle(float x1, float y1, float x2, float y2) { FloatRectangle output = new FloatRectangle(); output.x = Math.Min(x1, x2); output.y = Math.Min(y1, y2); output.width = Math.Abs(x2 - x1); output.height = Math.Abs(y2 - y1); return output; }