@gitborlando/geo 4.1.1 → 5.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/dist/index.d.ts CHANGED
@@ -47,7 +47,7 @@ declare class OBB {
47
47
  y: number;
48
48
  }];
49
49
  clone: () => OBB;
50
- projectionLengthAt: (anotherAxis: IXY) => number;
50
+ projectAt: (anotherAxis: IXY) => number;
51
51
  collide: (another: OBB) => boolean;
52
52
  static identityOBB(): OBB;
53
53
  static fromRect(rect: IRect, rotation?: number): OBB;
@@ -63,180 +63,62 @@ declare class AABB {
63
63
  constructor(minX: number, minY: number, maxX: number, maxY: number);
64
64
  static rect(aabb: AABB): IRectWithCenter;
65
65
  static rectTuple(aabb: AABB): readonly [number, number, number, number];
66
+ static update(aabb: AABB, minX: number, minY: number, maxX: number, maxY: number): AABB;
67
+ static updateFromRect(aabb: AABB, rect: IRect): AABB;
68
+ static shift(aabb: AABB, delta: IXY): AABB;
66
69
  static collide(one: AABB, another: AABB): boolean;
67
70
  static include(one: AABB, another: AABB): number;
68
71
  static extend(aabb: AABB, ...expands: [number] | [number, number, number, number]): AABB;
69
- static merge(...aabbList: AABB[]): AABB;
72
+ static merge(aabbList: AABB[] | Set<AABB>): AABB;
70
73
  static fromOBB(obb: OBB): AABB;
74
+ static updateFromOBB(aabb: AABB, obb: OBB): AABB;
71
75
  }
72
76
 
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
77
  declare class Angle {
82
78
  static cos(angle: number): number;
83
79
  static sin(angle: number): number;
80
+ static cosSin(angle: number): {
81
+ cos: number;
82
+ sin: number;
83
+ };
84
84
  static tan(angle: number): number;
85
- static acos(angle: number): number;
86
- static asin(angle: number): number;
87
- static atan(angle: number): number;
88
85
  static atan2(y: number, x: number): number;
89
86
  static angleFy(radians: number): number;
90
87
  static radianFy(angle: number): number;
91
88
  static normal(angle: number): number;
89
+ static minor(angle: number): number;
92
90
  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
- };
91
+ static sweep(v1: IXY, v2?: IXY, clockwise?: boolean): number;
97
92
  }
98
93
 
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
94
  declare function twoDecimal(number: number): number;
95
+ declare function minMax(val: number, min: number, max: number): number;
113
96
 
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
97
  declare class XY {
213
98
  x: number;
214
99
  y: number;
215
100
  constructor(x: number, y: number);
216
- plain(): {
101
+ $(): {
217
102
  x: number;
218
103
  y: number;
219
104
  };
220
105
  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): {
106
+ plus(...others: IXY[]): this;
107
+ plusNum(num: number): this;
108
+ minus(...others: IXY[]): this;
109
+ multiply(...numbers: number[]): this;
110
+ multiplyNum(num: number): this;
111
+ divide(...numbers: number[]): this;
112
+ rotate(origin: IXY, rotation: number): this;
113
+ static $(x?: number, y?: number): {
232
114
  x: number;
233
115
  y: number;
234
116
  };
235
- static of(x: number, y: number): XY;
236
- static from(xy: IXY): XY;
237
- static center(xy: {
238
- centerX: number;
239
- centerY: number;
117
+ static of(xy: IXY): XY;
118
+ static from(x: number, y: number): XY;
119
+ static center(wh: {
120
+ width: number;
121
+ height: number;
240
122
  }): XY;
241
123
  static leftTop(e: {
242
124
  left: number;
@@ -246,9 +128,16 @@ declare class XY {
246
128
  clientX: number;
247
129
  clientY: number;
248
130
  }): XY;
249
- static tuple(arr: [number, number]): XY;
250
- static xAxis(rotation: number): XY;
251
- static yAxis(rotation: number): XY;
131
+ static xAxis(rotation?: number): XY;
132
+ static yAxis(rotation?: number): XY;
133
+ static dot(self: IXY, another: IXY): number;
134
+ static distance(self: IXY, another: IXY): number;
135
+ static vector(self: IXY, another: IXY): XY;
136
+ static symmetric(self: IXY, origin?: {
137
+ x: number;
138
+ y: number;
139
+ }): XY;
140
+ static lerp(self: IXY, origin: IXY, t: number): XY;
252
141
  }
253
142
 
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 };
143
+ export { AABB, Angle, type IRect, type IRectWithCenter, type IXY, OBB, XY, minMax, twoDecimal };