#!/usr/bin/perl -w

use Math::MatrixReal;
$theta = atan2(1,1);    #  45 stopni w radianach

@trojkat = (Math::MatrixReal->new_from_string("[ -1 ]\n[ -1 ]\n"),
             Math::MatrixReal->new_from_string("[  0 ]\n[  1 ]\n"),
             Math::MatrixReal->new_from_string("[  1 ]\n[ -1 ]\n"));

# Tworzymy macierz obrotu.
$obrot = Math::MatrixReal->new_from_string("[ " .
                     cos($theta) . " " .  -sin($theta) . " ]\n" . "[ " .
                     sin($theta) . " " .   cos($theta) . " ]\n");

# Obracamy trojkat o 45 stopni.

foreach (@trojkat) {
    $_ = $obrot * $_;
    print "$_\n";
}
