@gitborlando/geo 3.0.0 → 3.1.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.
- package/CHANGELOG.md +7 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +7 -0
- package/package.json +1 -1
- package/src/xy.ts +9 -0
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -221,6 +221,14 @@ declare class XY {
|
|
|
221
221
|
getDot(another: IXY): number;
|
|
222
222
|
getDistance(another: IXY): number;
|
|
223
223
|
getAngle(another: IXY, origin: IXY): number;
|
|
224
|
+
primitive(): {
|
|
225
|
+
x: number;
|
|
226
|
+
y: number;
|
|
227
|
+
};
|
|
228
|
+
static _(x?: number, y?: number): {
|
|
229
|
+
x: number;
|
|
230
|
+
y: number;
|
|
231
|
+
};
|
|
224
232
|
static of(x: number, y: number): XY;
|
|
225
233
|
static from(xy: IXY): XY;
|
|
226
234
|
static center(xy: {
|
package/dist/index.js
CHANGED
|
@@ -185,10 +185,17 @@ var XY = class _XY {
|
|
|
185
185
|
Math.atan2(this.y - origin.y, this.x - origin.x) - Math.atan2(another.y - origin.y, another.x - origin.x)
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
|
+
primitive() {
|
|
189
|
+
return { x: this.x, y: this.y };
|
|
190
|
+
}
|
|
191
|
+
static _(x = 0, y = 0) {
|
|
192
|
+
return { x, y };
|
|
193
|
+
}
|
|
188
194
|
static of(x, y) {
|
|
189
195
|
return new _XY(x, y);
|
|
190
196
|
}
|
|
191
197
|
static from(xy) {
|
|
198
|
+
if (xy instanceof _XY) return xy;
|
|
192
199
|
return _XY.of(xy.x, xy.y);
|
|
193
200
|
}
|
|
194
201
|
static center(xy) {
|
package/package.json
CHANGED
package/src/xy.ts
CHANGED
|
@@ -148,11 +148,20 @@ export class XY {
|
|
|
148
148
|
)
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
primitive() {
|
|
152
|
+
return { x: this.x, y: this.y }
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static _(x: number = 0, y: number = 0) {
|
|
156
|
+
return { x, y }
|
|
157
|
+
}
|
|
158
|
+
|
|
151
159
|
static of(x: number, y: number) {
|
|
152
160
|
return new XY(x, y)
|
|
153
161
|
}
|
|
154
162
|
|
|
155
163
|
static from(xy: IXY) {
|
|
164
|
+
if (xy instanceof XY) return xy
|
|
156
165
|
return XY.of(xy.x, xy.y)
|
|
157
166
|
}
|
|
158
167
|
|