@gitborlando/geo 4.1.1 → 5.2.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/dist/index.d.ts CHANGED
@@ -46,8 +46,17 @@ declare class OBB {
46
46
  x: number;
47
47
  y: number;
48
48
  }];
49
+ plain: () => {
50
+ x: number;
51
+ y: number;
52
+ width: number;
53
+ height: number;
54
+ rotation: number;
55
+ center: IXY;
56
+ };
49
57
  clone: () => OBB;
50
- projectionLengthAt: (anotherAxis: IXY) => number;
58
+ shift: (delta: IXY) => this;
59
+ projectAt: (anotherAxis: IXY) => number;
51
60
  collide: (another: OBB) => boolean;
52
61
  static identityOBB(): OBB;
53
62
  static fromRect(rect: IRect, rotation?: number): OBB;
@@ -63,180 +72,62 @@ declare class AABB {
63
72
  constructor(minX: number, minY: number, maxX: number, maxY: number);
64
73
  static rect(aabb: AABB): IRectWithCenter;
65
74
  static rectTuple(aabb: AABB): readonly [number, number, number, number];
75
+ static update(aabb: AABB, minX: number, minY: number, maxX: number, maxY: number): AABB;
76
+ static updateFromRect(aabb: AABB, rect: IRect): AABB;
77
+ static shift(aabb: AABB, delta: IXY): AABB;
66
78
  static collide(one: AABB, another: AABB): boolean;
67
79
  static include(one: AABB, another: AABB): number;
68
80
  static extend(aabb: AABB, ...expands: [number] | [number, number, number, number]): AABB;
69
- static merge(...aabbList: AABB[]): AABB;
81
+ static merge(aabbList: AABB[] | Set<AABB>): AABB;
70
82
  static fromOBB(obb: OBB): AABB;
83
+ static updateFromOBB(aabb: AABB, obb: OBB): AABB;
71
84
  }
72
85
 
73
- declare const PI: number;
74
- declare const cos: (x: number) => number;
75
- declare const sin: (x: number) => number;
76
- declare const tan: (x: number) => number;
77
- declare const acos: (x: number) => number;
78
- declare const asin: (x: number) => number;
79
- declare const atan: (x: number) => number;
80
- declare const atan2: (y: number, x: number) => number;
81
86
  declare class Angle {
82
87
  static cos(angle: number): number;
83
88
  static sin(angle: number): number;
89
+ static cosSin(angle: number): {
90
+ cos: number;
91
+ sin: number;
92
+ };
84
93
  static tan(angle: number): number;
85
- static acos(angle: number): number;
86
- static asin(angle: number): number;
87
- static atan(angle: number): number;
88
94
  static atan2(y: number, x: number): number;
89
95
  static angleFy(radians: number): number;
90
96
  static radianFy(angle: number): number;
91
97
  static normal(angle: number): number;
98
+ static minor(angle: number): number;
92
99
  static snap(angle: number, step?: number): number;
93
- static rotatePoint(ax: number, ay: number, ox: number, oy: number, angle: number): {
94
- x: number;
95
- y: number;
96
- };
100
+ static sweep(v1: IXY, v2?: IXY, clockwise?: boolean): number;
97
101
  }
98
102
 
99
- declare const sqrt: (x: number) => number;
100
- declare const abs: (x: number) => number;
101
- declare const min: (...values: number[]) => number;
102
- declare const max: (...values: number[]) => number;
103
- declare const round: (x: number) => number;
104
- declare const floor: (x: number) => number;
105
- declare const ceil: (x: number) => number;
106
- declare const random: () => number;
107
- declare function pow2(number: number): number;
108
- declare function pow3(number: number): number;
109
- declare function multiply(...numbers: number[]): number;
110
- declare function divide(a: number, b: number): number;
111
- declare function numberHalfFix(number: number): number;
112
103
  declare function twoDecimal(number: number): number;
104
+ declare function minMax(val: number, min: number, max: number): number;
113
105
 
