# this works as a bash include
#
#PRIO 1.1
#COMM test Math::Geomet2dPoint
#COMM - try attribute methods
#COMM - perform arithmetics via methods
#
perl -e '
  use lib shift();  # give include precedence to code directory, perl -I would not work!
  use strict;
  use Math::Geomet2dPoint;
  my ($pVec,$pVec2);
  $pVec = Math::Geomet2dPoint->new(0.3, 1.5)
    or die "Math::GeometNdPoint construction failed";
  printf "vector as string: %s\n", $pVec->string(-fmt=>q(vector(%.1f,%.1f)));
  printf "vector amount: %.3f\n", $pVec->amount();
  $pVec2 = $pVec->norm_direct();
  printf "vector direction (non-mutating): %s, amount %.2f\n",
    $pVec2->string(-fmt=>q(vector(%.2f,%.2f))), $pVec2->amount();
  printf "vector control: %s\n", $pVec->string(-fmt=>q(vector(%.1f,%.1f)));
  $pVec2 = $pVec->clone()->stretch(2.0);
  printf "vector stretched (copy): %s\n",
    $pVec2->string(-fmt=>q(vector(%.1f,%.1f)));
  printf "vector control: %s\n", $pVec->string(-fmt=>q(vector(%.1f,%.1f)));
  $pVec2->stretch(2.0);
  printf "vector copy stretched again (mutated): %s\n",
    $pVec2->string(-fmt=>q(vector(%.1f,%.1f)));
  ' -- "$dircode"
