public RectF(string data) { int splitIdx = data.IndexOf(' ', data.IndexOf(' ') + 1); Point = new Point2F(data.Substring(0, splitIdx)); Extent = new Point2F(data.Substring(splitIdx)); }
internal RectF(InternalRectFStruct point2FStruct) { Point = new Point2F(point2FStruct.pointX, point2FStruct.pointY); Extent = new Point2F(point2FStruct.extentX, point2FStruct.extentY); }
public double GetDistanceToLine(Point2F start, Point2F end) { return(Math.Abs((end.Y - start.Y) * X - (end.X - start.X) * Y + end.X * start.Y - end.Y * start.X) / Math.Sqrt((end.Y - start.Y) * (end.Y - start.Y) + (end.X - start.X) * (end.X - start.X))); }
public RectF(float pointX, float pointY, float extentX, float extentY) { Point = new Point2F(pointX, pointY); Extent = new Point2F(extentX, extentY); }
/** * Distance from point p1 to p2 * */ public static double Distance(Point2F p1, Point2F p2) { return(Math.Sqrt(Math.Pow((p2.X - p1.X), 2) + Math.Pow((p2.Y - p1.Y), 2))); }