public static bool Equals(Size size1, Size size2) { if (size1.IsEmpty) { return size2.IsEmpty; } return (size1.Width.Equals(size2.Width) && size1.Height.Equals(size2.Height)); }
public Rect(Point location, Size size) { if (size.IsEmpty) { _x = 0; _y = 0; _width = 0; _height = 0; } else { _x = location._x; _y = location._y; _width = size._width; _height = size._height; } }
public static Rect Inflate(Rect rect, Size size) { rect.Inflate(size._width, size._height); return rect; }
public void Inflate(Size size) { Inflate(size._width, size._height); }
public Rect(Size size) { if (size.IsEmpty) { _x = 0; _y = 0; _width = 0; _height = 0; } else { _x = _y = 0.0; _width = size.Width; _height = size.Height; } }
public bool Equals(Size value) { return Equals(this, value); }
static Size() { SEmpty = CreateEmptySize(); }
public static Point GetClippingPoint(Size size, Point s, Point t) { double[] sides = new double[4]; sides[0] = (s.X - size.Width / 2.0 - t.X) / (s.X - t.X); sides[1] = (s.Y - size.Height / 2.0 - t.Y) / (s.Y - t.Y); sides[2] = (s.X + size.Width / 2.0 - t.X) / (s.X - t.X); sides[3] = (s.Y + size.Height / 2.0 - t.Y) / (s.Y - t.Y); double fi = 0; for (int i = 0; i < 4; i++) { if (sides[i] <= 1) fi = Math.Max(fi, sides[i]); } if (fi == 0) { fi = double.PositiveInfinity; for (int i = 0; i < 4; i++) fi = Math.Min(fi, Math.Abs(sides[i])); fi *= -1; } return t + fi * (s - t); }