コード例 #1
0
 public CubicBezierEquation(Point startPoint, CubicBezierSegment segment)
 {
     _startPoint = startPoint;
     _controlPoint1 = segment.ControlPoint1;
     _controlPoint2 = segment.ControlPoint2;
     _endPoint = segment.EndPoint;
 }
コード例 #2
0
 public static Point SplitByNextIntersection(Point startPoint, CubicBezierSegment segment, out SegmentBase segment1, out SegmentBase segment2)
 {
     return SplitByNextIntersection(startPoint, segment, out segment1, out segment2,
         new CubicBezierEquation(startPoint, segment),
         (t, p) =>
         {
             var a = Mid(startPoint, segment.ControlPoint1, t);
             var b = Mid(segment.ControlPoint1, segment.ControlPoint2, t);
             return new CubicBezierSegment(a, Mid(a, b, t), p);
         },
         t =>
         {
             var b = Mid(segment.ControlPoint1, segment.ControlPoint2, t);
             var c = Mid(segment.ControlPoint2, segment.EndPoint, t);
             return new CubicBezierSegment(Mid(b, c, t), c, segment.EndPoint);
         });
 }
 public static List<Point> Approximate(Point startPoint, CubicBezierSegment segment)
 {
     return Approximate(new CubicBezierEquation(startPoint, segment).GetPoint, startPoint, segment.EndPoint);
 }