I'm using PHP with imagick to draw bezier curves. I have a function that will take 3 x,y coordinates and return the middle XY point to ensure that the curve passes through those 3 points.
I'd like to create a function that does the same thing, but for 6 points. I have no idea where to start. I assume there is a mathematical way to calculate the 4 midpoints in a 6 point bezier curve.
Here is an example of how the 3 point code works:
$s1 = array("x" => $var1, "y" => 0);//start
$s2 = array("x" => $var2, "y" => $var3);
$s3 = array("x" => $var4, "y" => $var5);//end
$smp = findControlPoint($s1, $s2, $s3);
$points = array
(
array( 'x' => $s1['x'], 'y' => $s1['y'] ),
array( 'x' => $smp['x'], 'y' => $smp['y'] ),
array( 'x' => $s3['x'], 'y' => $s3['y'] ),
);
$draw->bezier($points);