-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
SF
committed
Nov 2, 2009
1 parent
b364122
commit eb84dba
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,25 @@ | |||
use v6; | |||
|
|||
use Vector; | |||
|
|||
class SVGPad | |||
{ | |||
has Vector $.xy_min; | |||
has Vector $.xy_max; | |||
has Vector $.mn_min; | |||
has Vector $.mn_max; | |||
|
|||
multi method new(Vector $xy_min where { $xy_min.Dim == 2 }, | |||
Vector $xy_max where { $xy_max.Dim == 2 }, | |||
Vector $mn_min where { $mn_min.Dim == 2 }, | |||
Vector $mn_max where { $mn_max.Dim == 2 }) | |||
{ | |||
self.bless(*, xy_min => $xy_min, xy_max => $xy_max, mn_min => $mn_min, mn_max => $mn_max); | |||
} | |||
|
|||
multi method xy2mn(Vector $xy where { $xy.Dim == 2 }) | |||
{ | |||
|
|||
|
|||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,17 @@ | |||
use v6; | |||
|
|||
use Test; | |||
use Vector; | |||
use SVGPad; | |||
|
|||
plan *; | |||
|
|||
my $pad = SVGPad.new(Vector.new(-1, 0), Vector.new(1, 3), Vector.new(0, 0), Vector.new(200, 300)); | |||
isa_ok($pad, SVGPad, "Variable is of type SVGPad"); | |||
is_approx($pad.xy_min, Vector.new(-1, 0), "xy_min is correct"); | |||
is_approx($pad.xy_max, Vector.new(1, 3), "xy_max is correct"); | |||
is_approx($pad.mn_min, Vector.new(0, 0), "mn_min is correct"); | |||
is_approx($pad.mn_max, Vector.new(200, 300), "mn_max is correct"); | |||
|
|||
|
|||
done_testing; |