Vector::Object3D::Matrix::Transform - construction of graphical transformation matrices
package Vector::Object3D::Matrix; use Readonly; Readonly my $pi => 3.14159; use Moose; with 'Vector::Object3D::Matrix::Transform'; # Calling any method from this role results in creating an instance of the given class: my $class = 'Vector::Object3D::Matrix'; # Construct rotation matrix on a 2D plane: my $rotateMatrix2D = $class->get_rotation_matrix( rotate_xy => (30 * $pi / 180), ); # Construct scaling matrix on a 2D plane: my $scaleMatrix2D = $class->get_scaling_matrix( scale_x => 2, scale_y => 2, ); # Construct translation matrix on a 2D plane: my $translateMatrix2D = $class->get_translation_matrix( shift_x => -2, shift_y => 1, ); # Construct rotation matrix in a 3D space: my $rotateMatrix3D = $class->get_rotation_matrix( rotate_xy => (30 * $pi / 180), rotate_yz => -30 * ($pi / 180), rotate_xz => 45 * ($pi / 180), ); # Construct scaling matrix in a 3D space: my $scaleMatrix3D = $class->get_scaling_matrix( scale_x => 2, scale_y => 2, scale_z => 3, ); # Construct translation matrix in a 3D space: my $translateMatrix3D = $class->get_translation_matrix( shift_x => -2, shift_y => 1, shift_z => 3, );
Vector::Object3D::Matrix::Transform is a Moose role that is meant to be applied to Vector::Object3D::Matrix class in order to provide it with additional methods supporting construction of graphical transformation matrices, which currently handle rotation, scaling and translation functionalities.
Vector::Object3D::Matrix::Transform
Vector::Object3D::Matrix
Construct rotation matrix on a 2D plane:
my $rotateMatrix2D = $class->get_rotation_matrix( rotate_xy => (30 * $pi / 180), );
Construct rotation matrix in a 3D space:
my $rotateMatrix3D = $class->get_rotation_matrix( rotate_xy => (30 * $pi / 180), rotate_yz => -30 * ($pi / 180), rotate_xz => 45 * ($pi / 180), );
Construct scaling matrix on a 2D plane:
my $scaleMatrix2D = $class->get_scaling_matrix( scale_x => 2, scale_y => 2, );
Construct scaling matrix in a 3D space:
my $scaleMatrix3D = $class->get_scaling_matrix( scale_x => 2, scale_y => 2, scale_z => 3, );
Construct translation matrix on a 2D plane:
my $translateMatrix2D = $class->get_translation_matrix( shift_x => -2, shift_y => 1, );
Construct translation matrix in a 3D space:
my $translateMatrix3D = $class->get_translation_matrix( shift_x => -2, shift_y => 1, shift_z => 3, );
There are no known bugs at the moment. Please report any bugs or feature requests.
Vector::Object3D::Matrix::Transform exports nothing neither by default nor explicitly.
Math::VectorReal, Vector::Object3D::Matrix.
Pawel Krol, <pawelkrol@cpan.org>.
Version 0.01 (2012-12-24)
Copyright (C) 2012 by Pawel Krol.
This library is free open source software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
PLEASE NOTE THAT IT COMES WITHOUT A WARRANTY OF ANY KIND!
To install Vector::Object3D, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Vector::Object3D
CPAN shell
perl -MCPAN -e shell install Vector::Object3D
For more information on module installation, please visit the detailed CPAN module installation guide.