-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddon.js
41 lines (31 loc) · 940 Bytes
/
addon.js
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
var addon = require('./build/Release/addon');
var Vector2 = addon.Vector2;
console.log("Check addScalar by passing 10, 200");
var vec2 = new Vector2(10, 200);
console.log( vec2.x );
console.log( vec2.y );
console.log("Check addScalar by passing 2.");
vec2.addScalar(2);
console.log( vec2.x );
console.log( vec2.y );
console.log("Check addScalar by passing no argument.");
vec2.addScalar();
console.log( vec2.x );
console.log( vec2.y );
console.log("Check multiplyScalar by passing 2.");
vec2.multiplyScalar(2);
console.log( vec2.x );
console.log( vec2.y );
console.log("Check addScalar by passing no argument.");
vec2.multiplyScalar();
console.log( vec2.x );
console.log( vec2.y );
console.log("Check add by passing vec2(4,5).");
var vec2_1 = new Vector2(4,5);
vec2.add(vec2_1);
console.log( vec2.x );
console.log( vec2.y );
console.log("Check add by passing undefined.");
vec2.add();
console.log( vec2.x );
console.log( vec2.y );