Taffeta/Transform/Affine2D/Rotation.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod n/a totaltotal 0.0% 0 / 34 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use Renard::Incunabula::Common::Setup;
2 package Intertangle::Taffeta::Transform::Affine2D::Rotation;
3 # ABSTRACT: A 2D affine rotation
4 $Intertangle::Taffeta::Transform::Affine2D::Rotation::VERSION = '0.001';
5 use Mu;
6 use Intertangle::Yarn::Graphene;
7 use Renard::Incunabula::Common::Types qw(InstanceOf);
8 use Intertangle::Yarn::Types qw(Point AngleDegrees);
9  
10 extends qw(Intertangle::Taffeta::Transform::Affine2D);
11  
12 has angle => (
13 is => 'ro',
14 isa => AngleDegrees,
15 required => 1,
16 );
17  
18 lazy _axis => method() {
19 Intertangle::Yarn::Graphene::Vec3->new(
20 x => 0,
21 y => 0,
22 z => 1
23 );
24 }, isa => InstanceOf['Intertangle::Yarn::Graphene::Vec3'];
25  
26 lazy matrix => method() {
27 my $rot_matrix = Intertangle::Yarn::Graphene::Matrix->new;
28 $rot_matrix->init_rotate( $self->angle, $self->_axis );
29  
30 # Fix rotation to be 2D
31 my $matrix = Intertangle::Yarn::Graphene::Matrix->new;
32 $matrix->init_from_vec4(
33 $rot_matrix->get_row(0),
34 $rot_matrix->get_row(1),
35 Intertangle::Yarn::Graphene::Vec4::z_axis(),
36 $rot_matrix->get_row(3),
37 );
38  
39 $matrix;
40 }, isa => InstanceOf['Intertangle::Yarn::Graphene::Matrix'];
41  
42 1;
43  
44 __END__