public TransformBezierControlPoints(BezierControlPoint[] points) { DefaultPoints = new BezierControlPoint[points.Length]; for (int i = 0; i < points.Length; i++) { DefaultPoints[i] = points[i].Clone(); } var first = DefaultPoints[0] as BezierControlPoint; float top = first.Second.Y; float left = first.Second.X; float bottom = first.Second.Y; float right = first.Second.X; for (int i = 1; i < DefaultPoints.Length; i++) { var temp = DefaultPoints[i] as BezierControlPoint; BezierCaliculate.GetArea(first, temp, out float minx, out float maxx, out float miny, out float maxy); top = Math.Min(top, miny); bottom = Math.Max(bottom, maxy); left = Math.Min(left, minx); right = Math.Max(right, maxx); first = temp; } TransRec = new TransformRectangle( new PointF(left, top), new PointF(right, top), new PointF(left, bottom), new PointF(right, bottom) ); }
private bool IsInside(TransformRectangle target, PointF src) { return(IsInside(src, target.TopLeft, target.BottomLeft, target.BottomRight) || IsInside(src, target.BottomRight, target.TopRight, target.TopLeft)); }