Linear Transformations
Scale Transformation
In PHP it can be written as a class LinearTransformation
with implementation of linear transformation operations.
Example of use
<?php
// Example 1: 2x2 matrix (scale transformation)
$transformMatrix = [
[2, 0],
[0, 3]
];
$vector2D = [1, 2];
$transformation2D = new LinearTransformation($transformMatrix);
$result2D = $transformation2D->transform($vector2D);
echo "2D Transformation Result: [<span id='output-vector'>" . implode(", ", $result2D) . "</span>]\n";
Chart:
Result:
Memory: 0.001 Mb
Time running: < 0.001 sec.
2D Transformation Result: [2, 6]