I want to split a bezier curve into two. For example, if there is a bezier curve between points (100,100) and (200, 100) with control points (150,150) and (175, 150), the curve should be colored in two different colors (say red and green), one color from (100,100) to (150, 100) say red and another color from (150,100) to (200,100) say green.
This is my code for drawing a bezier spline:
void Form1_Paint(object sender, PaintEventArgs e)
{
Point startPoint = new Point(100, 100);
Point endPoint = new Point(200, 100);
Point ctPoint1 = new Point(150, 150);
Point ctPoint2 = new Point(175, 150);
GraphicsPath gp = new GraphicsPath();
gp.AddLine(new Point(100, 0), new Point(100, 100));
gp.AddBezier(startPoint, ctPoint1, ctPoint2, endPoint);
gp.AddLine(new Point(200, 100), new Point(200, 0));
gp.AddLine(new Point(100, 0), new Point(200, 0));
e.Graphics.FillPath(Brushes.Aqua, gp);
}
I want to fill it with two colors like I explained above.
Desired result:
How can I achieve this
Edit:
I have checked a few links for splitting bezier curve enter link description here but it tells me about finding the midpoint of the curve which is not my scenario, I'm looking for drawing half bezier curves.
Values known: two points and their control points to draw a bezier curve between the two points
Expected result: Draw one part of the bezier curve from starting point to the midpoint and another part from midpoint to ending point.