line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Math::SO3; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
740
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
870
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Exporter; |
7
|
|
|
|
|
|
|
require DynaLoader; |
8
|
|
|
|
|
|
|
require AutoLoader; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
@ISA = qw(Exporter DynaLoader); |
11
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
12
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
13
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
14
|
|
|
|
|
|
|
@EXPORT = qw( |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
$VERSION = '0.90'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
bootstrap Math::SO3 $VERSION; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Preloaded methods go here. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub format_matrix |
24
|
|
|
|
|
|
|
{ |
25
|
1
|
|
|
1
|
0
|
8
|
my($self, $how)=@_; |
26
|
1
|
|
|
|
|
2
|
my(@elems); |
27
|
|
|
|
|
|
|
|
28
|
1
|
50
|
|
|
|
5
|
$how="%10.5f" unless defined($how); |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
14
|
@elems=unpack "d9", $$self; |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
45
|
sprintf "[[$how $how $how] [$how $how $how] [$how $how $how]]", @elems; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub format_eigenvector |
36
|
|
|
|
|
|
|
{ |
37
|
3
|
|
|
3
|
0
|
51
|
my($self, $how)=@_; |
38
|
3
|
|
|
|
|
5
|
my($angle, $dir_str, @dir); |
39
|
|
|
|
|
|
|
|
40
|
3
|
50
|
|
|
|
9
|
$how="%10.5f" unless defined($how); |
41
|
|
|
|
|
|
|
|
42
|
3
|
|
|
|
|
37
|
($angle, $dir_str)=$self->turning_angle_and_dir("d"); |
43
|
|
|
|
|
|
|
|
44
|
3
|
50
|
|
|
|
7
|
if(defined($angle)) |
45
|
|
|
|
|
|
|
{ |
46
|
3
|
|
|
|
|
8
|
@dir=unpack "d3", $dir_str; |
47
|
3
|
|
|
|
|
40
|
sprintf "", |
48
|
|
|
|
|
|
|
$angle, @dir; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
else |
51
|
|
|
|
|
|
|
{ |
52
|
0
|
|
|
|
|
0
|
""; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub format_euler_zxz |
57
|
|
|
|
|
|
|
{ |
58
|
0
|
|
|
0
|
0
|
0
|
my($self, $how)=@_; |
59
|
0
|
|
|
|
|
0
|
my($phi, $theta, $psi); |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
0
|
$how="%10.5f" unless defined($how); |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
0
|
($phi, $theta, $psi)=$self->euler_angles_zxz('d'); |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
0
|
sprintf "", |
66
|
|
|
|
|
|
|
$psi, $theta, $phi; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub format_euler_yxz |
71
|
|
|
|
|
|
|
{ |
72
|
1
|
|
|
1
|
0
|
38
|
my($self, $how)=@_; |
73
|
1
|
|
|
|
|
2
|
my($heading, $pitch, $roll); |
74
|
|
|
|
|
|
|
|
75
|
1
|
50
|
|
|
|
7
|
$how="%10.5f" unless defined($how); |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
30
|
($heading, $pitch, $roll)=$self->euler_angles_yxz('d'); |
78
|
|
|
|
|
|
|
|
79
|
1
|
|
|
|
|
15
|
sprintf "", |
80
|
|
|
|
|
|
|
$heading, $pitch, $roll; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub new |
85
|
|
|
|
|
|
|
{ |
86
|
4
|
|
|
4
|
0
|
373
|
my($class, @args)=@_; |
87
|
4
|
|
|
|
|
5
|
my($so3, $x); |
88
|
|
|
|
|
|
|
|
89
|
4
|
100
|
|
|
|
14
|
if($x=ref $class) |
90
|
|
|
|
|
|
|
{ |
91
|
2
|
|
|
|
|
6
|
$so3=\ ($$class.''); # copy-constructor |
92
|
2
|
|
|
|
|
5
|
$class=$x; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
else |
95
|
|
|
|
|
|
|
{ |
96
|
2
|
|
|
|
|
5
|
$so3=\ (pack "d9", 1,0,0, 0,1,0, 0,0,1); |
97
|
|
|
|
|
|
|
} |
98
|
4
|
|
|
|
|
9
|
$|=1; |
99
|
4
|
|
|
|
|
11
|
bless $so3, $class; |
100
|
4
|
|
|
|
|
45
|
$so3->turn(@args); |
101
|
4
|
|
|
|
|
11
|
$so3; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; |
109
|
|
|
|
|
|
|
__END__ |