line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Math::Geometry::Construction::Types; |
2
|
1
|
|
|
1
|
|
24516
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
71
|
|
4
|
0
|
|
|
|
|
|
use MooseX::Types -declare => ['ArrayRefOfNum', |
5
|
|
|
|
|
|
|
'Vector', |
6
|
|
|
|
|
|
|
'MathVectorReal', |
7
|
|
|
|
|
|
|
'MathVectorReal3D', |
8
|
|
|
|
|
|
|
'Point', |
9
|
|
|
|
|
|
|
'Line', |
10
|
|
|
|
|
|
|
'Circle', |
11
|
|
|
|
|
|
|
'Construction', |
12
|
|
|
|
|
|
|
'GeometricObject', |
13
|
|
|
|
|
|
|
'Derivate', |
14
|
|
|
|
|
|
|
'Draw', |
15
|
|
|
|
|
|
|
'HashRefOfGeometricObject', |
16
|
|
|
|
|
|
|
'ArrayRefOfGeometricObject', |
17
|
|
|
|
|
|
|
'PointPoint', |
18
|
|
|
|
|
|
|
'LineLine', |
19
|
|
|
|
|
|
|
'LineCircle', |
20
|
|
|
|
|
|
|
'CircleLine', |
21
|
|
|
|
|
|
|
'CircleCircle', |
22
|
|
|
|
|
|
|
'HashRefOfPoint', |
23
|
|
|
|
|
|
|
'ArrayRefOfPoint', |
24
|
|
|
|
|
|
|
'ArrayRefOfLine', |
25
|
|
|
|
|
|
|
'ArrayRefOfCircle', |
26
|
1
|
|
|
1
|
|
420
|
'Extension']; |
|
0
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use MooseX::Types::Moose qw(Num ArrayRef HashRef); |
28
|
|
|
|
|
|
|
use MooseX::Types::Structured qw(Tuple); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
use 5.008008; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use Math::Vector::Real; |
33
|
|
|
|
|
|
|
use Math::VectorReal; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 NAME |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
C<Math::Geometry::Construction::Types> - custom types for Math::Geometry::Construction |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 VERSION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Version 0.024 |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
our $VERSION = '0.024'; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
subtype ArrayRefOfNum, |
48
|
|
|
|
|
|
|
as ArrayRef[Num]; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
class_type Vector, {class => 'Math::Geometry::Construction::Vector'}; |
51
|
|
|
|
|
|
|
class_type MathVectorReal, {class => 'Math::Vector::Real'}; |
52
|
|
|
|
|
|
|
class_type MathVectorReal3D, {class => 'Math::VectorReal'}; |
53
|
|
|
|
|
|
|
class_type Point, {class => 'Math::Geometry::Construction::Point'}; |
54
|
|
|
|
|
|
|
class_type Line, {class => 'Math::Geometry::Construction::Line'}; |
55
|
|
|
|
|
|
|
class_type Circle, {class => 'Math::Geometry::Construction::Circle'}; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# coerce into Math::Vector::Real |
58
|
|
|
|
|
|
|
coerce MathVectorReal, |
59
|
|
|
|
|
|
|
from MathVectorReal3D, |
60
|
|
|
|
|
|
|
via { V($_->x, $_->y) }; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
coerce MathVectorReal, |
63
|
|
|
|
|
|
|
from ArrayRef[Num], |
64
|
|
|
|
|
|
|
via { V(@$_[0, 1]) }; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# coerce into Vector |
67
|
|
|
|
|
|
|
coerce Vector, |
68
|
|
|
|
|
|
|
from ArrayRef[Num], |
69
|
|
|
|
|
|
|
via { Vector->new(vector => $_) }; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
coerce Vector, |
72
|
|
|
|
|
|
|
from MathVectorReal, |
73
|
|
|
|
|
|
|
via { Vector->new(vector => $_) }; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
coerce Vector, |
76
|
|
|
|
|
|
|
from MathVectorReal3D, |
77
|
|
|
|
|
|
|
via { Vector->new(vector => $_) }; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
coerce Vector, |
80
|
|
|
|
|
|
|
from Point, |
81
|
|
|
|
|
|
|
via { Vector->new(point => $_) }; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
subtype PointPoint, |
84
|
|
|
|
|
|
|
as Tuple[Point, Point]; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
coerce PointPoint, |
87
|
|
|
|
|
|
|
from Line, |
88
|
|
|
|
|
|
|
via { [$_->support] }; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
coerce Vector, |
91
|
|
|
|
|
|
|
from PointPoint, |
92
|
|
|
|
|
|
|
via { Vector->new(point_point => $_) }; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
coerce Vector, |
95
|
|
|
|
|
|
|
from Line, |
96
|
|
|
|
|
|
|
via { Vector->new(point_point => $_) }; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
class_type Construction, {class => 'Math::Geometry::Construction'}; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
role_type GeometricObject, |
101
|
|
|
|
|
|
|
{role => 'Math::Geometry::Construction::Role::Object'}; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
class_type Derivate, {class => 'Math::Geometry::Construction::Derivate'}; |
104
|
|
|
|
|
|
|
class_type Draw, {class => 'Math::Geometry::Construction::Draw'}; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
subtype HashRefOfGeometricObject, |
107
|
|
|
|
|
|
|
as HashRef[GeometricObject]; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
subtype ArrayRefOfGeometricObject, |
110
|
|
|
|
|
|
|
as ArrayRef[GeometricObject]; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
subtype LineLine, |
113
|
|
|
|
|
|
|
as Tuple[Line, Line]; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
subtype LineCircle, |
116
|
|
|
|
|
|
|
as Tuple[Line, Circle]; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
subtype CircleLine, |
119
|
|
|
|
|
|
|
as Tuple[Circle, Line]; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
coerce CircleLine, |
122
|
|
|
|
|
|
|
from LineCircle, |
123
|
|
|
|
|
|
|
via { [$_->[1], $_->[0]] }; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
subtype CircleCircle, |
126
|
|
|
|
|
|
|
as Tuple[Circle, Circle]; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
subtype HashRefOfPoint, |
129
|
|
|
|
|
|
|
as HashRef[Point]; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
subtype ArrayRefOfPoint, |
132
|
|
|
|
|
|
|
as ArrayRef[Point]; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
coerce Point, |
135
|
|
|
|
|
|
|
from ArrayRefOfPoint, |
136
|
|
|
|
|
|
|
via { $_->[0] }; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
subtype ArrayRefOfLine, |
139
|
|
|
|
|
|
|
as ArrayRef[Line]; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
coerce Line, |
142
|
|
|
|
|
|
|
from ArrayRefOfLine, |
143
|
|
|
|
|
|
|
via { $_->[0] }; |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
subtype ArrayRefOfCircle, |
146
|
|
|
|
|
|
|
as ArrayRef[Circle]; |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
coerce Circle, |
149
|
|
|
|
|
|
|
from ArrayRefOfCircle, |
150
|
|
|
|
|
|
|
via { $_->[0] }; |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
subtype Extension, |
153
|
|
|
|
|
|
|
as ArrayRef[Num]; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
coerce Extension, |
156
|
|
|
|
|
|
|
from Num, |
157
|
|
|
|
|
|
|
via { [$_, $_] }; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
1; |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
__END__ |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=pod |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 AUTHOR |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Lutz Gehlen, C<< <perl at lutzgehlen.de> >> |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Copyright 2011-2013 Lutz Gehlen. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
176
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
177
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=cut |
183
|
|
|
|
|
|
|
|