@mborecki/geo2d 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -75,6 +75,13 @@ export class Vec2 {
|
|
|
75
75
|
add(v: Vec2): Vec2 {
|
|
76
76
|
this.x += v.x;
|
|
77
77
|
this.y += v.y;
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
sub(v: Vec2): Vec2 {
|
|
82
|
+
this.x -= v.x;
|
|
83
|
+
this.y -= v.y;
|
|
84
|
+
return this;
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
eq(v: Vec2): boolean {
|
|
@@ -101,7 +108,11 @@ export class Vec2 {
|
|
|
101
108
|
throw new Error('Wrong Vec2 source');
|
|
102
109
|
}
|
|
103
110
|
|
|
104
|
-
static add(v1: Vec2, v2: Vec2) {
|
|
111
|
+
static add(v1: Vec2, v2: Vec2): Vec2 {
|
|
105
112
|
return new Vec2(v1.x + v2.x, v1.y + v2.y);
|
|
106
113
|
}
|
|
114
|
+
|
|
115
|
+
static sub(v1: Vec2, v2: Vec2): Vec2 {
|
|
116
|
+
return new Vec2(v1.x - v2.x, v1.y - v2.y);
|
|
117
|
+
}
|
|
107
118
|
}
|