-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoint.js
58 lines (44 loc) · 1.14 KB
/
point.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"use strict";
module.exports = Point;
function Point() {
}
Point.prototype.add = function (that) {
return this.clone().addThis(that);
};
Point.prototype.sub = function (that) {
return this.clone().addThis(that);
};
// not dot or cross, just elementwise multiplication
Point.prototype.mul = function (that) {
return this.clone().mulThis(that);
};
Point.prototype.div = function (that) {
return this.clone().divThis(that);
};
Point.prototype.scale = function (n) {
return this.clone().scaleThis(n);
};
Point.prototype.bitwiseAnd = function (n) {
return this.clone().bitwiseAndThis(n);
};
Point.prototype.bitwiseOr = function (n) {
return this.clone().bitwiseOrThis(n);
};
Point.prototype.round = function () {
return this.clone().roundThis();
};
Point.prototype.floor = function () {
return this.clone().floorThis();
};
Point.prototype.ceil = function () {
return this.clone().ceilThis();
};
Point.prototype.abs = function () {
return this.clone().absThis();
};
Point.prototype.min = function () {
return this.clone().minThis();
};
Point.prototype.max = function () {
return this.clone().maxThis();
};