<?php

require('./Shapes.php');


echo "Point Tests", PHP_EOL;
echo "Initialize: ", PHP_EOL;
$point = new Point(new Coordinate(2, 2));
echo $point, PHP_EOL;

echo "Translate by [0, 2]: ", PHP_EOL;
$point->translate(new Coordinate(0, 2));
echo $point, PHP_EOL;

echo "Translate by [0, -2]: ", PHP_EOL;
$point->translate(new Coordinate(0, -2));
echo $point, PHP_EOL;

echo "Translate by [2, 0]: ", PHP_EOL;
$point->translate(new Coordinate(2, 0));
echo $point, PHP_EOL;

echo "Scale by 50%: ", PHP_EOL;
$point->scale(0.5);
echo $point, PHP_EOL;

echo "Scale by 200%: ", PHP_EOL;
$point->scale(2);
echo $point, PHP_EOL;



echo PHP_EOL, "Circle Tests", PHP_EOL;

$circle = new Circle($point->getOrigin(), 2);
echo $circle, PHP_EOL;

echo "Translate by [-2, 0]: ", PHP_EOL;
$circle->translate(new Coordinate(-2, 0));
echo $circle, PHP_EOL;

echo "Translate by [0, 2]: ", PHP_EOL;
$circle->translate(new Coordinate(0, 2));
echo $circle, PHP_EOL;

echo "Translate by [3, -3]: ", PHP_EOL;
$circle->translate(new Coordinate(3, -3));
echo $circle, PHP_EOL;

echo "Scale by 250%: ", PHP_EOL;
$circle->scale(2.5);
echo $circle, PHP_EOL;

echo "Scale by 200%: ", PHP_EOL;
$circle->scale(2);
echo $circle, PHP_EOL;

echo "Scale by 20%: ", PHP_EOL;
$circle->scale(0.2);
echo $circle, PHP_EOL;



echo PHP_EOL, "Polygon (Square) Tests", PHP_EOL;

//Square without initial coordinate
echo "Initialize: ", PHP_EOL;
$square = new Polygon([
    new Coordinate(0, 0),
    new Coordinate(1, 0),
    new Coordinate(1, 1),
    new Coordinate(0, 1),
    new Coordinate(0, 0),
]);
echo $square, PHP_EOL;

echo "Translate by [2, 2]: ", PHP_EOL;
$square->translate(new Coordinate(2, 2));
echo $square, PHP_EOL;


echo "Translate by [-3, 0]: ", PHP_EOL;
$square->translate(new Coordinate(-3, 0));
echo $square, PHP_EOL;

echo "Translate by [1, -3]: ", PHP_EOL;
$square->translate(new Coordinate(1, -3));
echo $square, PHP_EOL;

echo "Scale by 400%: ", PHP_EOL;
$square->scale(4);
echo $square, PHP_EOL;


echo "Scale by 50%: ", PHP_EOL;
$square->scale(0.5);
echo $square, PHP_EOL;

echo PHP_EOL, "Polygon (triangle) Tests", PHP_EOL;



//Triangle with initial coordinates
echo "Initialize: ", PHP_EOL;
$triangle = new Polygon([
    new Coordinate(0, 0),
    new Coordinate(1, 0),
    new Coordinate(0, 1),
    new Coordinate(0, 0)
], new Coordinate(2, 3));
echo $triangle, PHP_EOL;

echo "Scale by 300%", PHP_EOL;
$triangle->scale(3);
echo $triangle, PHP_EOL;


echo "Translate by [-5, -5]: ", PHP_EOL;
$triangle->translate(new Coordinate(-5, -5));
echo $triangle, PHP_EOL;

echo "Translate by [3, 0]: ", PHP_EOL;
$triangle->translate(new Coordinate(3, 0));
echo $triangle, PHP_EOL;

echo "Scale by 50%, introduce fractional positions", PHP_EOL;
$triangle->scale(0.5);
echo $triangle, PHP_EOL;

echo "Translate by [0, 2]: ", PHP_EOL;
$triangle->translate(new Coordinate(0, 2));
echo $triangle, PHP_EOL;

