NAME
Math::Rotation - Perl class to represent rotations
SYNOPSIS
use Math::Rotation;
my $r = new Math::Rotation; # Make a new unit rotation
# Make a rotation about the axis (0,1,0)
my $r2 = new Math::Rotation([0,1,0], 0.1);
my $r3 = new Math::Rotation(1, 2, 3, 4);
my $fromVector = [1,2,3];
my $toVector = [2,3,4];
my $r4 = new Math::Rotation($fromVector, $toVector);
my $r5 = $r2 * $r3;
my $r6 = ~$r5;
DESCRIPTION =head1 METHODS
- new
-
my $r = new Math::Rotation; # Make a new unit rotation. my $r2 = new Math::Rotation(1,2,3,4); # (x,y,z, angle) my $r3 = new Math::Rotation([1,2,3],4); # (axis, angle) my $r3 = new Math::Rotation([1,2,3],[1,2,3]); # (fromVec, toVec) my $r5 = new_from_quaternion Math::Rotation(new Math::Quaternion);
- setX(x) Sets the first value of the axis vector
- setY(y) Sets the second value of the axis vector
- setZ(z) Sets the third value of the axis vector
- setAxis(x,y,z) Sets axis of rotation from a 3 components @array.
- setAngle(angle) Sets angle of rotation in radiants.
- setAxisAngle(x,y,z, angle) Sets value of rotation from axis angle.
- setQuaternion(Math::Quaternion) Sets value of rotation from a quaternion.
- getX Returns the first value of the axis vector.
- getX Returns the second value of the axis vector.
- getX Returns the third value of the axis vector
- getAxis Returns the axis of rotation as an @array.
- getAngle Returns corresponding 3D rotation angle in radians.
- getAxisAngle Returns corresponding 3D rotation (x, y, z, angle).
- getQuaternion Returns corresponding Math::Quaternion.
- inverse Returns a Math::Rotation object whose value is the inverse of this object's rotation.
- multiply(Math::Rotation) Returns an Math::Rotation whose value is the object multiplied by the passed Math::Rotation.
- multVec(x,y,z) Returns an @array whose value is the 3D vector (x,y,z) multiplied by the matrix corresponding to this object's rotation.
- slerp(destRotation, t) Returns a Math::Rotation object whose value is the spherical linear interpolation between this object's rotation and destRotation at value 0 <= t <= 1. For t = 0, the value is this object's rotation. For t = 1, the value is destRotation.
- stringify Returns a string representation of the rotation. This is used to overload the '""' operator, so that rotations may be freely interpolated in strings.
-
my $q = new Math::Rotation(1,2,3,4); print $q->stringify; # "1 2 3 4" print "$q"; # "1 2 3 4"
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 43:
=over without closing =back