NAME
Math::Vec2 - Perl class to represent rotations
HIERARCHY
-+- Math::Vec2
SEE ALSO
Math::Color, Math::Image, Math::Vec2, Math::Vec3, Math::Rotation Math::Quaternion
SYNOPSIS
use Math::Vec2;
my $v = new Math::Vec2; # Make a new Vec2
my $v1 = new Math::Vec2(0,1);
DESCRIPTION
METHODS
- new
-
my $v = new Math::Vec2; my $v1 = new Math::Vec2($v); my $v2 = new Math::Vec2(1,2); my $v3 = new Math::Vec2([1,2]); - copy
-
Makes a copy of the rotation
$v2 = $v1->copy; $v2 = new Math::Vec2($v1); - setValue(x,y,z)
-
Sets the value of the vector
$v1->setValue(1,2); - setX(x)
-
Sets the first value of the vector
$v1->setX(1); $v1->x = 1; $v1->[0] = 1; - setY(y)
-
Sets the second value of the vector
$v1->setY(2); $v1->y = 2; $v1->[1] = 2; - getValue
-
Returns the @value of the vector
@v = $v1->getValue; - x
- getX
-
Returns the first value of the vector.
$y = $v1->getX; $y = $v1->x; $y = $v1->[0]; - y
- getY
-
Returns the second value of the vector.
$y = $v1->getY; $y = $v1->y; $y = $v1->[1]; - negate
-
$v = $v1->negate; $v = -$v1; - add(vec2)
-
$v = $v1->add($v2); $v = $v1 + $v2; $v1 += $v2; - subtract(vec2)
-
$v = $v1->subtract($v2); $v = $v1 - $v2; $v1 -= $v2; - multiply(Scalar)
-
$v = $v1->multiply(2); $v = $v1 * 2; $v1 *= 2; - divide(Scalar)
-
$v = $v1->divide(2); $v = $v1 / 2; $v1 /= 2; - dot(vec2)
-
$s = $v1->dot($v2); $s = $v1 . $v2; $s = $v1 . [ 2, 3 ]; - length
-
Returns the length of the vector
$l = $v1->length; - normalize
-
$v = $v1->normalize; - eq(vec2)
-
my $bool = $v1->eq($v2); my $bool = $v1 eq $v2; my $bool = $v1 == $v2; - ne(vec2)
-
my $bool = $v1->ne($v2); my $bool = $v1 ne $v2; my $bool = $v1 != $v2; - stringify
-
Returns a string representation of the vector. This is used to overload the '""' operator, so that vector may be freely interpolated in strings.
my $q = new Math::Vec2(1,2); print $q->stringify; # "1 2" print "$q"; # "1 2"
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 57:
=over without closing =back