114
- type IMatrix = [number, number, number, number, number, number];
115
- declare class Matrix {
116
- static create(): IMatrix;
117
- static invert(matrix: IMatrix): IMatrix;
118
- static applyPoint(xy: IXY, matrix: IMatrix): {
119
- x: number;
120
- y: number;
121
- };
122
- static applyAABB(aabb: AABB, matrix: IMatrix): {
123
- minX: number;
124
- minY: number;
125
- maxX: number;
126
- maxY: number;
127
- };
128
- static invertPoint(xy: IXY, matrix: IMatrix): {
129
- x: number;
130
- y: number;
131
- };
132
- static invertAABB(aabb: AABB, matrix: IMatrix): {
133
- minX: number;
134
- minY: number;
135
- maxX: number;
136
- maxY: number;
137
- };
138
- }
139
-
140
- type Point = {
141
- x: number;
142
- y: number;
143
- };
144
- declare function simplify(points: readonly Point[], distance: number): Point[];
145
- declare function simplifyPoints(points: readonly Point[], start: number, end: number, epsilon: number, newPoints?: Point[]): Point[];
146
- declare function pointsOnBezierCurves(points: readonly Point[], tolerance?: number, distance?: number): Point[];
147
-
148
- declare function xy_(x?: number, y?: number): {
149
- x: number;
150
- y: number;
151
- };
152
- declare function xy_client(e: any): {
153
- x: any;
154
- y: any;
155
- };
156
- declare function xy_from(xy: IXY): {
157
- x: number;
158
- y: number;
159
- };
160
- declare function xy_center(xy: {
161
- centerX: number;
162
- centerY: number;
163
- }): {
164
- x: number;
165
- y: number;
166
- };
167
- declare function xy_mutate(self: IXY, another: IXY): void;
168
- declare function xy_plus(self: IXY, another: IXY): {
169
- x: number;
170
- y: number;
171
- };
172
- declare function xy_plus_mutate(self: IXY, another: IXY): void;
173
- declare function xy_plus_all(...xys: IXY[]): IXY;
174
- declare function xy_minus(self: IXY, another: IXY): {
175
- x: number;
176
- y: number;
177
- };
178
- declare function xy_minus_mutate(self: IXY, another: IXY): void;
179
- declare function xy_multiply(self: IXY, ...numbers: number[]): {
180
- x: number;
181
- y: number;
182
- };
183
- declare function xy_multiply_mutate(self: IXY, ...numbers: number[]): void;
184
- declare function xy_divide(self: IXY, ...numbers: number[]): {
185
- x: number;
186
- y: number;
187
- };
188
- declare function xy_distance(self: IXY, another?: IXY): number;
189
- declare function xy_rotate(self: IXY, origin: IXY, rotation: number): {
190
- x: number;
191
- y: number;
192
- };
193
- declare function xy_dot(self: IXY, another: IXY): number;
194
- declare function xy_symmetric(self: IXY, origin: IXY): {
195
- x: number;
196
- y: number;
197
- };
198
- declare function xy_opposite(self: IXY): {
199
- x: number;
200
- y: number;
201
- };
202
- declare function xy_getRotation(self: IXY, another: IXY, origin: IXY): number;
203
- declare function xy_toArray(self: IXY): [number, number];
204
- declare function xy_xAxis(rotation: number): {
205
- x: number;
206
- y: number;
207
- };
208
- declare function xy_yAxis(rotation: number): {
209
- x: number;
210
- y: number;
211
- };
212
106
  declare class XY {
213
107
  x: number;
214
108
  y: number;
215
109
  constructor(x: number, y: number);
216
- plain(): {
110
+ $(): {
217
111
  x: number;
218
112
  y: number;
219
113
  };
220
114
  tuple(): readonly [number, number];
221
- plus(...others: IXY[]): XY;
222
- minus(...others: IXY[]): XY;
223
- multiply(...numbers: number[]): XY;
224
- divide(...numbers: number[]): XY;
225
- rotate(origin: IXY, rotation: number): XY;
226
- symmetric(origin: IXY): XY;
227
- ratio(another: IXY, t: number): XY;
228
- getDot(another: IXY): number;
229
- getDistance(another: IXY): number;
230
- getAngle(another: IXY, origin: IXY): number;
231
- static _(x?: number, y?: number): {
115
+ plus(...others: IXY[]): this;
116
+ plusNum(num: number): this;
117
+ minus(...others: IXY[]): this;
118
+ multiply(...numbers: number[]): this;
119
+ multiplyNum(num: number): this;
120
+ divide(...numbers: number[]): this;
121
+ rotate(origin: IXY, rotation: number): this;
122
+ static $(x?: number, y?: number): {
232
123
  x: number;
233
124
  y: number;
234
125
  };
235
- static of(x: number, y: number): XY;
236
- static from(xy: IXY): XY;
237
- static center(xy: {
238
- centerX: number;
239
- centerY: number;
126
+ static of(xy: IXY): XY;
127
+ static from(x: number, y: number): XY;
128
+ static center(wh: {
129
+ width: number;
130
+ height: number;
240
131
  }): XY;
241
132
  static leftTop(e: {
242
133
  left: number;
@@ -246,9 +137,16 @@ declare class XY {
246
137
  clientX: number;
247
138
  clientY: number;
248
139
  }): XY;
249
- static tuple(arr: [number, number]): XY;
250
- static xAxis(rotation: number): XY;
251
- static yAxis(rotation: number): XY;
140
+ static xAxis(rotation?: number): XY;
141
+ static yAxis(rotation?: number): XY;
142
+ static dot(self: IXY, another: IXY): number;
143
+ static distance(self: IXY, another: IXY): number;
144
+ static vector(self: IXY, another: IXY): XY;
145
+ static symmetric(self: IXY, origin?: {
146
+ x: number;
147
+ y: number;
148
+ }): XY;
149
+ static lerp(self: IXY, origin: IXY, t: number): XY;
252
150
  }
253
151
 
254
- export { AABB, Angle, type IMatrix, type IRect, type IRectWithCenter, type IXY, Matrix, OBB, PI, type Point, XY, abs, acos, asin, atan, atan2, ceil, cos, divide, floor, max, min, multiply, numberHalfFix, pointsOnBezierCurves, pow2, pow3, random, round, simplify, simplifyPoints, sin, sqrt, tan, twoDecimal, xy_, xy_center, xy_client, xy_distance, xy_divide, xy_dot, xy_from, xy_getRotation, xy_minus, xy_minus_mutate, xy_multiply, xy_multiply_mutate, xy_mutate, xy_opposite, xy_plus, xy_plus_all, xy_plus_mutate, xy_rotate, xy_symmetric, xy_toArray, xy_xAxis, xy_yAxis };
152
+ export { AABB, Angle, type IRect, type IRectWithCenter, type IXY, OBB, XY, minMax, twoDecimal };