forked from FreddieRidell/wren-vector
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.wren
More file actions
57 lines (53 loc) · 1.56 KB
/
example.wren
File metadata and controls
57 lines (53 loc) · 1.56 KB
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
import "./vector" for Vector
var v2 = Vector.new(2.3, -3.4)
var v3 = Vector.new(2.3, -3.4, 4.5)
var v4 = Vector.new(2.3, -3.4, 4.5, 5.6)
System.print("\n\n2D Vector\n=========\n")
System.print( v2 )
System.print( v2.magnitude )
System.print( v2.normalise )
System.print( v2.abs)
System.print( v2.floor)
System.print( v2.ceil)
System.print( v2 + v2 )
System.print( v2 - v2 )
System.print( v2 * v2 )
System.print( v2 / v2 )
System.print( v2 * 2 )
System.print( v2 / 2 )
System.print( v2.dot( Vector.new( 1, 1 ) ) )
System.print( v2 == Vector.new(2.3, -3.4) )
System.print( v2 == Vector.new(1, 1) )
System.print("\n\n3D Vector\n=========\n")
System.print( v3 )
System.print( v3.magnitude )
System.print( v3.normalise )
System.print( v3.abs)
System.print( v3.floor)
System.print( v3.ceil)
System.print( v3 + v3 )
System.print( v3 - v3 )
System.print( v3 * v3 )
System.print( v3 / v3 )
System.print( v3 * 3 )
System.print( v3 / 3 )
System.print( v3.dot( Vector.new( 1, 1, 1 ) ) )
System.print( v3 == Vector.new(2.3, -3.4, 4.5) )
System.print( v3 == Vector.new(1, 1, 1) )
System.print( v3.cross( Vector.new( 1, 1, 1 ) ) )
System.print("\n\n4D Vector\n=========\n")
System.print( v4 )
System.print( v4.magnitude )
System.print( v4.normalise )
System.print( v4.abs)
System.print( v4.floor)
System.print( v4.ceil)
System.print( v4 + v4 )
System.print( v4 - v4 )
System.print( v4 * v4 )
System.print( v4 / v4 )
System.print( v4 * 4 )
System.print( v4 / 4 )
System.print( v4.dot( Vector.new( 1, 1, 1, 1 ) ) )
System.print( v4 == Vector.new(2.3, -3.4, 4.5, 5.6) )
System.print( v4 == Vector.new(1, 1, 1, 1) )