Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2011-09-01 23:06:28 +0400
committerAlessandro Ranellucci <aar@cpan.org>2011-09-01 23:06:28 +0400
commit55a523e1fa597923a4827c88378fb48b809367d0 (patch)
tree79a41aeb2abd0e1f5786dbf5bcb3282bf949dd20 /lib/Slic3r/Point.pm
Initial import
Diffstat (limited to 'lib/Slic3r/Point.pm')
-rw-r--r--lib/Slic3r/Point.pm41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/Slic3r/Point.pm b/lib/Slic3r/Point.pm
new file mode 100644
index 000000000..3f981a831
--- /dev/null
+++ b/lib/Slic3r/Point.pm
@@ -0,0 +1,41 @@
+package Slic3r::Point;
+use Moose;
+use Moose::Util::TypeConstraints;
+
+subtype 'Slic3r::Point::Coordinate', as 'Int';
+coerce 'Slic3r::Point::Coordinate', from 'Num', via { sprintf '%.0f', $_ };
+
+has 'x' => (
+ is => 'ro',
+ isa => 'Slic3r::Point::Coordinate',
+ required => 1,
+ coerce => 1,
+);
+
+has 'y' => (
+ is => 'ro',
+ isa => 'Slic3r::Point::Coordinate',
+ required => 1,
+ coerce => 1,
+);
+
+# this array contains weak references, so it can contain undef's as well
+has 'lines' => (
+ is => 'rw',
+ isa => 'ArrayRef[Slic3r::Line]',
+ default => sub { [] },
+);
+
+sub id {
+ my $self = shift;
+ return $self->x . "," . $self->y; #;;
+}
+
+sub coincides_with {
+ my $self = shift;
+ my ($point) = @_;
+
+ return $self->x == $point->x && $self->y == $point->y; #=
+}
+
+1;