@lagless/math 0.0.33
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/README.md +366 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/lib/math-ops.d.ts +20 -0
- package/dist/lib/math-ops.d.ts.map +1 -0
- package/dist/lib/math-ops.js +58 -0
- package/dist/lib/vector2-buffers.d.ts +12 -0
- package/dist/lib/vector2-buffers.d.ts.map +1 -0
- package/dist/lib/vector2-buffers.js +11 -0
- package/dist/lib/vector2.d.ts +109 -0
- package/dist/lib/vector2.d.ts.map +1 -0
- package/dist/lib/vector2.js +400 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
# @lagless/math
|
|
2
|
+
|
|
3
|
+
## 1. Responsibility & Context
|
|
4
|
+
|
|
5
|
+
Provides deterministic mathematical operations and 2D vector algebra for the Lagless ECS framework. Wraps the `@lagless/deterministic-math` WASM module to guarantee identical floating-point results across all platforms (browsers, Node.js, operating systems), which is essential for rollback netcode where clients must simulate identically. All trigonometric functions (`sin`, `cos`, `atan2`) and square root operations use the WASM implementation to avoid platform-specific IEEE 754 edge cases.
|
|
6
|
+
|
|
7
|
+
## 2. Architecture Role
|
|
8
|
+
|
|
9
|
+
**Foundation layer** — sits directly above `@lagless/deterministic-math` and provides math primitives used throughout the stack. No dependencies on other Lagless libraries.
|
|
10
|
+
|
|
11
|
+
**Downstream consumers:**
|
|
12
|
+
- `@lagless/core` — ECS systems use `MathOps` and `Vector2` for physics, movement, and collision calculations
|
|
13
|
+
- `circle-sumo-simulation` — game logic relies on deterministic vector operations for player movement and collisions
|
|
14
|
+
|
|
15
|
+
**Upstream dependencies:**
|
|
16
|
+
- `@lagless/deterministic-math` — WASM module providing `dm_sin`, `dm_cos`, `dm_atan2`, `dm_sqrt`
|
|
17
|
+
|
|
18
|
+
## 3. Public API
|
|
19
|
+
|
|
20
|
+
### MathOps
|
|
21
|
+
|
|
22
|
+
Static utility class wrapping WASM-based deterministic math operations:
|
|
23
|
+
|
|
24
|
+
- `MathOps.init(): Promise<void>` — **MUST be called before any other operations.** Initializes the WASM module asynchronously.
|
|
25
|
+
- `MathOps.PI`, `MathOps.PI_2`, `MathOps.PI_HALF` — Mathematical constants (π, 2π, π/2)
|
|
26
|
+
- `MathOps.Deg2Rad`, `MathOps.Rad2Deg` — Angle conversion constants
|
|
27
|
+
- `MathOps.sin(angle: number): number` — Deterministic sine (radians)
|
|
28
|
+
- `MathOps.cos(angle: number): number` — Deterministic cosine (radians)
|
|
29
|
+
- `MathOps.atan2(y: number, x: number): number` — Deterministic arctangent2 (radians)
|
|
30
|
+
- `MathOps.sqrt(value: number): number` — Deterministic square root
|
|
31
|
+
- `MathOps.clamp(value: number, min: number, max: number): number` — Clamp value to range
|
|
32
|
+
- `MathOps.clamp01(value: number): number` — Clamp to [0, 1]
|
|
33
|
+
- `MathOps.lerp(a: number, b: number, t: number): number` — Linear interpolation
|
|
34
|
+
- `MathOps.lerpAngle(a: number, b: number, t: number): number` — Angle interpolation (shortest path around circle)
|
|
35
|
+
- `MathOps.normalizeAngle(angle: number): number` — Normalize angle to (-π, π]
|
|
36
|
+
- `MathOps.smoothRotate(rotation: number, targetRotation: number, rotationSpeed: number): number` — Smooth rotation with speed limit
|
|
37
|
+
- `MathOps.repeat(t: number, length: number): number` — Wrap value to [0, length)
|
|
38
|
+
|
|
39
|
+
### Vector2
|
|
40
|
+
|
|
41
|
+
2D vector class with comprehensive algebra operations. All operations come in three flavors:
|
|
42
|
+
|
|
43
|
+
- **`...InPlace()`** — Mutates `this` and returns it (zero allocation)
|
|
44
|
+
- **`...ToRef(ref)`** — Writes result to `ref` parameter and returns it (zero allocation)
|
|
45
|
+
- **`...ToNew()`** — Allocates and returns a new `Vector2` instance
|
|
46
|
+
|
|
47
|
+
**Constructor & Constants:**
|
|
48
|
+
- `new Vector2(x?: number, y?: number)` — Create vector (defaults to 0, 0)
|
|
49
|
+
- `Vector2.ZERO`, `Vector2.ONE`, `Vector2.UNIT_X`, `Vector2.UNIT_Y` — Static readonly constants
|
|
50
|
+
- `Vector2.UP`, `Vector2.DOWN`, `Vector2.LEFT`, `Vector2.RIGHT` — Directional constants
|
|
51
|
+
- `Vector2.EPSILON = 1e-8` — Epsilon for safe normalization/comparisons
|
|
52
|
+
|
|
53
|
+
**Basic Operations:**
|
|
54
|
+
- `setInPlace(x, y)`, `copyFrom(other)`, `copyToRef(ref)`, `clone()` — Setters and copying
|
|
55
|
+
- `addToNew(other)`, `addToRef(other, ref)`, `addInPlace(other)` — Addition
|
|
56
|
+
- `subToNew(other)`, `subToRef(other, ref)`, `subInPlace(other)` — Subtraction
|
|
57
|
+
- `mulToNew(other)`, `mulToRef(other, ref)`, `mulInPlace(other)` — Component-wise multiply
|
|
58
|
+
- `divToNew(other)`, `divToRef(other, ref)`, `divInPlace(other)` — Component-wise divide
|
|
59
|
+
- `scaleToNew(s)`, `scaleToRef(s, ref)`, `scaleInPlace(s)` — Scalar multiplication
|
|
60
|
+
- `negateToNew()`, `negateToRef(ref)`, `negateInPlace()` — Negate
|
|
61
|
+
- `absToNew()`, `absToRef(ref)`, `absInPlace()` — Absolute value (component-wise)
|
|
62
|
+
|
|
63
|
+
**Min/Max/Clamp:**
|
|
64
|
+
- `minToRef(other, ref)`, `minInPlace(other)` — Component-wise minimum
|
|
65
|
+
- `maxToRef(other, ref)`, `maxInPlace(other)` — Component-wise maximum
|
|
66
|
+
- `clampToNew(min, max)`, `clampToRef(min, max, ref)`, `clampInPlace(min, max)` — Component-wise clamp
|
|
67
|
+
|
|
68
|
+
**Metrics:**
|
|
69
|
+
- `lengthSquared(): number`, `length(): number` — Magnitude (uses `MathOps.sqrt`)
|
|
70
|
+
- `distanceSquaredTo(other): number`, `distanceTo(other): number` — Distance to another vector
|
|
71
|
+
- `dot(other): number` — Dot product
|
|
72
|
+
- `crossZ(other): number` — 2D cross product (Z component)
|
|
73
|
+
|
|
74
|
+
**Normalization:**
|
|
75
|
+
- `normalizedToNew()`, `normalizeToRef(ref)`, `normalizeInPlace()` — Normalize to unit length (returns zero vector if length < EPSILON)
|
|
76
|
+
|
|
77
|
+
**Angles & Rotation:**
|
|
78
|
+
- `angle(): number` — Angle from +X axis in radians (-π, π]
|
|
79
|
+
- `angleTo(other): number` — Smallest signed angle to another vector
|
|
80
|
+
- `rotatedToNew(angle)`, `rotateToRef(angle, ref)`, `rotateInPlace(angle)` — Rotate around origin
|
|
81
|
+
- `rotatedAroundToNew(pivot, angle)`, `rotateAroundToRef(pivot, angle, ref)`, `rotateAroundInPlace(pivot, angle)` — Rotate around pivot
|
|
82
|
+
- `rotateTowardsInPlace(target, maxDelta)` — Rotate towards target by at most maxDelta radians
|
|
83
|
+
|
|
84
|
+
**Projection & Reflection:**
|
|
85
|
+
- `projectOntoToNew(normal)`, `projectOntoToRef(normal, ref)`, `projectOntoInPlace(normal)` — Project onto normal
|
|
86
|
+
- `reflectToNew(normal)`, `reflectToRef(normal, ref)`, `reflectInPlace(normal)` — Reflect across normal
|
|
87
|
+
|
|
88
|
+
**Interpolation:**
|
|
89
|
+
- `lerpToNew(to, t)`, `lerpToRef(to, t, ref)`, `lerpInPlace(to, t)` — Linear interpolation
|
|
90
|
+
- `nlerpToNew(to, t)`, `nlerpToRef(to, t, ref)`, `nlerpInPlace(to, t)` — Normalized lerp (useful for directions)
|
|
91
|
+
|
|
92
|
+
**Perpendiculars:**
|
|
93
|
+
- `perpLeftToNew()`, `perpLeftToRef(ref)`, `perpLeftInPlace()` — Left perpendicular (+90° rotation)
|
|
94
|
+
- `perpRightToNew()`, `perpRightToRef(ref)`, `perpRightInPlace()` — Right perpendicular (-90° rotation)
|
|
95
|
+
|
|
96
|
+
**Length Clamping:**
|
|
97
|
+
- `clampLengthToNew(minLen, maxLen)`, `clampLengthToRef(minLen, maxLen, ref)`, `clampLengthInPlace(minLen, maxLen)` — Clamp vector length
|
|
98
|
+
|
|
99
|
+
**Equality:**
|
|
100
|
+
- `equals(other): boolean` — Exact equality
|
|
101
|
+
- `approxEquals(other, eps?): boolean` — Approximate equality (default epsilon = 1e-8)
|
|
102
|
+
|
|
103
|
+
**Serialization:**
|
|
104
|
+
- `toArray(out?, offset?): number[]` — Convert to array `[x, y]`
|
|
105
|
+
- `Vector2.fromArray(arr, offset?): Vector2` — Create from array
|
|
106
|
+
- `Vector2.fromArrayToRef(arr, ref, offset?): Vector2` — Read from array into ref
|
|
107
|
+
|
|
108
|
+
**Construction Helpers:**
|
|
109
|
+
- `Vector2.fromAngle(angle, length?): Vector2` — Create vector from angle and length
|
|
110
|
+
- `Vector2.fromAngleToRef(angle, ref, length?): Vector2` — Create from angle into ref
|
|
111
|
+
- `Vector2.minToRef(a, b, ref)` — Component-wise min of two vectors
|
|
112
|
+
- `Vector2.maxToRef(a, b, ref)` — Component-wise max of two vectors
|
|
113
|
+
|
|
114
|
+
### IVector2Like
|
|
115
|
+
|
|
116
|
+
Interface for objects with `x` and `y` number properties. Used for duck-typed vector compatibility.
|
|
117
|
+
|
|
118
|
+
### Vector2 Buffers
|
|
119
|
+
|
|
120
|
+
Pre-allocated `Vector2` instances for temporary calculations (avoids allocation in hot loops):
|
|
121
|
+
|
|
122
|
+
- `VECTOR2_BUFFER_1` through `VECTOR2_BUFFER_10` — Reusable vector instances
|
|
123
|
+
|
|
124
|
+
## 4. Preconditions
|
|
125
|
+
|
|
126
|
+
- **`MathOps.init()` MUST be called before using any `MathOps` functions or `Vector2` operations that depend on trigonometry/sqrt.** This initializes the WASM module. Failure to call this results in undefined behavior or crashes.
|
|
127
|
+
- Async initialization: Call `await MathOps.init()` during application startup before the ECS runner starts.
|
|
128
|
+
|
|
129
|
+
## 5. Postconditions
|
|
130
|
+
|
|
131
|
+
- After `MathOps.init()` completes, all math operations produce deterministic results across platforms.
|
|
132
|
+
- `Vector2` operations using `InPlace` and `ToRef` variants produce zero garbage (no allocations).
|
|
133
|
+
- All angle operations work in radians (not degrees).
|
|
134
|
+
|
|
135
|
+
## 6. Invariants & Constraints
|
|
136
|
+
|
|
137
|
+
- **Determinism guarantee:** `MathOps` functions produce bit-identical results on all platforms (Windows/Mac/Linux, Chrome/Firefox/Safari/Node.js). This is critical for rollback netcode.
|
|
138
|
+
- **Radians-only:** All angle parameters and return values are in radians. Use `MathOps.Deg2Rad` / `MathOps.Rad2Deg` for conversion.
|
|
139
|
+
- **Epsilon safety:** `Vector2` normalization and division operations check for near-zero lengths using `Vector2.EPSILON = 1e-8` to avoid NaN/Infinity.
|
|
140
|
+
- **Static readonly constants:** `Vector2.ZERO`, `Vector2.ONE`, etc. are readonly and MUST NOT be mutated. They are shared instances.
|
|
141
|
+
- **InPlace/ToRef/ToNew pattern:** Methods ending in `InPlace` mutate `this`, methods ending in `ToRef` mutate a reference parameter, methods ending in `ToNew` allocate a new instance. Never mix expectations.
|
|
142
|
+
|
|
143
|
+
## 7. Safety Notes (AI Agent)
|
|
144
|
+
|
|
145
|
+
### DO NOT
|
|
146
|
+
|
|
147
|
+
- **DO NOT use `Math.sin`, `Math.cos`, `Math.atan2`, `Math.sqrt` directly** — These produce platform-dependent results. Always use `MathOps.sin`, `MathOps.cos`, `MathOps.atan2`, `MathOps.sqrt`.
|
|
148
|
+
- **DO NOT mutate static readonly constants** (`Vector2.ZERO`, `Vector2.ONE`, etc.) — These are shared instances. Clone before mutating.
|
|
149
|
+
- **DO NOT forget to call `MathOps.init()`** — Calling WASM functions before initialization causes crashes.
|
|
150
|
+
- **DO NOT mix radians and degrees** — All angle operations use radians. Convert explicitly if needed.
|
|
151
|
+
- **DO NOT allocate `Vector2` in hot loops** — Use `VECTOR2_BUFFER_*` constants or `...ToRef()` methods for zero-allocation operations.
|
|
152
|
+
- **DO NOT use `Vector2` operations inside ECS systems without understanding allocation** — Systems run every tick (60 FPS). Prefer `InPlace` and `ToRef` variants.
|
|
153
|
+
|
|
154
|
+
### Common Mistakes
|
|
155
|
+
|
|
156
|
+
- Using `Math.sqrt()` instead of `MathOps.sqrt()` in vector normalization → platform-specific desyncs
|
|
157
|
+
- Forgetting `await MathOps.init()` during startup → WASM module not loaded, crashes at first trig call
|
|
158
|
+
- Mutating `Vector2.ZERO.x = 5` → breaks all future uses of `Vector2.ZERO` (shared instance)
|
|
159
|
+
- Mixing degrees and radians → rotation by 90 instead of `MathOps.PI_HALF` rotates by ~5157 degrees
|
|
160
|
+
|
|
161
|
+
## 8. Usage Examples
|
|
162
|
+
|
|
163
|
+
### Basic MathOps
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
import { MathOps } from '@lagless/math';
|
|
167
|
+
|
|
168
|
+
// MUST call init before any usage
|
|
169
|
+
await MathOps.init();
|
|
170
|
+
|
|
171
|
+
// Deterministic trig
|
|
172
|
+
const angle = MathOps.PI_HALF;
|
|
173
|
+
const s = MathOps.sin(angle); // 1.0 (deterministic)
|
|
174
|
+
const c = MathOps.cos(angle); // ~0.0 (deterministic)
|
|
175
|
+
|
|
176
|
+
// Angle normalization
|
|
177
|
+
const normalized = MathOps.normalizeAngle(MathOps.PI * 3); // -π
|
|
178
|
+
|
|
179
|
+
// Lerp and clamp
|
|
180
|
+
const interpolated = MathOps.lerp(0, 100, 0.5); // 50
|
|
181
|
+
const clamped = MathOps.clamp(150, 0, 100); // 100
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Vector2 Basics
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
import { Vector2, MathOps } from '@lagless/math';
|
|
188
|
+
|
|
189
|
+
await MathOps.init();
|
|
190
|
+
|
|
191
|
+
// Create vectors
|
|
192
|
+
const a = new Vector2(3, 4);
|
|
193
|
+
const b = new Vector2(1, 2);
|
|
194
|
+
|
|
195
|
+
// Length and distance
|
|
196
|
+
console.log(a.length()); // 5.0 (uses MathOps.sqrt)
|
|
197
|
+
console.log(a.distanceTo(b)); // 2.828...
|
|
198
|
+
|
|
199
|
+
// Addition (three flavors)
|
|
200
|
+
const sum1 = a.addToNew(b); // New instance: (4, 6)
|
|
201
|
+
const sum2 = a.addInPlace(b); // Mutates a, returns a: (4, 6)
|
|
202
|
+
const sum3 = Vector2.ZERO.clone();
|
|
203
|
+
a.addToRef(b, sum3); // Writes to sum3: (4, 6)
|
|
204
|
+
|
|
205
|
+
// Normalization
|
|
206
|
+
const dir = new Vector2(3, 4).normalizeInPlace(); // (0.6, 0.8)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Zero-Allocation Pattern (Hot Loops)
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
import { Vector2, VECTOR2_BUFFER_1, VECTOR2_BUFFER_2 } from '@lagless/math';
|
|
213
|
+
|
|
214
|
+
// Inside an ECS system (runs 60 times per second)
|
|
215
|
+
function updateVelocity(position: Vector2, target: Vector2, speed: number) {
|
|
216
|
+
// Use pre-allocated buffers to avoid GC pressure
|
|
217
|
+
const direction = VECTOR2_BUFFER_1;
|
|
218
|
+
const delta = VECTOR2_BUFFER_2;
|
|
219
|
+
|
|
220
|
+
target.subToRef(position, delta); // delta = target - position
|
|
221
|
+
delta.normalizeToRef(direction); // direction = normalize(delta)
|
|
222
|
+
direction.scaleToRef(speed, delta); // delta = direction * speed
|
|
223
|
+
position.addInPlace(delta); // position += delta
|
|
224
|
+
|
|
225
|
+
// No allocations! VECTOR2_BUFFER_* are reused every frame.
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Angle and Rotation
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
import { Vector2, MathOps } from '@lagless/math';
|
|
233
|
+
|
|
234
|
+
await MathOps.init();
|
|
235
|
+
|
|
236
|
+
const v = new Vector2(1, 0);
|
|
237
|
+
console.log(v.angle()); // 0 (pointing right)
|
|
238
|
+
|
|
239
|
+
v.rotateInPlace(MathOps.PI_HALF);
|
|
240
|
+
console.log(v.angle()); // π/2 (pointing up)
|
|
241
|
+
|
|
242
|
+
// Rotate towards target
|
|
243
|
+
const target = new Vector2(-1, 0);
|
|
244
|
+
v.rotateTowardsInPlace(target, MathOps.Deg2Rad * 45); // Rotate by at most 45°
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## 9. Testing Guidance
|
|
248
|
+
|
|
249
|
+
**Framework:** Vitest
|
|
250
|
+
|
|
251
|
+
**Running tests:**
|
|
252
|
+
```bash
|
|
253
|
+
# From monorepo root
|
|
254
|
+
nx test math
|
|
255
|
+
|
|
256
|
+
# Or with direct runner
|
|
257
|
+
npm test -- libs/math
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**Existing test patterns:**
|
|
261
|
+
- `libs/math/src/lib/math.spec.ts` — Verifies WASM determinism by comparing `MathOps` output to standard `Math` functions (within 10 decimal places)
|
|
262
|
+
- Tests call `await MathOps.init()` before assertions
|
|
263
|
+
- Uses `toBeCloseTo(expected, precision)` for floating-point comparisons
|
|
264
|
+
|
|
265
|
+
**When adding tests:**
|
|
266
|
+
- Always call `await MathOps.init()` in the test setup or at the start of the test
|
|
267
|
+
- Use `toBeCloseTo()` for floating-point assertions (exact equality fails due to rounding)
|
|
268
|
+
- Test `InPlace`, `ToRef`, and `ToNew` variants separately to verify allocation behavior
|
|
269
|
+
|
|
270
|
+
## 10. Change Checklist
|
|
271
|
+
|
|
272
|
+
When modifying this module:
|
|
273
|
+
|
|
274
|
+
1. **Verify determinism:** If changing math operations, test on multiple browsers and Node.js
|
|
275
|
+
2. **Maintain three-variant pattern:** New `Vector2` operations should provide `InPlace`, `ToRef`, and `ToNew` methods
|
|
276
|
+
3. **Update tests:** Add test coverage for new operations
|
|
277
|
+
4. **Check allocation:** Profile to ensure `ToRef` and `InPlace` methods don't allocate
|
|
278
|
+
5. **Update this README:** Document new APIs in Public API section
|
|
279
|
+
6. **Preserve radians-only convention:** Do not add degree-based APIs
|
|
280
|
+
7. **DO NOT replace WASM calls with standard Math:** This breaks determinism
|
|
281
|
+
|
|
282
|
+
## 11. Integration Notes
|
|
283
|
+
|
|
284
|
+
### Used By
|
|
285
|
+
|
|
286
|
+
- **`@lagless/core`** — `Vector2` is used extensively for `Transform2d` and `Velocity2d` components. Systems use `MathOps` for deterministic physics calculations.
|
|
287
|
+
- **`circle-sumo-simulation`** — All game physics (collision, movement, impulses) rely on `Vector2` and `MathOps` for deterministic simulation.
|
|
288
|
+
|
|
289
|
+
### Common Integration Patterns
|
|
290
|
+
|
|
291
|
+
**ECS Component Integration:**
|
|
292
|
+
```typescript
|
|
293
|
+
// Transform2d component stores position and rotation
|
|
294
|
+
// Systems use Vector2 operations for movement
|
|
295
|
+
class MovementSystem {
|
|
296
|
+
run(dt: number) {
|
|
297
|
+
for (const entityId of this.filter) {
|
|
298
|
+
const transform = this.transform2d.unsafe.position[entityId]; // Vector2
|
|
299
|
+
const velocity = this.velocity2d.unsafe.velocity[entityId]; // Vector2
|
|
300
|
+
|
|
301
|
+
// Zero-allocation update
|
|
302
|
+
velocity.scaleToRef(dt, VECTOR2_BUFFER_1);
|
|
303
|
+
transform.addInPlace(VECTOR2_BUFFER_1);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**Initialization Order:**
|
|
310
|
+
```typescript
|
|
311
|
+
// In your ECS runner or app entrypoint:
|
|
312
|
+
async function main() {
|
|
313
|
+
await MathOps.init(); // FIRST: Initialize WASM
|
|
314
|
+
const runner = new MyECSRunner(config); // THEN: Start ECS
|
|
315
|
+
runner.start();
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## 12. Appendix
|
|
320
|
+
|
|
321
|
+
### Vector2 Allocation Patterns
|
|
322
|
+
|
|
323
|
+
Understanding the three-variant pattern is critical for performance:
|
|
324
|
+
|
|
325
|
+
| Variant | Allocates? | Use Case |
|
|
326
|
+
|---------|-----------|----------|
|
|
327
|
+
| `...ToNew()` | **Yes** | One-time calculations, initialization, readable code outside hot loops |
|
|
328
|
+
| `...InPlace()` | **No** | Mutate `this` directly. Use when you own the vector and want to update it. |
|
|
329
|
+
| `...ToRef(ref)` | **No** | Write to an existing vector. Use in hot loops with pre-allocated buffers. |
|
|
330
|
+
|
|
331
|
+
**Example comparison:**
|
|
332
|
+
```typescript
|
|
333
|
+
// ALLOCATES (avoid in 60 FPS loops)
|
|
334
|
+
const result1 = a.addToNew(b);
|
|
335
|
+
|
|
336
|
+
// ZERO ALLOCATION (mutates a)
|
|
337
|
+
const result2 = a.addInPlace(b); // a is now (a+b)
|
|
338
|
+
|
|
339
|
+
// ZERO ALLOCATION (writes to temp)
|
|
340
|
+
const temp = new Vector2(); // Allocated ONCE outside loop
|
|
341
|
+
for (let i = 0; i < 1000; i++) {
|
|
342
|
+
a.addToRef(b, temp); // Reuses temp, no allocation
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### VECTOR2_BUFFER_* Constants
|
|
347
|
+
|
|
348
|
+
Ten pre-allocated `Vector2` instances for temporary calculations:
|
|
349
|
+
|
|
350
|
+
```typescript
|
|
351
|
+
import { VECTOR2_BUFFER_1, VECTOR2_BUFFER_2 } from '@lagless/math';
|
|
352
|
+
|
|
353
|
+
function collisionCheck(a: Vector2, b: Vector2): boolean {
|
|
354
|
+
const delta = VECTOR2_BUFFER_1;
|
|
355
|
+
b.subToRef(a, delta); // delta = b - a
|
|
356
|
+
return delta.lengthSquared() < 4; // collision if distance < 2
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
**Safety:** These are module-level singletons. Do NOT use the same buffer recursively (e.g., calling a function that uses `BUFFER_1` while you're also using `BUFFER_1`). Use different buffer indices for nested operations.
|
|
361
|
+
|
|
362
|
+
### Deterministic Math Implementation
|
|
363
|
+
|
|
364
|
+
The `@lagless/deterministic-math` WASM module uses C implementations of trigonometric functions and square root to guarantee bit-identical results across platforms. JavaScript's native `Math` functions delegate to platform-specific libm implementations, which differ between browsers and operating systems. For rollback netcode, even a 1-bit difference in float results causes divergence over time.
|
|
365
|
+
|
|
366
|
+
**Performance:** WASM math functions are ~2-3x slower than native `Math` functions, but this overhead is negligible compared to typical game logic. The determinism guarantee is worth the cost.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class MathOps {
|
|
2
|
+
static PI: number;
|
|
3
|
+
static PI_2: number;
|
|
4
|
+
static PI_HALF: number;
|
|
5
|
+
static Deg2Rad: number;
|
|
6
|
+
static Rad2Deg: number;
|
|
7
|
+
static init(): Promise<void>;
|
|
8
|
+
static clamp(value: number, min: number, max: number): number;
|
|
9
|
+
static clamp01(value: number): number;
|
|
10
|
+
static sqrt(value: number): number;
|
|
11
|
+
static cos(angle: number): number;
|
|
12
|
+
static sin(angle: number): number;
|
|
13
|
+
static atan2(y: number, x: number): number;
|
|
14
|
+
static lerp(a: number, b: number, t: number): number;
|
|
15
|
+
static repeat(t: number, length: number): number;
|
|
16
|
+
static lerpAngle(a: number, b: number, t: number): number;
|
|
17
|
+
static normalizeAngle(angle: number): number;
|
|
18
|
+
static smoothRotate(rotation: number, targetRotation: number, rotationSpeed: number): number;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=math-ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math-ops.d.ts","sourceRoot":"","sources":["../../src/lib/math-ops.ts"],"names":[],"mappings":"AAEA,qBAAa,OAAO;IAClB,OAAc,EAAE,SAAqB;IACrC,OAAc,IAAI,SAAqB;IACvC,OAAc,OAAO,SAAsB;IAC3C,OAAc,OAAO,SAA2B;IAChD,OAAc,OAAO,SAA2B;WAE5B,IAAI;WAIV,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;WAI7C,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;WAI9B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;WAI3B,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;WAI1B,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;WAI1B,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM;WAInC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM;WAI7C,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;WAIzC,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM;WAQlD,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;WAIrC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM;CAcpG"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { initMath, dm_sin, dm_cos, dm_atan2, dm_sqrt } from '@lagless/deterministic-math';
|
|
2
|
+
export class MathOps {
|
|
3
|
+
static PI = 3.141592653589793;
|
|
4
|
+
static PI_2 = 6.283185307179586;
|
|
5
|
+
static PI_HALF = 1.5707963267948966;
|
|
6
|
+
static Deg2Rad = 3.141592653589793 / 180;
|
|
7
|
+
static Rad2Deg = 180 / 3.141592653589793;
|
|
8
|
+
static async init() {
|
|
9
|
+
await initMath();
|
|
10
|
+
}
|
|
11
|
+
static clamp(value, min, max) {
|
|
12
|
+
return Math.min(max, Math.max(min, value));
|
|
13
|
+
}
|
|
14
|
+
static clamp01(value) {
|
|
15
|
+
return Math.min(1, Math.max(0, value));
|
|
16
|
+
}
|
|
17
|
+
static sqrt(value) {
|
|
18
|
+
return dm_sqrt(value);
|
|
19
|
+
}
|
|
20
|
+
static cos(angle) {
|
|
21
|
+
return dm_cos(angle);
|
|
22
|
+
}
|
|
23
|
+
static sin(angle) {
|
|
24
|
+
return dm_sin(angle);
|
|
25
|
+
}
|
|
26
|
+
static atan2(y, x) {
|
|
27
|
+
return dm_atan2(y, x);
|
|
28
|
+
}
|
|
29
|
+
static lerp(a, b, t) {
|
|
30
|
+
return a + (b - a) * t;
|
|
31
|
+
}
|
|
32
|
+
static repeat(t, length) {
|
|
33
|
+
return t - Math.floor(t / length) * length;
|
|
34
|
+
}
|
|
35
|
+
static lerpAngle(a, b, t) {
|
|
36
|
+
let num = MathOps.repeat(b - a, this.PI_2);
|
|
37
|
+
if (num > this.PI) {
|
|
38
|
+
num -= this.PI_2;
|
|
39
|
+
}
|
|
40
|
+
return a + num * t;
|
|
41
|
+
}
|
|
42
|
+
static normalizeAngle(angle) {
|
|
43
|
+
return ((angle + this.PI) % (2 * this.PI)) - this.PI;
|
|
44
|
+
}
|
|
45
|
+
static smoothRotate(rotation, targetRotation, rotationSpeed) {
|
|
46
|
+
const current = this.normalizeAngle(rotation);
|
|
47
|
+
const target = this.normalizeAngle(targetRotation);
|
|
48
|
+
let delta = target - current;
|
|
49
|
+
if (delta > this.PI)
|
|
50
|
+
delta -= 2 * this.PI;
|
|
51
|
+
if (delta < -this.PI)
|
|
52
|
+
delta += 2 * this.PI;
|
|
53
|
+
// Clamp rotation change based on rotation speed and delta time
|
|
54
|
+
const maxRotation = rotationSpeed;
|
|
55
|
+
const clampedDelta = Math.max(-maxRotation, Math.min(maxRotation, delta));
|
|
56
|
+
return this.normalizeAngle(current + clampedDelta);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Vector2 } from './vector2.js';
|
|
2
|
+
export declare const VECTOR2_BUFFER_1: Vector2;
|
|
3
|
+
export declare const VECTOR2_BUFFER_2: Vector2;
|
|
4
|
+
export declare const VECTOR2_BUFFER_3: Vector2;
|
|
5
|
+
export declare const VECTOR2_BUFFER_4: Vector2;
|
|
6
|
+
export declare const VECTOR2_BUFFER_5: Vector2;
|
|
7
|
+
export declare const VECTOR2_BUFFER_6: Vector2;
|
|
8
|
+
export declare const VECTOR2_BUFFER_7: Vector2;
|
|
9
|
+
export declare const VECTOR2_BUFFER_8: Vector2;
|
|
10
|
+
export declare const VECTOR2_BUFFER_9: Vector2;
|
|
11
|
+
export declare const VECTOR2_BUFFER_10: Vector2;
|
|
12
|
+
//# sourceMappingURL=vector2-buffers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector2-buffers.d.ts","sourceRoot":"","sources":["../../src/lib/vector2-buffers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,eAAO,MAAM,gBAAgB,SAAgB,CAAC;AAC9C,eAAO,MAAM,gBAAgB,SAAgB,CAAC;AAC9C,eAAO,MAAM,gBAAgB,SAAgB,CAAC;AAC9C,eAAO,MAAM,gBAAgB,SAAgB,CAAC;AAC9C,eAAO,MAAM,gBAAgB,SAAgB,CAAC;AAC9C,eAAO,MAAM,gBAAgB,SAAgB,CAAC;AAC9C,eAAO,MAAM,gBAAgB,SAAgB,CAAC;AAC9C,eAAO,MAAM,gBAAgB,SAAgB,CAAC;AAC9C,eAAO,MAAM,gBAAgB,SAAgB,CAAC;AAC9C,eAAO,MAAM,iBAAiB,SAAgB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Vector2 } from './vector2.js';
|
|
2
|
+
export const VECTOR2_BUFFER_1 = new Vector2();
|
|
3
|
+
export const VECTOR2_BUFFER_2 = new Vector2();
|
|
4
|
+
export const VECTOR2_BUFFER_3 = new Vector2();
|
|
5
|
+
export const VECTOR2_BUFFER_4 = new Vector2();
|
|
6
|
+
export const VECTOR2_BUFFER_5 = new Vector2();
|
|
7
|
+
export const VECTOR2_BUFFER_6 = new Vector2();
|
|
8
|
+
export const VECTOR2_BUFFER_7 = new Vector2();
|
|
9
|
+
export const VECTOR2_BUFFER_8 = new Vector2();
|
|
10
|
+
export const VECTOR2_BUFFER_9 = new Vector2();
|
|
11
|
+
export const VECTOR2_BUFFER_10 = new Vector2();
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
export interface IVector2Like {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export declare class Vector2 {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
static readonly ZERO: Vector2;
|
|
9
|
+
static readonly ONE: Vector2;
|
|
10
|
+
static readonly UNIT_X: Vector2;
|
|
11
|
+
static readonly UNIT_Y: Vector2;
|
|
12
|
+
static readonly UP: Vector2;
|
|
13
|
+
static readonly DOWN: Vector2;
|
|
14
|
+
static readonly LEFT: Vector2;
|
|
15
|
+
static readonly RIGHT: Vector2;
|
|
16
|
+
static readonly EPSILON = 1e-8;
|
|
17
|
+
constructor(x?: number, y?: number);
|
|
18
|
+
setInPlace(x: number, y: number): Vector2;
|
|
19
|
+
copyFrom(other: IVector2Like): Vector2;
|
|
20
|
+
copyToRef(ref: IVector2Like): IVector2Like;
|
|
21
|
+
clone(): Vector2;
|
|
22
|
+
addToNew(other: IVector2Like): Vector2;
|
|
23
|
+
addToRef(other: Vector2, ref: Vector2): Vector2;
|
|
24
|
+
addInPlace(other: Vector2): Vector2;
|
|
25
|
+
subToNew(other: Vector2): Vector2;
|
|
26
|
+
subToRef(other: Vector2, ref: Vector2): Vector2;
|
|
27
|
+
subInPlace(other: Vector2): Vector2;
|
|
28
|
+
mulToNew(other: Vector2): Vector2;
|
|
29
|
+
mulToRef(other: Vector2, ref: Vector2): Vector2;
|
|
30
|
+
mulInPlace(other: Vector2): Vector2;
|
|
31
|
+
divToNew(other: Vector2): Vector2;
|
|
32
|
+
divToRef(other: Vector2, ref: Vector2): Vector2;
|
|
33
|
+
divInPlace(other: Vector2): Vector2;
|
|
34
|
+
scaleToNew(s: number): Vector2;
|
|
35
|
+
scaleToRef(s: number, ref: Vector2): Vector2;
|
|
36
|
+
scaleInPlace(s: number): Vector2;
|
|
37
|
+
negateToNew(): Vector2;
|
|
38
|
+
negateToRef(ref: Vector2): Vector2;
|
|
39
|
+
negateInPlace(): Vector2;
|
|
40
|
+
absToNew(): Vector2;
|
|
41
|
+
absToRef(ref: Vector2): Vector2;
|
|
42
|
+
absInPlace(): Vector2;
|
|
43
|
+
minToRef(other: Vector2, ref: Vector2): Vector2;
|
|
44
|
+
minInPlace(other: Vector2): Vector2;
|
|
45
|
+
maxToRef(other: Vector2, ref: Vector2): Vector2;
|
|
46
|
+
maxInPlace(other: Vector2): Vector2;
|
|
47
|
+
clampToRef(min: Vector2, max: Vector2, ref: Vector2): Vector2;
|
|
48
|
+
clampInPlace(min: Vector2, max: Vector2): Vector2;
|
|
49
|
+
clampToNew(min: Vector2, max: Vector2): Vector2;
|
|
50
|
+
lengthSquared(): number;
|
|
51
|
+
length(): number;
|
|
52
|
+
distanceSquaredTo(other: Vector2): number;
|
|
53
|
+
distanceTo(other: Vector2): number;
|
|
54
|
+
dot(other: Vector2): number;
|
|
55
|
+
crossZ(other: Vector2): number;
|
|
56
|
+
normalizeToRef(ref: Vector2): Vector2;
|
|
57
|
+
normalizeInPlace(): Vector2;
|
|
58
|
+
normalizedToNew(): Vector2;
|
|
59
|
+
/** Angle from +X axis in range (-PI, PI] */
|
|
60
|
+
angle(): number;
|
|
61
|
+
/** Smallest signed angle from this to other in range (-PI, PI] */
|
|
62
|
+
angleTo(other: Vector2): number;
|
|
63
|
+
/** Rotate by angle around origin */
|
|
64
|
+
rotateInPlace(angle: number): Vector2;
|
|
65
|
+
rotateToRef(angle: number, ref: Vector2): Vector2;
|
|
66
|
+
rotatedToNew(angle: number): Vector2;
|
|
67
|
+
/** Rotate around pivot by angle */
|
|
68
|
+
rotateAroundInPlace(pivot: Vector2, angle: number): Vector2;
|
|
69
|
+
rotateAroundToRef(pivot: Vector2, angle: number, ref: Vector2): Vector2;
|
|
70
|
+
rotatedAroundToNew(pivot: Vector2, angle: number): Vector2;
|
|
71
|
+
/** Rotate this vector towards target by at most maxDelta radians (shortest path). */
|
|
72
|
+
rotateTowardsInPlace(target: Vector2, maxDelta: number): Vector2;
|
|
73
|
+
/** Project this onto normal (not necessarily unit). */
|
|
74
|
+
projectOntoToRef(normal: Vector2, ref: Vector2): Vector2;
|
|
75
|
+
projectOntoInPlace(normal: Vector2): Vector2;
|
|
76
|
+
projectOntoToNew(normal: Vector2): Vector2;
|
|
77
|
+
/** Reflect this across a normal (assumed normalized for best results). */
|
|
78
|
+
reflectToRef(normal: Vector2, ref: Vector2): Vector2;
|
|
79
|
+
reflectInPlace(normal: Vector2): Vector2;
|
|
80
|
+
reflectToNew(normal: Vector2): Vector2;
|
|
81
|
+
lerpToRef(to: Vector2, t: number, ref: Vector2): Vector2;
|
|
82
|
+
lerpInPlace(to: Vector2, t: number): Vector2;
|
|
83
|
+
lerpToNew(to: Vector2, t: number): Vector2;
|
|
84
|
+
/** Normalized linear interpolation (useful for directions). */
|
|
85
|
+
nlerpToRef(to: Vector2, t: number, ref: Vector2): Vector2;
|
|
86
|
+
nlerpInPlace(to: Vector2, t: number): Vector2;
|
|
87
|
+
nlerpToNew(to: Vector2, t: number): Vector2;
|
|
88
|
+
/** Left-hand perpendicular (rotate +90°). */
|
|
89
|
+
perpLeftToRef(ref: Vector2): Vector2;
|
|
90
|
+
perpLeftInPlace(): Vector2;
|
|
91
|
+
perpLeftToNew(): Vector2;
|
|
92
|
+
/** Right-hand perpendicular (rotate -90°). */
|
|
93
|
+
perpRightToRef(ref: Vector2): Vector2;
|
|
94
|
+
perpRightInPlace(): Vector2;
|
|
95
|
+
perpRightToNew(): Vector2;
|
|
96
|
+
clampLengthInPlace(minLen: number, maxLen: number): Vector2;
|
|
97
|
+
clampLengthToRef(minLen: number, maxLen: number, ref: Vector2): Vector2;
|
|
98
|
+
clampLengthToNew(minLen: number, maxLen: number): Vector2;
|
|
99
|
+
equals(other: Vector2): boolean;
|
|
100
|
+
approxEquals(other: Vector2, eps?: number): boolean;
|
|
101
|
+
toArray(out?: number[], offset?: number): number[];
|
|
102
|
+
static fromArray(arr: ArrayLike<number>, offset?: number): Vector2;
|
|
103
|
+
static fromArrayToRef(arr: ArrayLike<number>, ref: Vector2, offset?: number): Vector2;
|
|
104
|
+
static fromAngle(angle: number, length?: number): Vector2;
|
|
105
|
+
static fromAngleToRef(angle: number, ref: Vector2, length?: number): Vector2;
|
|
106
|
+
static minToRef(a: Vector2, b: Vector2, ref: Vector2): Vector2;
|
|
107
|
+
static maxToRef(a: Vector2, b: Vector2, ref: Vector2): Vector2;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=vector2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector2.d.ts","sourceRoot":"","sources":["../../src/lib/vector2.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import { MathOps } from './math-ops.js';
|
|
2
|
+
export class Vector2 {
|
|
3
|
+
x;
|
|
4
|
+
y;
|
|
5
|
+
// ---- Static readonly constants (do not mutate) ----
|
|
6
|
+
static ZERO = new Vector2(0, 0);
|
|
7
|
+
static ONE = new Vector2(1, 1);
|
|
8
|
+
static UNIT_X = new Vector2(1, 0);
|
|
9
|
+
static UNIT_Y = new Vector2(0, 1);
|
|
10
|
+
static UP = new Vector2(0, 1);
|
|
11
|
+
static DOWN = new Vector2(0, -1);
|
|
12
|
+
static LEFT = new Vector2(-1, 0);
|
|
13
|
+
static RIGHT = new Vector2(1, 0);
|
|
14
|
+
// Small epsilon for safe normalization/comparisons
|
|
15
|
+
static EPSILON = 1e-8;
|
|
16
|
+
constructor(x = 0, y = 0) {
|
|
17
|
+
this.x = x;
|
|
18
|
+
this.y = y;
|
|
19
|
+
this.x = x;
|
|
20
|
+
this.y = y;
|
|
21
|
+
}
|
|
22
|
+
// ---- Basic utilities ----
|
|
23
|
+
setInPlace(x, y) {
|
|
24
|
+
this.x = x;
|
|
25
|
+
this.y = y;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
copyFrom(other) {
|
|
29
|
+
this.x = other.x;
|
|
30
|
+
this.y = other.y;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
copyToRef(ref) {
|
|
34
|
+
ref.x = this.x;
|
|
35
|
+
ref.y = this.y;
|
|
36
|
+
return ref;
|
|
37
|
+
}
|
|
38
|
+
clone() {
|
|
39
|
+
return new Vector2(this.x, this.y);
|
|
40
|
+
}
|
|
41
|
+
// ---- Addition ----
|
|
42
|
+
addToNew(other) {
|
|
43
|
+
return new Vector2(this.x + other.x, this.y + other.y);
|
|
44
|
+
}
|
|
45
|
+
addToRef(other, ref) {
|
|
46
|
+
ref.x = this.x + other.x;
|
|
47
|
+
ref.y = this.y + other.y;
|
|
48
|
+
return ref;
|
|
49
|
+
}
|
|
50
|
+
addInPlace(other) {
|
|
51
|
+
return this.addToRef(other, this);
|
|
52
|
+
}
|
|
53
|
+
// ---- Subtraction ----
|
|
54
|
+
subToNew(other) {
|
|
55
|
+
return new Vector2(this.x - other.x, this.y - other.y);
|
|
56
|
+
}
|
|
57
|
+
subToRef(other, ref) {
|
|
58
|
+
ref.x = this.x - other.x;
|
|
59
|
+
ref.y = this.y - other.y;
|
|
60
|
+
return ref;
|
|
61
|
+
}
|
|
62
|
+
subInPlace(other) {
|
|
63
|
+
return this.subToRef(other, this);
|
|
64
|
+
}
|
|
65
|
+
// ---- Component-wise multiply/divide ----
|
|
66
|
+
mulToNew(other) {
|
|
67
|
+
return new Vector2(this.x * other.x, this.y * other.y);
|
|
68
|
+
}
|
|
69
|
+
mulToRef(other, ref) {
|
|
70
|
+
ref.x = this.x * other.x;
|
|
71
|
+
ref.y = this.y * other.y;
|
|
72
|
+
return ref;
|
|
73
|
+
}
|
|
74
|
+
mulInPlace(other) {
|
|
75
|
+
return this.mulToRef(other, this);
|
|
76
|
+
}
|
|
77
|
+
divToNew(other) {
|
|
78
|
+
return new Vector2(this.x / other.x, this.y / other.y);
|
|
79
|
+
}
|
|
80
|
+
divToRef(other, ref) {
|
|
81
|
+
ref.x = this.x / other.x;
|
|
82
|
+
ref.y = this.y / other.y;
|
|
83
|
+
return ref;
|
|
84
|
+
}
|
|
85
|
+
divInPlace(other) {
|
|
86
|
+
return this.divToRef(other, this);
|
|
87
|
+
}
|
|
88
|
+
// ---- Scale by scalar ----
|
|
89
|
+
scaleToNew(s) {
|
|
90
|
+
return new Vector2(this.x * s, this.y * s);
|
|
91
|
+
}
|
|
92
|
+
scaleToRef(s, ref) {
|
|
93
|
+
ref.x = this.x * s;
|
|
94
|
+
ref.y = this.y * s;
|
|
95
|
+
return ref;
|
|
96
|
+
}
|
|
97
|
+
scaleInPlace(s) {
|
|
98
|
+
return this.scaleToRef(s, this);
|
|
99
|
+
}
|
|
100
|
+
// ---- Negate / Abs ----
|
|
101
|
+
negateToNew() {
|
|
102
|
+
return new Vector2(-this.x, -this.y);
|
|
103
|
+
}
|
|
104
|
+
negateToRef(ref) {
|
|
105
|
+
ref.x = -this.x;
|
|
106
|
+
ref.y = -this.y;
|
|
107
|
+
return ref;
|
|
108
|
+
}
|
|
109
|
+
negateInPlace() {
|
|
110
|
+
return this.negateToRef(this);
|
|
111
|
+
}
|
|
112
|
+
absToNew() {
|
|
113
|
+
return new Vector2(Math.abs(this.x), Math.abs(this.y));
|
|
114
|
+
}
|
|
115
|
+
absToRef(ref) {
|
|
116
|
+
ref.x = Math.abs(this.x);
|
|
117
|
+
ref.y = Math.abs(this.y);
|
|
118
|
+
return ref;
|
|
119
|
+
}
|
|
120
|
+
absInPlace() {
|
|
121
|
+
return this.absToRef(this);
|
|
122
|
+
}
|
|
123
|
+
// ---- Min/Max/Clamp (component-wise) ----
|
|
124
|
+
minToRef(other, ref) {
|
|
125
|
+
ref.x = Math.min(this.x, other.x);
|
|
126
|
+
ref.y = Math.min(this.y, other.y);
|
|
127
|
+
return ref;
|
|
128
|
+
}
|
|
129
|
+
minInPlace(other) {
|
|
130
|
+
return this.minToRef(other, this);
|
|
131
|
+
}
|
|
132
|
+
maxToRef(other, ref) {
|
|
133
|
+
ref.x = Math.max(this.x, other.x);
|
|
134
|
+
ref.y = Math.max(this.y, other.y);
|
|
135
|
+
return ref;
|
|
136
|
+
}
|
|
137
|
+
maxInPlace(other) {
|
|
138
|
+
return this.maxToRef(other, this);
|
|
139
|
+
}
|
|
140
|
+
clampToRef(min, max, ref) {
|
|
141
|
+
ref.x = MathOps.clamp(this.x, min.x, max.x);
|
|
142
|
+
ref.y = MathOps.clamp(this.y, min.y, max.y);
|
|
143
|
+
return ref;
|
|
144
|
+
}
|
|
145
|
+
clampInPlace(min, max) {
|
|
146
|
+
return this.clampToRef(min, max, this);
|
|
147
|
+
}
|
|
148
|
+
clampToNew(min, max) {
|
|
149
|
+
return this.clampToRef(min, max, new Vector2());
|
|
150
|
+
}
|
|
151
|
+
// ---- Metrics ----
|
|
152
|
+
lengthSquared() {
|
|
153
|
+
return this.x * this.x + this.y * this.y;
|
|
154
|
+
}
|
|
155
|
+
length() {
|
|
156
|
+
return MathOps.sqrt(this.lengthSquared());
|
|
157
|
+
}
|
|
158
|
+
distanceSquaredTo(other) {
|
|
159
|
+
const dx = this.x - other.x, dy = this.y - other.y;
|
|
160
|
+
return dx * dx + dy * dy;
|
|
161
|
+
}
|
|
162
|
+
distanceTo(other) {
|
|
163
|
+
return MathOps.sqrt(this.distanceSquaredTo(other));
|
|
164
|
+
}
|
|
165
|
+
// ---- Dot/Cross ----
|
|
166
|
+
dot(other) {
|
|
167
|
+
return this.x * other.x + this.y * other.y;
|
|
168
|
+
}
|
|
169
|
+
// 2D cross-product Z component (this x other)
|
|
170
|
+
crossZ(other) {
|
|
171
|
+
return this.x * other.y - this.y * other.x;
|
|
172
|
+
}
|
|
173
|
+
// ---- Normalization ----
|
|
174
|
+
normalizeToRef(ref) {
|
|
175
|
+
const lsq = this.lengthSquared();
|
|
176
|
+
if (lsq > Vector2.EPSILON) {
|
|
177
|
+
const invLen = 1 / MathOps.sqrt(lsq);
|
|
178
|
+
ref.x = this.x * invLen;
|
|
179
|
+
ref.y = this.y * invLen;
|
|
180
|
+
return ref;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
ref.x = 0;
|
|
184
|
+
ref.y = 0;
|
|
185
|
+
return ref;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
normalizeInPlace() {
|
|
189
|
+
return this.normalizeToRef(this);
|
|
190
|
+
}
|
|
191
|
+
normalizedToNew() {
|
|
192
|
+
return this.normalizeToRef(new Vector2());
|
|
193
|
+
}
|
|
194
|
+
// ---- Angles & rotation (radians) ----
|
|
195
|
+
/** Angle from +X axis in range (-PI, PI] */
|
|
196
|
+
angle() {
|
|
197
|
+
return MathOps.atan2(this.y, this.x);
|
|
198
|
+
}
|
|
199
|
+
/** Smallest signed angle from this to other in range (-PI, PI] */
|
|
200
|
+
angleTo(other) {
|
|
201
|
+
const a = MathOps.atan2(this.y, this.x);
|
|
202
|
+
const b = MathOps.atan2(other.y, other.x);
|
|
203
|
+
return MathOps.normalizeAngle(b - a);
|
|
204
|
+
}
|
|
205
|
+
/** Rotate by angle around origin */
|
|
206
|
+
rotateInPlace(angle) {
|
|
207
|
+
const c = MathOps.cos(angle), s = MathOps.sin(angle);
|
|
208
|
+
const x = this.x, y = this.y;
|
|
209
|
+
this.x = x * c - y * s;
|
|
210
|
+
this.y = x * s + y * c;
|
|
211
|
+
return this;
|
|
212
|
+
}
|
|
213
|
+
rotateToRef(angle, ref) {
|
|
214
|
+
const c = MathOps.cos(angle), s = MathOps.sin(angle);
|
|
215
|
+
const x = this.x, y = this.y;
|
|
216
|
+
ref.x = x * c - y * s;
|
|
217
|
+
ref.y = x * s + y * c;
|
|
218
|
+
return ref;
|
|
219
|
+
}
|
|
220
|
+
rotatedToNew(angle) {
|
|
221
|
+
return this.rotateToRef(angle, new Vector2());
|
|
222
|
+
}
|
|
223
|
+
/** Rotate around pivot by angle */
|
|
224
|
+
rotateAroundInPlace(pivot, angle) {
|
|
225
|
+
const px = this.x - pivot.x, py = this.y - pivot.y;
|
|
226
|
+
const c = MathOps.cos(angle), s = MathOps.sin(angle);
|
|
227
|
+
this.x = px * c - py * s + pivot.x;
|
|
228
|
+
this.y = px * s + py * c + pivot.y;
|
|
229
|
+
return this;
|
|
230
|
+
}
|
|
231
|
+
rotateAroundToRef(pivot, angle, ref) {
|
|
232
|
+
const px = this.x - pivot.x, py = this.y - pivot.y;
|
|
233
|
+
const c = MathOps.cos(angle), s = MathOps.sin(angle);
|
|
234
|
+
ref.x = px * c - py * s + pivot.x;
|
|
235
|
+
ref.y = px * s + py * c + pivot.y;
|
|
236
|
+
return ref;
|
|
237
|
+
}
|
|
238
|
+
rotatedAroundToNew(pivot, angle) {
|
|
239
|
+
return this.rotateAroundToRef(pivot, angle, new Vector2());
|
|
240
|
+
}
|
|
241
|
+
/** Rotate this vector towards target by at most maxDelta radians (shortest path). */
|
|
242
|
+
rotateTowardsInPlace(target, maxDelta) {
|
|
243
|
+
const a = this.angle();
|
|
244
|
+
const b = target.angle();
|
|
245
|
+
const next = MathOps.smoothRotate(a, b, maxDelta);
|
|
246
|
+
const len = this.length();
|
|
247
|
+
const c = MathOps.cos(next), s = MathOps.sin(next);
|
|
248
|
+
this.x = c * len;
|
|
249
|
+
this.y = s * len;
|
|
250
|
+
return this;
|
|
251
|
+
}
|
|
252
|
+
// ---- Projection / Reflection ----
|
|
253
|
+
/** Project this onto normal (not necessarily unit). */
|
|
254
|
+
projectOntoToRef(normal, ref) {
|
|
255
|
+
const nlsq = normal.lengthSquared();
|
|
256
|
+
if (nlsq <= Vector2.EPSILON) {
|
|
257
|
+
ref.x = 0;
|
|
258
|
+
ref.y = 0;
|
|
259
|
+
return ref;
|
|
260
|
+
}
|
|
261
|
+
const scale = (this.x * normal.x + this.y * normal.y) / nlsq;
|
|
262
|
+
ref.x = normal.x * scale;
|
|
263
|
+
ref.y = normal.y * scale;
|
|
264
|
+
return ref;
|
|
265
|
+
}
|
|
266
|
+
projectOntoInPlace(normal) {
|
|
267
|
+
return this.projectOntoToRef(normal, this);
|
|
268
|
+
}
|
|
269
|
+
projectOntoToNew(normal) {
|
|
270
|
+
return this.projectOntoToRef(normal, new Vector2());
|
|
271
|
+
}
|
|
272
|
+
/** Reflect this across a normal (assumed normalized for best results). */
|
|
273
|
+
reflectToRef(normal, ref) {
|
|
274
|
+
const d = this.dot(normal) * 2;
|
|
275
|
+
ref.x = this.x - d * normal.x;
|
|
276
|
+
ref.y = this.y - d * normal.y;
|
|
277
|
+
return ref;
|
|
278
|
+
}
|
|
279
|
+
reflectInPlace(normal) {
|
|
280
|
+
return this.reflectToRef(normal, this);
|
|
281
|
+
}
|
|
282
|
+
reflectToNew(normal) {
|
|
283
|
+
return this.reflectToRef(normal, new Vector2());
|
|
284
|
+
}
|
|
285
|
+
// ---- Lerp / Nlerp ----
|
|
286
|
+
lerpToRef(to, t, ref) {
|
|
287
|
+
ref.x = MathOps.lerp(this.x, to.x, t);
|
|
288
|
+
ref.y = MathOps.lerp(this.y, to.y, t);
|
|
289
|
+
return ref;
|
|
290
|
+
}
|
|
291
|
+
lerpInPlace(to, t) {
|
|
292
|
+
return this.lerpToRef(to, t, this);
|
|
293
|
+
}
|
|
294
|
+
lerpToNew(to, t) {
|
|
295
|
+
return this.lerpToRef(to, t, new Vector2());
|
|
296
|
+
}
|
|
297
|
+
/** Normalized linear interpolation (useful for directions). */
|
|
298
|
+
nlerpToRef(to, t, ref) {
|
|
299
|
+
this.lerpToRef(to, t, ref);
|
|
300
|
+
return ref.normalizeInPlace();
|
|
301
|
+
}
|
|
302
|
+
nlerpInPlace(to, t) {
|
|
303
|
+
return this.nlerpToRef(to, t, this);
|
|
304
|
+
}
|
|
305
|
+
nlerpToNew(to, t) {
|
|
306
|
+
return this.nlerpToRef(to, t, new Vector2());
|
|
307
|
+
}
|
|
308
|
+
// ---- Perpendiculars ----
|
|
309
|
+
/** Left-hand perpendicular (rotate +90°). */
|
|
310
|
+
perpLeftToRef(ref) {
|
|
311
|
+
const x = -this.y;
|
|
312
|
+
ref.y = this.x;
|
|
313
|
+
ref.x = x;
|
|
314
|
+
return ref;
|
|
315
|
+
}
|
|
316
|
+
perpLeftInPlace() {
|
|
317
|
+
return this.perpLeftToRef(this);
|
|
318
|
+
}
|
|
319
|
+
perpLeftToNew() {
|
|
320
|
+
return this.perpLeftToRef(new Vector2());
|
|
321
|
+
}
|
|
322
|
+
/** Right-hand perpendicular (rotate -90°). */
|
|
323
|
+
perpRightToRef(ref) {
|
|
324
|
+
const y = -this.x;
|
|
325
|
+
ref.x = this.y;
|
|
326
|
+
ref.y = y;
|
|
327
|
+
return ref;
|
|
328
|
+
}
|
|
329
|
+
perpRightInPlace() {
|
|
330
|
+
return this.perpRightToRef(this);
|
|
331
|
+
}
|
|
332
|
+
perpRightToNew() {
|
|
333
|
+
return this.perpRightToRef(new Vector2());
|
|
334
|
+
}
|
|
335
|
+
// ---- Length clamping ----
|
|
336
|
+
clampLengthInPlace(minLen, maxLen) {
|
|
337
|
+
const lenSq = this.lengthSquared();
|
|
338
|
+
if (lenSq < minLen * minLen) {
|
|
339
|
+
const len = MathOps.sqrt(lenSq);
|
|
340
|
+
if (len > Vector2.EPSILON) {
|
|
341
|
+
this.scaleInPlace(minLen / len);
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
this.setInPlace(minLen, 0);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
else if (lenSq > maxLen * maxLen) {
|
|
348
|
+
const len = MathOps.sqrt(lenSq);
|
|
349
|
+
this.scaleInPlace(maxLen / (len > Vector2.EPSILON ? len : 1));
|
|
350
|
+
}
|
|
351
|
+
return this;
|
|
352
|
+
}
|
|
353
|
+
clampLengthToRef(minLen, maxLen, ref) {
|
|
354
|
+
ref.copyFrom(this);
|
|
355
|
+
return ref.clampLengthInPlace(minLen, maxLen);
|
|
356
|
+
}
|
|
357
|
+
clampLengthToNew(minLen, maxLen) {
|
|
358
|
+
return this.clampLengthToRef(minLen, maxLen, new Vector2());
|
|
359
|
+
}
|
|
360
|
+
// ---- Equality ----
|
|
361
|
+
equals(other) {
|
|
362
|
+
return this.x === other.x && this.y === other.y;
|
|
363
|
+
}
|
|
364
|
+
approxEquals(other, eps = Vector2.EPSILON) {
|
|
365
|
+
return Math.abs(this.x - other.x) <= eps && Math.abs(this.y - other.y) <= eps;
|
|
366
|
+
}
|
|
367
|
+
// ---- Serialization ----
|
|
368
|
+
toArray(out = [], offset = 0) {
|
|
369
|
+
out[offset] = this.x;
|
|
370
|
+
out[offset + 1] = this.y;
|
|
371
|
+
return out;
|
|
372
|
+
}
|
|
373
|
+
static fromArray(arr, offset = 0) {
|
|
374
|
+
return new Vector2(arr[offset], arr[offset + 1]);
|
|
375
|
+
}
|
|
376
|
+
static fromArrayToRef(arr, ref, offset = 0) {
|
|
377
|
+
ref.x = arr[offset];
|
|
378
|
+
ref.y = arr[offset + 1];
|
|
379
|
+
return ref;
|
|
380
|
+
}
|
|
381
|
+
// ---- Construction helpers ----
|
|
382
|
+
static fromAngle(angle, length = 1) {
|
|
383
|
+
return new Vector2(MathOps.cos(angle) * length, MathOps.sin(angle) * length);
|
|
384
|
+
}
|
|
385
|
+
static fromAngleToRef(angle, ref, length = 1) {
|
|
386
|
+
ref.x = MathOps.cos(angle) * length;
|
|
387
|
+
ref.y = MathOps.sin(angle) * length;
|
|
388
|
+
return ref;
|
|
389
|
+
}
|
|
390
|
+
static minToRef(a, b, ref) {
|
|
391
|
+
ref.x = Math.min(a.x, b.x);
|
|
392
|
+
ref.y = Math.min(a.y, b.y);
|
|
393
|
+
return ref;
|
|
394
|
+
}
|
|
395
|
+
static maxToRef(a, b, ref) {
|
|
396
|
+
ref.x = Math.max(a.x, b.x);
|
|
397
|
+
ref.y = Math.max(a.y, b.y);
|
|
398
|
+
return ref;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.d.ts","../../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/modules/index.d.ts","../../../node_modules/.pnpm/@lagless+deterministic-math@0.1.8/node_modules/@lagless/deterministic-math/dist/pkg/det_math_wasm.d.ts","../../../node_modules/.pnpm/@lagless+deterministic-math@0.1.8/node_modules/@lagless/deterministic-math/dist/lib/index.d.ts","../src/lib/math-ops.ts","../src/lib/vector2.ts","../src/lib/vector2-buffers.ts","../src/index.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/compatibility/disposable.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/compatibility/indexable.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/compatibility/iterators.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/compatibility/index.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/globals.typedarray.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/buffer.buffer.d.ts","../../../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/header.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/readable.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/file.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/fetch.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/formdata.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/connector.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/client.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/errors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-origin.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool-stats.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/handlers.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-client.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-errors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/env-http-proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-handler.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/api.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/interceptors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/util.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cookies.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/patch.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/websocket.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/eventsource.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/filereader.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/content-type.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cache.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/index.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/globals.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/assert.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/assert/strict.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/async_hooks.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/buffer.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/child_process.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/cluster.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/console.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/constants.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/crypto.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/dgram.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/dns.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/dns/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/domain.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/dom-events.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/events.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/fs.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/fs/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/http.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/http2.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/https.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/inspector.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/module.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/net.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/os.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/path.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/process.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/punycode.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/querystring.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/readline.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/readline/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/repl.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/sea.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/stream.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/stream/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/stream/web.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/string_decoder.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/test.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/timers.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/timers/promises.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/tls.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/trace_events.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/tty.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/url.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/util.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/v8.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/vm.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/wasi.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/worker_threads.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/zlib.d.ts","../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/index.d.ts"],"fileIdsList":[[59,62,63,64,71,114],[59,61,71,114],[59,63,71,114],[59,62,71,114],[60,71,114],[71,114],[71,111,114],[71,113,114],[114],[71,114,119,148],[71,114,115,120,126,127,134,145,156],[71,114,115,116,126,134],[66,67,68,71,114],[71,114,117,157],[71,114,118,119,127,135],[71,114,119,145,153],[71,114,120,122,126,134],[71,113,114,121],[71,114,122,123],[71,114,124,126],[71,113,114,126],[71,114,126,127,128,145,156],[71,114,126,127,128,141,145,148],[71,109,114],[71,114,122,126,129,134,145,156],[71,114,126,127,129,130,134,145,153,156],[71,114,129,131,145,153,156],[69,70,71,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162],[71,114,126,132],[71,114,133,156,161],[71,114,122,126,134,145],[71,114,135],[71,114,136],[71,113,114,137],[71,111,112,113,114,115,116,117,118,119,120,121,122,123,124,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162],[71,114,139],[71,114,140],[71,114,126,141,142],[71,114,141,143,157,159],[71,114,126,145,146,148],[71,114,147,148],[71,114,145,146],[71,114,148],[71,114,149],[71,111,114,145,150],[71,114,126,151,152],[71,114,151,152],[71,114,119,134,145,153],[71,114,154],[71,114,134,155],[71,114,129,140,156],[71,114,119,157],[71,114,145,158],[71,114,133,159],[71,114,160],[71,114,126,128,137,145,148,156,159,161],[71,114,145,162],[58,71,114],[71,81,85,114,156],[71,81,114,145,156],[71,76,114],[71,78,81,114,153,156],[71,114,134,153],[71,114,163],[71,76,114,163],[71,78,81,114,134,156],[71,73,74,77,80,114,126,145,156],[71,81,88,114],[71,73,79,114],[71,81,102,103,114],[71,77,81,114,148,156,163],[71,102,114,163],[71,75,76,114,163],[71,81,114],[71,75,76,77,78,79,80,81,82,83,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,103,104,105,106,107,108,114],[71,81,96,114],[71,81,88,89,114],[71,79,81,89,90,114],[71,80,114],[71,73,76,81,114],[71,81,85,89,90,114],[71,85,114],[71,79,81,84,114,156],[71,73,78,81,88,114],[71,114,145],[71,76,81,102,114,161,163]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"a6a5253138c5432c68a1510c70fe78a644fe2e632111ba778e1978010d6edfec","impliedFormat":1},{"version":"b8f34dd1757f68e03262b1ca3ddfa668a855b872f8bdd5224d6f993a7b37dc2c","impliedFormat":99},{"version":"3511862997360229a86508fd32efbba80dee7c97f363d46cc85bc891c316d8fe","impliedFormat":1},{"version":"5864f61cfd744875b4f6250009a6d3fe8019c15e022abf7671259c2377d2288a","impliedFormat":1},{"version":"cb1cbc973a31781766d2525733ae1d20acaaeccb07186bd8f286459d75fb89a0","signature":"e82c68cc9bee262ff2401f8202bb43306b96e207b7abfa13f5f351fc8ce41b9d","impliedFormat":99},{"version":"d05c43edbe5b37a73488dafc7cf18fae5221e73bb520d1bf1ff4e237fd91210a","signature":"9ba510bcf107f3b93bbe83ae63dc6251410769048ec2a1c300c13b8efe555f92","impliedFormat":99},{"version":"a6969fa860af104be3ce72e5e998b31756477ea9d412dffba1e3af9178315d29","signature":"3e36da5942397ee0b3a4e38cdde9a6b997f8eb72463e3cd8138c225aabe27178","impliedFormat":99},{"version":"02c78f579b3d9601011f7770e2c17ffb223116eb9d7739394d09005408e65928","impliedFormat":99},{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true,"impliedFormat":1},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a","impliedFormat":1},{"version":"a79e62f1e20467e11a904399b8b18b18c0c6eea6b50c1168bf215356d5bebfaf","affectsGlobalScope":true,"impliedFormat":1},{"version":"49a5a44f2e68241a1d2bd9ec894535797998841c09729e506a7cbfcaa40f2180","affectsGlobalScope":true,"impliedFormat":1},{"version":"4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","impliedFormat":1},{"version":"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","impliedFormat":1},{"version":"763fe0f42b3d79b440a9b6e51e9ba3f3f91352469c1e4b3b67bfa4ff6352f3f4","impliedFormat":1},{"version":"25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","impliedFormat":1},{"version":"c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","impliedFormat":1},{"version":"78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","impliedFormat":1},{"version":"5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","impliedFormat":1},{"version":"7f182617db458e98fc18dfb272d40aa2fff3a353c44a89b2c0ccb3937709bfb5","impliedFormat":1},{"version":"cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","impliedFormat":1},{"version":"385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","impliedFormat":1},{"version":"9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","impliedFormat":1},{"version":"0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","impliedFormat":1},{"version":"11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","impliedFormat":1},{"version":"ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","impliedFormat":1},{"version":"4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","impliedFormat":1},{"version":"c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","impliedFormat":1},{"version":"13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","impliedFormat":1},{"version":"9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","impliedFormat":1},{"version":"4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","impliedFormat":1},{"version":"24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","impliedFormat":1},{"version":"ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","impliedFormat":1},{"version":"24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","impliedFormat":1},{"version":"dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","impliedFormat":1},{"version":"405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","impliedFormat":1},{"version":"0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","impliedFormat":1},{"version":"e61be3f894b41b7baa1fbd6a66893f2579bfad01d208b4ff61daef21493ef0a8","impliedFormat":1},{"version":"bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","impliedFormat":1},{"version":"89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","impliedFormat":1},{"version":"615ba88d0128ed16bf83ef8ccbb6aff05c3ee2db1cc0f89ab50a4939bfc1943f","impliedFormat":1},{"version":"a4d551dbf8746780194d550c88f26cf937caf8d56f102969a110cfaed4b06656","impliedFormat":1},{"version":"8bd86b8e8f6a6aa6c49b71e14c4ffe1211a0e97c80f08d2c8cc98838006e4b88","impliedFormat":1},{"version":"317e63deeb21ac07f3992f5b50cdca8338f10acd4fbb7257ebf56735bf52ab00","impliedFormat":1},{"version":"4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107","impliedFormat":1},{"version":"1ca84b44ad1d8e4576f24904d8b95dd23b94ea67e1575f89614ac90062fc67f4","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d586db0a09a9495ebb5dece28f54df9684bfbd6e1f568426ca153126dac4a40","impliedFormat":1},{"version":"7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","impliedFormat":1},{"version":"8c0bcd6c6b67b4b503c11e91a1fb91522ed585900eab2ab1f61bba7d7caa9d6f","impliedFormat":1},{"version":"567b7f607f400873151d7bc63a049514b53c3c00f5f56e9e95695d93b66a138e","affectsGlobalScope":true,"impliedFormat":1},{"version":"f3e58c4c18a031cbb17abec7a4ad0bd5ae9fc70c1f4ba1e7fb921ad87c504aca","impliedFormat":1},{"version":"84c1930e33d1bb12ad01bcbe11d656f9646bd21b2fb2afd96e8e10615a021aef","impliedFormat":1},{"version":"35ec8b6760fd7138bbf5809b84551e31028fb2ba7b6dc91d95d098bf212ca8b4","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"4b87f767c7bc841511113c876a6b8bf1fd0cb0b718c888ad84478b372ec486b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d04e3640dd9eb67f7f1e5bd3d0bf96c784666f7aefc8ac1537af6f2d38d4c29","impliedFormat":1},{"version":"9d19808c8c291a9010a6c788e8532a2da70f811adb431c97520803e0ec649991","impliedFormat":1},{"version":"2bf469abae4cc9c0f340d4e05d9d26e37f936f9c8ca8f007a6534f109dcc77e4","impliedFormat":1},{"version":"4aacb0dd020eeaef65426153686cc639a78ec2885dc72ad220be1d25f1a439df","impliedFormat":1},{"version":"f0bd7e6d931657b59605c44112eaf8b980ba7f957a5051ed21cb93d978cf2f45","impliedFormat":1},{"version":"71450bbc2d82821d24ca05699a533e72758964e9852062c53b30f31c36978ab8","affectsGlobalScope":true,"impliedFormat":1},{"version":"0ada07543808f3b967624645a8e1ccd446f8b01ade47842acf1328aec899fed0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4c21aaa8257d7950a5b75a251d9075b6a371208fc948c9c8402f6690ef3b5b55","impliedFormat":1},{"version":"b5895e6353a5d708f55d8685c38a235c3a6d8138e374dee8ceb8ffde5aa8002a","impliedFormat":1},{"version":"54c4f21f578864961efc94e8f42bc893a53509e886370ec7dd602e0151b9266c","impliedFormat":1},{"version":"de735eca2c51dd8b860254e9fdb6d9ec19fe402dfe597c23090841ce3937cfc5","impliedFormat":1},{"version":"4ff41188773cbf465807dd2f7059c7494cbee5115608efc297383832a1150c43","impliedFormat":1},{"version":"5650cf3dace09e7c25d384e3e6b818b938f68f4e8de96f52d9c5a1b3db068e86","impliedFormat":1},{"version":"1354ca5c38bd3fd3836a68e0f7c9f91f172582ba30ab15bb8c075891b91502b7","affectsGlobalScope":true,"impliedFormat":1},{"version":"5155da3047ef977944d791a2188ff6e6c225f6975cc1910ab7bb6838ab84cede","impliedFormat":1},{"version":"93f437e1398a4f06a984f441f7fa7a9f0535c04399619b5c22e0b87bdee182cb","impliedFormat":1},{"version":"afbe24ab0d74694372baa632ecb28bb375be53f3be53f9b07ecd7fc994907de5","impliedFormat":1},{"version":"e16d218a30f6a6810b57f7e968124eaa08c7bb366133ea34bbf01e7cd6b8c0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb8692dea24c27821f77e397272d9ed2eda0b95e4a75beb0fdda31081d15a8ae","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e043a1bc8fbf2a255bccf9bf27e0f1caf916c3b0518ea34aa72357c0afd42ec","impliedFormat":1},{"version":"b4f70ec656a11d570e1a9edce07d118cd58d9760239e2ece99306ee9dfe61d02","impliedFormat":1},{"version":"3bc2f1e2c95c04048212c569ed38e338873f6a8593930cf5a7ef24ffb38fc3b6","impliedFormat":1},{"version":"8145e07aad6da5f23f2fcd8c8e4c5c13fb26ee986a79d03b0829b8fce152d8b2","impliedFormat":1},{"version":"f9d9d753d430ed050dc1bf2667a1bab711ccbb1c1507183d794cc195a5b085cc","impliedFormat":1},{"version":"9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","impliedFormat":1},{"version":"5b6844ad931dcc1d3aca53268f4bd671428421464b1286746027aede398094f2","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"125d792ec6c0c0f657d758055c494301cc5fdb327d9d9d5960b3f129aff76093","impliedFormat":1},{"version":"0dbcebe2126d03936c70545e96a6e41007cf065be38a1ce4d32a39fcedefead4","affectsGlobalScope":true,"impliedFormat":1},{"version":"1851a3b4db78664f83901bb9cac9e45e03a37bb5933cc5bf37e10bb7e91ab4eb","impliedFormat":1},{"version":"461e54289e6287e8494a0178ba18182acce51a02bca8dea219149bf2cf96f105","impliedFormat":1},{"version":"12ed4559eba17cd977aa0db658d25c4047067444b51acfdcbf38470630642b23","affectsGlobalScope":true,"impliedFormat":1},{"version":"f3ffabc95802521e1e4bcba4c88d8615176dc6e09111d920c7a213bdda6e1d65","impliedFormat":1},{"version":"e31e51c55800014d926e3f74208af49cb7352803619855c89296074d1ecbb524","impliedFormat":1},{"version":"ae56f65caf3be91108707bd8dfbccc2a57a91feb5daabf7165a06a945545ed26","impliedFormat":1},{"version":"a136d5de521da20f31631a0a96bf712370779d1c05b7015d7019a9b2a0446ca9","impliedFormat":1},{"version":"dfb96ba5177b68003deec9e773c47257da5c4c8a74053d8956389d832df72002","affectsGlobalScope":true,"impliedFormat":1},{"version":"92d3070580cf72b4bb80959b7f16ede9a3f39e6f4ef2ac87cfa4561844fdc69f","affectsGlobalScope":true,"impliedFormat":1},{"version":"d3dffd70e6375b872f0b4e152de4ae682d762c61a24881ecc5eb9f04c5caf76f","impliedFormat":1},{"version":"613deebaec53731ff6b74fe1a89f094b708033db6396b601df3e6d5ab0ec0a47","impliedFormat":1},{"version":"d91a7d8b5655c42986f1bdfe2105c4408f472831c8f20cf11a8c3345b6b56c8c","impliedFormat":1},{"version":"e56eb632f0281c9f8210eb8c86cc4839a427a4ffffcfd2a5e40b956050b3e042","affectsGlobalScope":true,"impliedFormat":1},{"version":"e8a979b8af001c9fc2e774e7809d233c8ca955a28756f52ee5dee88ccb0611d2","impliedFormat":1},{"version":"cac793cc47c29e26e4ac3601dcb00b4435ebed26203485790e44f2ad8b6ad847","impliedFormat":1}],"root":[[62,65]],"options":{"composite":true,"declarationMap":true,"emitDeclarationOnly":false,"emitDecoratorMetadata":true,"experimentalDecorators":true,"importHelpers":true,"module":199,"noEmitOnError":true,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noImplicitReturns":true,"noUnusedLocals":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"strict":true,"target":9,"tsBuildInfoFile":"./tsconfig.lib.tsbuildinfo"},"referencedMap":[[65,1],[62,2],[64,3],[63,4],[61,5],[60,6],[111,7],[112,7],[113,8],[71,9],[114,10],[115,11],[116,12],[66,6],[69,13],[67,6],[68,6],[117,14],[118,15],[119,16],[120,17],[121,18],[122,19],[123,19],[125,6],[124,20],[126,21],[127,22],[128,23],[110,24],[70,6],[129,25],[130,26],[131,27],[163,28],[132,29],[133,30],[134,31],[135,32],[136,33],[137,34],[138,35],[139,36],[140,37],[141,38],[142,38],[143,39],[144,6],[145,40],[147,41],[146,42],[148,43],[149,44],[150,45],[151,46],[152,47],[153,48],[154,49],[155,50],[156,51],[157,52],[158,53],[159,54],[160,55],[161,56],[162,57],[72,6],[59,58],[58,6],[56,6],[57,6],[11,6],[10,6],[2,6],[12,6],[13,6],[14,6],[15,6],[16,6],[17,6],[18,6],[19,6],[3,6],[20,6],[21,6],[4,6],[22,6],[26,6],[23,6],[24,6],[25,6],[27,6],[28,6],[29,6],[5,6],[30,6],[31,6],[32,6],[33,6],[6,6],[37,6],[34,6],[35,6],[36,6],[38,6],[7,6],[39,6],[44,6],[45,6],[40,6],[41,6],[42,6],[43,6],[8,6],[49,6],[46,6],[47,6],[48,6],[50,6],[9,6],[51,6],[52,6],[53,6],[55,6],[54,6],[1,6],[88,59],[98,60],[87,59],[108,61],[79,62],[78,63],[107,64],[101,65],[106,66],[81,67],[95,68],[80,69],[104,70],[76,71],[75,64],[105,72],[77,73],[82,74],[83,6],[86,74],[73,6],[109,75],[99,76],[90,77],[91,78],[93,79],[89,80],[92,81],[102,64],[84,82],[85,83],[94,84],[74,85],[97,76],[96,74],[100,6],[103,86]],"latestChangedDtsFile":"./index.d.ts","version":"5.9.3"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lagless/math",
|
|
3
|
+
"version": "0.0.33",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/ppauel/lagless",
|
|
8
|
+
"directory": "libs/math"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"module": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": "./package.json",
|
|
16
|
+
".": {
|
|
17
|
+
"@lagless/source": "./src/index.ts",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"tslib": "^2.3.0",
|
|
25
|
+
"@lagless/deterministic-math": "^0.1.8"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
}
|
|
34
|
+
}
|