1. Go to this page and download the library: Download nessworthy/decasteljau library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nessworthy / decasteljau example snippets
use Nessworthy\DeCasteljau\CubicBezierCurve;
use Nessworthy\DeCasteljau\Point;
$curve = new CubicBezierCurve(
new Point(0, 0), // Your start point.
new Point(75, 0), // The first curve point.
new Point(150, 75), // The second curve point.
new Point(150, 150) // Your finishing point.
);
// Calculate control points for the third quarter of the original curve.
$curveSegment = $curve->getSegment(0.5, 0.75); // Instance of CubicBezierCurve
// Useful for calculating SVG bezier paths!
echo 'M' . $curveSegment->getControlPoint1()->x() . ' ' . $curveSegment->getControlPoint1()->y();
echo ' C' . $curveSegment->getControlPoint2()->x() . ' ' . $curveSegment->getControlPoint2()->y();
echo ', ' . $curveSegment->getControlPoint3()->x() . ' ' . $curveSegment->getControlPoint3()->y();
echo ', ' . $curveSegment->getControlPoint4()->x() . ' ' . $curveSegment->getControlPoint4()->y();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.