public static RectangleF LineBoundingRect(UnitPoint linepoint1, UnitPoint linepoint2, float halflinewidth) { double x = Math.Min(linepoint1.X, linepoint2.X); double y = Math.Min(linepoint1.Y, linepoint2.Y); double w = Math.Abs(linepoint1.X - linepoint2.X); double h = Math.Abs(linepoint1.Y - linepoint2.Y); RectangleF boundingrect = ScreenUtils.GetRect(x, y, w, h); boundingrect.Inflate(halflinewidth, halflinewidth); return(boundingrect); }
public static RectangleF GetRect(UnitPoint p1, UnitPoint p2, double width) { double x = Math.Min(p1.X, p2.X); double y = Math.Min(p1.Y, p2.Y); double w = Math.Abs(p1.X - p2.X); double h = Math.Abs(p1.Y - p2.Y); RectangleF rect = ScreenUtils.GetRect(x, y, w, h); rect.Inflate((float)width, (float)width); return(rect); }