line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Math::Geometry::Construction::Derivate::IntersectionCircleLine; |
2
|
1
|
|
|
1
|
|
2291
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
extends 'Math::Geometry::Construction::Derivate'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use 5.008008; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Math::Geometry::Construction::Types qw(CircleLine); |
8
|
|
|
|
|
|
|
use Carp; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
C<Math::Geometry::Construction::Derivate::IntersectionCircleLine> - circle line intersection |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Version 0.024 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.024'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
########################################################################### |
24
|
|
|
|
|
|
|
# # |
25
|
|
|
|
|
|
|
# Accessors # |
26
|
|
|
|
|
|
|
# # |
27
|
|
|
|
|
|
|
########################################################################### |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has 'input' => (isa => CircleLine, |
30
|
|
|
|
|
|
|
coerce => 1, |
31
|
|
|
|
|
|
|
is => 'bare', |
32
|
|
|
|
|
|
|
traits => ['Array'], |
33
|
|
|
|
|
|
|
required => 1, |
34
|
|
|
|
|
|
|
handles => {count_input => 'count', |
35
|
|
|
|
|
|
|
input => 'elements', |
36
|
|
|
|
|
|
|
single_input => 'accessor'}); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
########################################################################### |
39
|
|
|
|
|
|
|
# # |
40
|
|
|
|
|
|
|
# Retrieve Data # |
41
|
|
|
|
|
|
|
# # |
42
|
|
|
|
|
|
|
########################################################################### |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub calculate_positions { |
45
|
|
|
|
|
|
|
my ($self) = @_; |
46
|
|
|
|
|
|
|
my ($circle, $line) = $self->input; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $c_center_p = $circle->center->position; |
49
|
|
|
|
|
|
|
my $c_radius = $circle->radius; |
50
|
|
|
|
|
|
|
my @l_support_p = map { $_->position } $line->support; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
foreach($c_center_p, $c_radius, @l_support_p) { |
53
|
|
|
|
|
|
|
return if(!defined($_)); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $l_parallel = $line->parallel or return; |
57
|
|
|
|
|
|
|
my $l_normal = $line->normal; |
58
|
|
|
|
|
|
|
my $l_constant = $l_normal * $l_support_p[0]; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my $a = $l_normal * $c_center_p - $l_constant; |
61
|
|
|
|
|
|
|
my $rad = $c_radius ** 2 - $a ** 2; |
62
|
|
|
|
|
|
|
return if($rad < 0); |
63
|
|
|
|
|
|
|
my $b = sqrt($rad); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
return($c_center_p - $l_normal * $a - $l_parallel * $b, |
66
|
|
|
|
|
|
|
$c_center_p - $l_normal * $a + $l_parallel * $b); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
########################################################################### |
70
|
|
|
|
|
|
|
# # |
71
|
|
|
|
|
|
|
# Change Data # |
72
|
|
|
|
|
|
|
# # |
73
|
|
|
|
|
|
|
########################################################################### |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub register_derived_point { |
76
|
|
|
|
|
|
|
my ($self, $point) = @_; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
foreach($self->input) { $_->register_point($point) } |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=pod |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SYNOPSIS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 DESCRIPTION |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 INTERFACE |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 Public Attributes |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 Methods for Users |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 Methods for Subclass Developers |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 AUTHOR |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Lutz Gehlen, C<< <perl at lutzgehlen.de> >> |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Copyright 2011, 2013 Lutz Gehlen. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
113
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
114
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |
120
|
|
|
|
|
|
|
|