| 1 | package Math::Geometry::Construction::Types; | ||
| 2 | 17 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 17 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 17 | ▶ | use MooseX::Types -declare => ['ArrayRefOfNum', |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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 | 17 | 'Extension']; | |
| 27 | 17 | ▶ | use MooseX::Types::Moose qw(Num ArrayRef HashRef); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 28 | 17 | ▶ | use MooseX::Types::Structured qw(Tuple); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 29 | |||
| 30 | 17 | ▶ | use 5.008008; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 31 | |||
| 32 | 17 | ▶ | use Math::Vector::Real; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 33 | 17 | ▶ | use Math::VectorReal; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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 | 17 | our $VERSION = '0.024'; | |
| 46 | |||
| 47 | 17 | subtype ArrayRefOfNum, | |
| 48 | as ArrayRef[Num]; | ||
| 49 | |||
| 50 | 17 | class_type Vector, {class => 'Math::Geometry::Construction::Vector'}; | |
| 51 | 17 | class_type MathVectorReal, {class => 'Math::Vector::Real'}; | |
| 52 | 17 | class_type MathVectorReal3D, {class => 'Math::VectorReal'}; | |
| 53 | 17 | class_type Point, {class => 'Math::Geometry::Construction::Point'}; | |
| 54 | 17 | class_type Line, {class => 'Math::Geometry::Construction::Line'}; | |
| 55 | 17 | class_type Circle, {class => 'Math::Geometry::Construction::Circle'}; | |
| 56 | |||
| 57 | # coerce into Math::Vector::Real | ||
| 58 | coerce MathVectorReal, | ||
| 59 | from MathVectorReal3D, | ||
| 60 | 6 | ▶ | via { V($_->x, $_->y) }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 61 | |||
| 62 | coerce MathVectorReal, | ||
| 63 | from ArrayRef[Num], | ||
| 64 | 276 | ▶ | via { V(@$_[0, 1]) }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 65 | |||
| 66 | # coerce into Vector | ||
| 67 | coerce Vector, | ||
| 68 | from ArrayRef[Num], | ||
| 69 | 272 | ▶ | via { Vector->new(vector => $_) }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 70 | |||
| 71 | coerce Vector, | ||
| 72 | from MathVectorReal, | ||
| 73 | 22 | ▶ | via { Vector->new(vector => $_) }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 74 | |||
| 75 | coerce Vector, | ||
| 76 | from MathVectorReal3D, | ||
| 77 | 5 | ▶ | via { Vector->new(vector => $_) }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 78 | |||
| 79 | coerce Vector, | ||
| 80 | from Point, | ||
| 81 | 7 | ▶ | via { Vector->new(point => $_) }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 82 | |||
| 83 | 17 | subtype PointPoint, | |
| 84 | as Tuple[Point, Point]; | ||
| 85 | |||
| 86 | coerce PointPoint, | ||
| 87 | from Line, | ||
| 88 | 4 | ▶ | via { [$_->support] }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 89 | |||
| 90 | coerce Vector, | ||
| 91 | from PointPoint, | ||
| 92 | 0 | ▶ | via { Vector->new(point_point => $_) }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 93 | |||
| 94 | coerce Vector, | ||
| 95 | from Line, | ||
| 96 | 2 | ▶ | via { Vector->new(point_point => $_) }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 97 | |||
| 98 | 17 | class_type Construction, {class => 'Math::Geometry::Construction'}; | |
| 99 | |||
| 100 | 17 | role_type GeometricObject, | |
| 101 | {role => 'Math::Geometry::Construction::Role::Object'}; | ||
| 102 | |||
| 103 | 17 | class_type Derivate, {class => 'Math::Geometry::Construction::Derivate'}; | |
| 104 | 17 | class_type Draw, {class => 'Math::Geometry::Construction::Draw'}; | |
| 105 | |||
| 106 | 17 | subtype HashRefOfGeometricObject, | |
| 107 | as HashRef[GeometricObject]; | ||
| 108 | |||
| 109 | 17 | subtype ArrayRefOfGeometricObject, | |
| 110 | as ArrayRef[GeometricObject]; | ||
| 111 | |||
| 112 | 17 | subtype LineLine, | |
| 113 | as Tuple[Line, Line]; | ||
| 114 | |||
| 115 | 17 | subtype LineCircle, | |
| 116 | as Tuple[Line, Circle]; | ||
| 117 | |||
| 118 | 17 | subtype CircleLine, | |
| 119 | as Tuple[Circle, Line]; | ||
| 120 | |||
| 121 | coerce CircleLine, | ||
| 122 | from LineCircle, | ||
| 123 | 13 | ▶ | via { [$_->[1], $_->[0]] }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 124 | |||
| 125 | 17 | subtype CircleCircle, | |
| 126 | as Tuple[Circle, Circle]; | ||
| 127 | |||
| 128 | 17 | subtype HashRefOfPoint, | |
| 129 | as HashRef[Point]; | ||
| 130 | |||
| 131 | 17 | subtype ArrayRefOfPoint, | |
| 132 | as ArrayRef[Point]; | ||
| 133 | |||
| 134 | coerce Point, | ||
| 135 | from ArrayRefOfPoint, | ||
| 136 | 31 | ▶ | via { $_->[0] }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 137 | |||
| 138 | 17 | subtype ArrayRefOfLine, | |
| 139 | as ArrayRef[Line]; | ||
| 140 | |||
| 141 | coerce Line, | ||
| 142 | from ArrayRefOfLine, | ||
| 143 | 11 | ▶ | via { $_->[0] }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 144 | |||
| 145 | 17 | subtype ArrayRefOfCircle, | |
| 146 | as ArrayRef[Circle]; | ||
| 147 | |||
| 148 | coerce Circle, | ||
| 149 | from ArrayRefOfCircle, | ||
| 150 | 9 | ▶ | via { $_->[0] }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 151 | |||
| 152 | 17 | subtype Extension, | |
| 153 | as ArrayRef[Num]; | ||
| 154 | |||
| 155 | coerce Extension, | ||
| 156 | from Num, | ||
| 157 | 2 | ▶ | via { [$_, $_] }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 158 | |||
| 159 | 17 | 1; | |
| 160 | |||
| 161 | |||
| 162 | __END__ | ||