#!/usr/bin/perl -w

use strict;
use geomath;

my @xList = (2, 1, 3, 6, 5, 2);
my @yList = (1, 5, 6, 5, 1, 1);

my $arrLength = scalar(@xList);

print "Question 1\n";
for(my $i = 0; $i < $arrLength; $i++) {
  print scaleXY($xList[$i], $yList[$i], 0.7) . "\n";
}

print "Question 2\n";
for(my $i = 0; $i < $arrLength; $i++) {
  print translateXY($xList[$i], $yList[$i], -3, -2) . "\n";
}

print "Question 3\n";
for(my $i = 0; $i < $arrLength; $i++) {
  print rotateXY($xList[$i], $yList[$i], 90, 0, 0) . "\n";
}

print "Question 4\n";
for(my $i = 0; $i < $arrLength; $i++) {
  print rotateXY($xList[$i], $yList[$i], -30, 2, 2) . "\n";
}

print "Question 5\n";
for(my $i = 0; $i < $arrLength; $i++) {
  my @tmpVal = split /,/, scaleXY($xList[$i], $yList[$i], 0.5);
  print translateXY($tmpVal[0], $tmpVal[1], 3, 2) . "\n";
}

print "Question 6\n";
for(my $i = 0; $i < $arrLength; $i++) {
  my @tmpVal = split /,/, rotateXY($xList[$i], $yList[$i], 15, 0, 0);
  print translateXY($tmpVal[0], $tmpVal[1], 3, 4) . "\n";
}

print "Question 7\n";
for(my $i = 0; $i < $arrLength; $i++) {
  my @tmpVal  = split /,/, scaleXY($xList[$i], $yList[$i], 0.5);
  my @tmpVal2 = split /,/, rotateXY($tmpVal[0], $tmpVal[1], -15, 0, 0);
  print translateXY($tmpVal2[0], $tmpVal2[1], -1, 2) . "\n";
}

print "Question 8\n";
for(my $i = 0; $i < $arrLength; $i++) {
  print scaleXY($xList[$i], $yList[$i], -1) . "\n";
}

print "This is the same result as rotating the polygon by 180\n";
for(my $i = 0; $i < $arrLength; $i++) {
  print rotateXY($xList[$i], $yList[$i], -180, 0, 0) . "\n";
}

print "Question 9a\n";
for(my $i = 0; $i < $arrLength; $i++) {
  print rotateXY($xList[$i], $yList[$i], -340, 0, 0) . "\n";
}

print "This is the same as rotating the polygon by 20 degrees\n";
for(my $i = 0; $i < $arrLength; $i++) {
  print rotateXY($xList[$i], $yList[$i], 20, 0, 0) . "\n";
}

print "Question 9b\n";
for(my $i = 0; $i < $arrLength; $i++) {
  print scaleXY($xList[$i], $yList[$i], 0) . "\n";
}

print "Shift, then scale\n";
for(my $i = 0; $i < $arrLength; $i++) {
  my @tmpVal = split /,/, translateXY($xList[$i], $yList[$i], 3, 4);
  print scaleXY($tmpVal[0], $tmpVal[1], 2) . "\n";
}

print "Scale, then shift\n";
for(my $i = 0; $i < $arrLength; $i++) {
  my @tmpVal = split /,/, scaleXY($xList[$i], $yList[$i], 2);
  print translateXY($tmpVal[0], $tmpVal[1], 3, 4) . "\n";
}


