-
Notifications
You must be signed in to change notification settings - Fork 1
/
playing-around.pl
62 lines (53 loc) · 1.19 KB
/
playing-around.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use v6;
BEGIN { @*INC.push: 'lib' }
use Vector;
use Polynomial;
use KnotVector;
my Vector $v1 = Vector.new(1,2,3);
my Vector $v2 = Vector.new(3,4,5);
say $v1;
say $v2;
say $v1 + $v2;
say $v1 - $v2;
say -$v2;
say $v1 ⋅ $v2;
say $v1 dot $v2;
say $v1 × $v2;
say $v1 cross $v2;
say $v1.Length;
say ⎡$v1⎤;
say $v1.Unitize;
$v1 += $v2;
say $v1;
say " ";
my Vector $v7 = Vector.new(1,2,3,4,5,6,7);
my Vector $v8 = Vector.new(0,1,0,1,0,1,0);
say $v7;
say $v8;
say $v7 + $v8;
say $v7 × $v8;
say $v7 dot ($v7 × $v8);
say $v8 dot ($v7 × $v8);
my $vs = Vector.new(1, 1, 1);
say $vs.Unitize;
my $p = Polynomial.new(1.0, 2.0, 3.0);
say $p.perl;
say $p;
say $p.evaluate(0.0);
say $p.evaluate(0.5);
say $p.evaluate(1.0);
my $p2 = Polynomial.new(0.0, 0.0, 3.0, 5.0, 6.0);
say $p + $p2;
say $p + 3;
say 5 + $p;
my $p3 = Polynomial.new();
say $p3;
say $p * Polynomial.new(0.0, 1.0);
say $p * $p;
my KnotVector $kv = KnotVector.new((0, 0, 0, 0, 1, 2, 2, 3, 3, 3, 3));
say $kv.N(3, 1/2).perl;
my @polys = $kv.N_local($kv.N0_index(1/2), 3, Polynomial.new(0, 1));
@polys.map({ $_.say });
@polys.map({ $_.evaluate(1/2).perl.say });
my Vector $vcrazy = Vector.new(Vector.new(1, 2, 3), Vector.new(-1, 0, -1));
say 23.3 * $vcrazy;