<commit_before><?php
include("tinyspline.php");

// Create a clamped spline of degree 3 in 2D consisting of 7 control points.
$spline = new BSpline(3, 2, 7, TS_CLAMPED);

// Setup the control points.
$ctrlp = $spline->ctrlp();
$ctrlp[0]  = -1.75; // x0
$ctrlp[1]  = -1.0;  // y0
$ctrlp[2]  = -1.5;  // x1
$ctrlp[3]  = -0.5;  // y1
$ctrlp[4]  = -1.5;  // x2
$ctrlp[5]  =  0.0;  // y2
$ctrlp[6]  = -1.25; // x3
$ctrlp[7]  =  0.5;  // y3
$ctrlp[8]  = -0.75; // x4
$ctrlp[9]  =  0.75; // y4
$ctrlp[10] =  0.0;  // x5
$ctrlp[11] =  0.5;  // y5
$ctrlp[12] =  0.5;  // x6
$ctrlp[13] =  0.0;  // y6
$spline->setCtrlp($ctrlp);

// Evaluate `spline` at u = 0.4
$result = $spline->evaluate(0.4)->result();
echo "x = $result[0], y = $result[1]\n";

// Derive `spline` and subdivide it into a sequence of Bezier curves.
$beziers = $spline->derive()->toBeziers();

// Evaluate `beziers` at u = 0.3
$result = $beziers->evaluate(0.3)->result(); // PHP does not support the operator '()'
echo "x = $result[0], y = $result[1]\n";
?><commit_msg>Adepted PHP example to new getter setter approach.<commit_after><?php
include("tinyspline.php");

// Create a clamped spline of degree 3 in 2D consisting of 7 control points.
$spline = new BSpline(3, 2, 7, TS_CLAMPED);

// Setup the control points.
$ctrlp = $spline->ctrlp;
$ctrlp[0]  = -1.75; // x0
$ctrlp[1]  = -1.0;  // y0
$ctrlp[2]  = -1.5;  // x1
$ctrlp[3]  = -0.5;  // y1
$ctrlp[4]  = -1.5;  // x2
$ctrlp[5]  =  0.0;  // y2
$ctrlp[6]  = -1.25; // x3
$ctrlp[7]  =  0.5;  // y3
$ctrlp[8]  = -0.75; // x4
$ctrlp[9]  =  0.75; // y4
$ctrlp[10] =  0.0;  // x5
$ctrlp[11] =  0.5;  // y5
$ctrlp[12] =  0.5;  // x6
$ctrlp[13] =  0.0;  // y6
$spline->ctrlp = $ctrlp;

// Evaluate `spline` at u = 0.4
$result = $spline->evaluate(0.4)->result;
echo "x = $result[0], y = $result[1]\n";

// Derive `spline` and subdivide it into a sequence of Bezier curves.
$beziers = $spline->derive()->toBeziers();

// Evaluate `beziers` at u = 0.3
$result = $beziers->evaluate(0.3)->result; // PHP does not support the operator '()'
echo "x = $result[0], y = $result[1]\n";
?>
{'fraction_non_alphanumeric': 0.23546371936568958, 'fraction_numerical': 0.07880826525708794, 'mean_word_length': 2.7649186256781193, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '330381', 'n_tokens_mistral': 1027, 'n_tokens_neox': 994, 'n_words': 236}