]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blob - lib/LaTeX/TikZ/Set/Circle.pm
Initial commit
[perl/modules/LaTeX-TikZ.git] / lib / LaTeX / TikZ / Set / Circle.pm
1 package LaTeX::TikZ::Set::Circle;
2
3 use strict;
4 use warnings;
5
6 =head1 NAME
7
8 LaTeX::TikZ::Set::Circle - A set object representing a circle.
9
10 =head1 VERSION
11
12 Version 0.01
13
14 =cut
15
16 our $VERSION = '0.01';
17
18 use LaTeX::TikZ::Tools;
19
20 use Any::Moose;
21 use Any::Moose 'Util::TypeConstraints';
22
23 with 'LaTeX::TikZ::Set::Op';
24
25 has 'center' => (
26  is       => 'ro',
27  does     => 'LaTeX::TikZ::Point',
28  required => 1,
29 );
30
31 subtype 'LaTeX::TikZ::Set::Circle::Radius'
32      => as 'Num'
33      => where { LaTeX::TikZ::Tools::numcmp($_, 0) >= 1 }
34      => message { "$_ isn't a non-negative real number" };
35
36 has 'radius' => (
37  is       => 'ro',
38  isa      => 'LaTeX::TikZ::Set::Circle::Radius',
39  required => 1,
40 );
41
42 sub path {
43  my $set  = shift;
44  my $tikz = $_[0];
45
46  $set->center->path(@_) . ' circle (' . $tikz->len($set->radius) . ')';
47 }
48
49 use LaTeX::TikZ::API circle => sub {
50  shift;
51
52  __PACKAGE__->new(center => $_[0], radius => $_[1]);
53 };
54
55 __PACKAGE__->meta->make_immutable;
56
57 =head1 AUTHOR
58
59 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
60
61 You can contact me by mail or on C<irc.perl.org> (vincent).
62
63 =head1 BUGS
64
65 Please report any bugs or feature requests to C<bug-latex-tikz at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=LaTeX-TikZ>.
66 I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
67
68 =head1 SUPPORT
69
70 You can find documentation for this module with the perldoc command.
71
72     perldoc LaTeX::TikZ
73
74 =head1 COPYRIGHT & LICENSE
75
76 Copyright 2010 Vincent Pit, all rights reserved.
77
78 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
79
80 =cut
81
82 1; # End of LaTeX::TikZ::Set::Circle