blib/lib/Math/3Space.pm

filter: Statementstmt 91.6% 33 / 36 Branchbran 16.6% 1 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 100% 1 / 1 totaltotal 82.6% 43 / 52 CC 4 SCAR 13.7
CC
4
Cov
81%
_pdl_project_inplace
12.0
parent
2.1
BEGIN
1.0
CRAP 3.9
« blib/lib/Math/3Space/Projection.pm ↑ Summary blib/lib/Math/3Space/Projection/Frustum.pm »
1 package Math::3Space;
2  
3 8 our $VERSION = '0.008'; # VERSION
4 # ABSTRACT: 3D Coordinate math with an intuitive cross-space mapping API
5  
6 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 8 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 8 require XSLoader;
11 8 XSLoader::load('Math::3Space', $Math::3Space::VERSION);
12  
13 8 ▶use overload '""' => sub {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
14 1 my @vecs = map [$_[0]->$_->xyz], qw(xv yv zv origin);
15 1 "[\n" . join('', map " [@$_]\n", @vecs) . "]\n";
16 8 };
17  
18  
19 8 { package Math::3Space::Exports;
20 8 ▶ use Exporter::Extensible -exporter_setup => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 8 require Math::3Space::Vector;
22 8 require Math::3Space::Projection;
23 8 *vec3= *Math::3Space::Vector::vec3;
24 8 *space= *Math::3Space::space;
25 8 *frustum= *frustum_projection= *Math::3Space::Projection::_frustum;
26 8 *perspective= *perspective_projection= *Math::3Space::Projection::_perspective;
27 8 export qw( vec3 space frustum frustum_projection perspective perspective_projection );
28 }
29 7 ▶sub import { shift; Math::3Space::Exports->import_into(scalar(caller), @_) }
Subroutine import: called CC=1 SCAR=0.0
30  
31 9 ▶sub parent { croak "read-only attribute" if @_ > 1; $_[0]{parent} }
Subroutine parent: called CC=2 SCAR=7.2
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 1 0 9 9
32  
33 # Used by XS to avoid linking directly to PDL. The XS can call out to this perl method to
34 # perform the PDL operations of vector subtraction, matrix multiplication, and vector addition,
35 # all of which are overloaded operators and would be tedious to call from XS.
36 # One single call to this method can operate in parallel on an ndarray of vectors, thanks to
37 # PDL's broadcasting system, so this only gets called once per call to 'project_inplace'.
38 0 ▶sub _pdl_project_inplace {
Subroutine _pdl_project_inplace: not called CC=3 SCAR=24.8
39 0 ▶ $_[0] -= $_[1] if defined $_[1];
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[1] 0 0 0
40 0 $_[0] .= $_[0] x $_[2];
41 0 ▶ $_[0] += $_[3] if defined $_[3];
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[3] 0 0 0
42 }
43  
44 8 1;
45  
46 __END__
« blib/lib/Math/3Space/Projection.pm ↑ Summary blib/lib/Math/3Space/Projection/Frustum.pm »