@woosh/meep-engine 2.96.0 → 2.98.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/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +892 -687
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +892 -687
- package/package.json +1 -1
- package/src/core/binary/BitSet.d.ts +2 -2
- package/src/core/binary/BitSet.d.ts.map +1 -1
- package/src/core/binary/BitSet.js +8 -5
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.js +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_generic.js +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.js +3 -2
- package/src/core/collection/array/arrayQuickSort.js +2 -2
- package/src/core/collection/array/array_compute_max.d.ts +9 -0
- package/src/core/collection/array/array_compute_max.d.ts.map +1 -0
- package/src/core/collection/array/{computeArrayMax.js → array_compute_max.js} +1 -1
- package/src/core/collection/array/array_compute_min.d.ts +9 -0
- package/src/core/collection/array/array_compute_min.d.ts.map +1 -0
- package/src/core/collection/array/{computeArrayMin.js → array_compute_min.js} +1 -1
- package/src/core/collection/array/array_compute_min_max.d.ts.map +1 -1
- package/src/core/collection/array/array_compute_min_max.js +1 -0
- package/src/core/collection/array/array_swap.d.ts.map +1 -1
- package/src/core/collection/array/array_swap.js +11 -8
- package/src/core/collection/array/array_swap_one.d.ts +8 -0
- package/src/core/collection/array/array_swap_one.d.ts.map +1 -0
- package/src/core/collection/array/{arraySwapElements.js → array_swap_one.js} +1 -1
- package/src/core/collection/array/iterator/AbstractArrayIterator.d.ts.map +1 -0
- package/src/core/collection/array/iterator/ArrayIteratorRandom.d.ts.map +1 -0
- package/src/core/collection/array/{ArrayIteratorRandom.js → iterator/ArrayIteratorRandom.js} +2 -2
- package/src/core/collection/array/iterator/ArrayIteratorSequential.d.ts.map +1 -0
- package/src/core/collection/array/randomizeArrayElementOrder.js +2 -2
- package/src/core/collection/map/HashMap.js +10 -10
- package/src/core/collection/map/ObservedMap.d.ts +7 -4
- package/src/core/collection/map/ObservedMap.d.ts.map +1 -1
- package/src/core/collection/map/ObservedMap.js +4 -1
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +82 -36
- package/src/core/geom/3d/aabb/aabb3_intersects_ray.js +10 -10
- package/src/core/graph/v2/Graph.d.ts.map +1 -1
- package/src/core/graph/v2/Graph.js +9 -0
- package/src/core/math/spline/computeNonuniformCaltmullRomSplineDerivative.d.ts +16 -0
- package/src/core/math/spline/computeNonuniformCaltmullRomSplineDerivative.d.ts.map +1 -0
- package/src/core/math/spline/computeNonuniformCaltmullRomSplineDerivative.js +90 -0
- package/src/core/parser/simple/ParserError.d.ts +11 -6
- package/src/core/parser/simple/ParserError.d.ts.map +1 -1
- package/src/core/parser/simple/ParserError.js +51 -4
- package/src/core/parser/simple/Token.d.ts.map +1 -1
- package/src/core/parser/simple/Token.js +8 -2
- package/src/core/parser/simple/TokenType.d.ts +1 -5
- package/src/core/parser/simple/TokenType.d.ts.map +1 -1
- package/src/core/parser/simple/TokenType.js +1 -1
- package/src/core/parser/simple/readBooleanToken.d.ts.map +1 -1
- package/src/core/parser/simple/readBooleanToken.js +6 -1
- package/src/core/parser/simple/readHexToken.d.ts.map +1 -1
- package/src/core/parser/simple/readHexToken.js +7 -2
- package/src/core/parser/simple/readIdentifierToken.d.ts.map +1 -1
- package/src/core/parser/simple/readIdentifierToken.js +6 -1
- package/src/core/parser/simple/readLiteralToken.d.ts.map +1 -1
- package/src/core/parser/simple/readLiteralToken.js +8 -3
- package/src/core/parser/simple/readNumberToken.d.ts.map +1 -1
- package/src/core/parser/simple/readNumberToken.js +7 -2
- package/src/core/parser/simple/readReferenceToken.d.ts.map +1 -1
- package/src/core/parser/simple/readReferenceToken.js +6 -1
- package/src/core/parser/simple/readStringToken.d.ts.map +1 -1
- package/src/core/parser/simple/readStringToken.js +6 -1
- package/src/core/parser/simple/readUnsignedIntegerToken.d.ts.map +1 -1
- package/src/core/parser/simple/readUnsignedIntegerToken.js +7 -2
- package/src/core/parser/simple/skipWhitespace.d.ts.map +1 -1
- package/src/core/parser/simple/skipWhitespace.js +8 -0
- package/src/core/primitives/strings/string_jaro_distance.d.ts +10 -0
- package/src/core/primitives/strings/string_jaro_distance.d.ts.map +1 -0
- package/src/core/primitives/strings/string_jaro_distance.js +127 -0
- package/src/core/primitives/strings/string_jaro_winkler.d.ts.map +1 -1
- package/src/core/primitives/strings/string_jaro_winkler.js +5 -105
- package/src/core/primitives/strings/string_repeat.d.ts +9 -0
- package/src/core/primitives/strings/string_repeat.d.ts.map +1 -0
- package/src/core/primitives/strings/string_repeat.js +26 -0
- package/src/engine/asset/AssetManager.d.ts.map +1 -1
- package/src/engine/development/performance/RingBufferMetric.d.ts.map +1 -1
- package/src/engine/development/performance/RingBufferMetric.js +5 -5
- package/src/engine/ecs/terrain/ecs/BuildLightTexture.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/BuildLightTexture.js +15 -22
- package/src/engine/graphics/ecs/camera/Camera.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/Camera.js +23 -16
- package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +142 -10
- package/src/engine/graphics/ecs/path/tube/build/TubePathBuilder.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/TubePathBuilder.js +9 -9
- package/src/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.js +173 -23
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +16 -2
- package/src/engine/graphics/filter/ImageFilter.d.ts +2 -2
- package/src/engine/graphics/filter/ImageFilter.d.ts.map +1 -1
- package/src/engine/graphics/filter/ImageFilter.js +3 -3
- package/src/engine/graphics/render/RendererPool.d.ts +14 -1
- package/src/engine/graphics/render/RendererPool.d.ts.map +1 -1
- package/src/engine/graphics/render/RendererPool.js +43 -1
- package/src/engine/graphics/render/forward_plus/LightManager.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts +2 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +23 -50
- package/src/engine/graphics/sh3/path_tracer/getBiasedNormalSample.d.ts +9 -0
- package/src/engine/graphics/sh3/path_tracer/getBiasedNormalSample.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/getBiasedNormalSample.js +53 -3
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +3 -3
- package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.d.ts +1 -1
- package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.js +42 -36
- package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler.d.ts +3 -0
- package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler.js +34 -0
- package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler_grid.d.ts +10 -0
- package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler_grid.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler_grid.js +89 -0
- package/src/engine/graphics/texture/sampler/debug/prototypeSamplerFiltering.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/{prototypeSamplerFiltering.js → debug/prototypeSamplerFiltering.js} +105 -113
- package/src/generation/grid/generation/GridTaskDensityMarkerDistribution.d.ts.map +1 -1
- package/src/generation/grid/generation/GridTaskDensityMarkerDistribution.js +8 -8
- package/src/generation/markers/GridActionRuleSet.d.ts.map +1 -1
- package/src/generation/markers/GridActionRuleSet.js +5 -5
- package/src/core/binary/byteArrayToString.d.ts +0 -9
- package/src/core/binary/byteArrayToString.d.ts.map +0 -1
- package/src/core/binary/byteArrayToString.js +0 -28
- package/src/core/collection/array/AbstractArrayIterator.d.ts.map +0 -1
- package/src/core/collection/array/ArrayIteratorRandom.d.ts.map +0 -1
- package/src/core/collection/array/ArrayIteratorSequential.d.ts.map +0 -1
- package/src/core/collection/array/arrayPickMinElement.d.ts +0 -8
- package/src/core/collection/array/arrayPickMinElement.d.ts.map +0 -1
- package/src/core/collection/array/arrayPickMinElement.js +0 -43
- package/src/core/collection/array/arraySwapElements.d.ts +0 -8
- package/src/core/collection/array/arraySwapElements.d.ts.map +0 -1
- package/src/core/collection/array/computeArrayMax.d.ts +0 -9
- package/src/core/collection/array/computeArrayMax.d.ts.map +0 -1
- package/src/core/collection/array/computeArrayMin.d.ts +0 -9
- package/src/core/collection/array/computeArrayMin.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/prototypeSamplerFiltering.d.ts.map +0 -1
- /package/src/core/collection/array/{AbstractArrayIterator.d.ts → iterator/AbstractArrayIterator.d.ts} +0 -0
- /package/src/core/collection/array/{AbstractArrayIterator.js → iterator/AbstractArrayIterator.js} +0 -0
- /package/src/core/collection/array/{ArrayIteratorRandom.d.ts → iterator/ArrayIteratorRandom.d.ts} +0 -0
- /package/src/core/collection/array/{ArrayIteratorSequential.d.ts → iterator/ArrayIteratorSequential.d.ts} +0 -0
- /package/src/core/collection/array/{ArrayIteratorSequential.js → iterator/ArrayIteratorSequential.js} +0 -0
- /package/src/engine/graphics/texture/sampler/{prototypeSamplerFiltering.d.ts → debug/prototypeSamplerFiltering.d.ts} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { assert } from "../../assert.js";
|
|
1
2
|
import { ceilPowerOfTwo } from "../../binary/operations/ceilPowerOfTwo.js";
|
|
3
|
+
import { UINT32_MAX } from "../../binary/UINT32_MAX.js";
|
|
2
4
|
import { max2 } from "../../math/max2.js";
|
|
3
5
|
import { array_copy } from "../array/array_copy.js";
|
|
4
|
-
import { assert } from "../../assert.js";
|
|
5
6
|
|
|
6
7
|
const DEFAULT_SIZE = 16;
|
|
7
8
|
|
|
@@ -16,12 +17,13 @@ const STATUS_NORMAL = 2;
|
|
|
16
17
|
export class Deque {
|
|
17
18
|
/**
|
|
18
19
|
* @template T
|
|
20
|
+
* @param {number} [min_size]
|
|
19
21
|
*/
|
|
20
|
-
constructor(
|
|
22
|
+
constructor(min_size = DEFAULT_SIZE) {
|
|
21
23
|
|
|
22
|
-
assert.isNonNegativeInteger(
|
|
24
|
+
assert.isNonNegativeInteger(min_size, 'minSize');
|
|
23
25
|
|
|
24
|
-
const size = ceilPowerOfTwo(max2(1,
|
|
26
|
+
const size = ceilPowerOfTwo(max2(1, min_size));
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Using static array allocator to preserve data locality.
|
|
@@ -32,15 +34,31 @@ export class Deque {
|
|
|
32
34
|
*/
|
|
33
35
|
this.__data = new Array(size);
|
|
34
36
|
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @type {number}
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
35
42
|
this.__head = 0;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @type {number}
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
36
48
|
this.__tail = 0;
|
|
37
49
|
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @type {number}
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
38
55
|
this.__status = STATUS_EMPTY;
|
|
39
56
|
}
|
|
40
57
|
|
|
41
58
|
/**
|
|
42
59
|
*
|
|
43
60
|
* @param {boolean} adding
|
|
61
|
+
* @private
|
|
44
62
|
*/
|
|
45
63
|
resetStatus(adding) {
|
|
46
64
|
const head = this.__head;
|
|
@@ -59,11 +77,12 @@ export class Deque {
|
|
|
59
77
|
* @returns {number}
|
|
60
78
|
* @private
|
|
61
79
|
*/
|
|
62
|
-
|
|
63
|
-
// TODO this can be done faster using mod operator (%)
|
|
80
|
+
__circular_next_position(current) {
|
|
64
81
|
const next = current + 1;
|
|
65
82
|
|
|
66
|
-
|
|
83
|
+
const length = this.__data.length;
|
|
84
|
+
|
|
85
|
+
return (next >= length) ? 0 : next;
|
|
67
86
|
}
|
|
68
87
|
|
|
69
88
|
/**
|
|
@@ -72,43 +91,57 @@ export class Deque {
|
|
|
72
91
|
* @returns {number}
|
|
73
92
|
* @private
|
|
74
93
|
*/
|
|
75
|
-
|
|
94
|
+
__circular_previous_position(current) {
|
|
76
95
|
const prev = current - 1;
|
|
77
96
|
return (prev < 0) ? (this.__data.length - 1) : prev;
|
|
78
97
|
}
|
|
79
98
|
|
|
80
|
-
|
|
99
|
+
__check_and_expand() {
|
|
81
100
|
const status = this.__status;
|
|
101
|
+
|
|
82
102
|
if (status !== STATUS_FULL) {
|
|
103
|
+
// queue still has space, we're done
|
|
83
104
|
return;
|
|
84
105
|
}
|
|
106
|
+
|
|
85
107
|
const length = this.__data.length;
|
|
86
108
|
|
|
87
|
-
if (
|
|
109
|
+
if (UINT32_MAX === length) {
|
|
88
110
|
throw new Error('Maximum array size exceeded');
|
|
89
111
|
}
|
|
90
112
|
|
|
91
|
-
let
|
|
113
|
+
let new_length = length * 2;
|
|
114
|
+
|
|
92
115
|
// bigger than Integer.MAX_VALUE
|
|
93
|
-
if (
|
|
94
|
-
|
|
116
|
+
if (new_length > UINT32_MAX) {
|
|
117
|
+
new_length = UINT32_MAX;
|
|
95
118
|
}
|
|
96
119
|
|
|
97
|
-
|
|
120
|
+
/**
|
|
121
|
+
*
|
|
122
|
+
* @type {T[]}
|
|
123
|
+
*/
|
|
124
|
+
const new_data = new Array(new_length);
|
|
98
125
|
|
|
99
|
-
// copy front portion of data
|
|
100
126
|
const head = this.__head;
|
|
101
127
|
|
|
102
|
-
|
|
103
|
-
array_copy(this.__data,
|
|
128
|
+
// copy the front portion
|
|
129
|
+
array_copy(this.__data, head, new_data, 0, length - head);
|
|
130
|
+
// copy the remainder
|
|
131
|
+
array_copy(this.__data, 0, new_data, length - head, head);
|
|
104
132
|
|
|
105
133
|
this.__head = 0;
|
|
106
134
|
this.__tail = length;
|
|
135
|
+
|
|
107
136
|
this.__status = STATUS_NORMAL;
|
|
108
137
|
|
|
109
|
-
this.__data =
|
|
138
|
+
this.__data = new_data;
|
|
110
139
|
}
|
|
111
140
|
|
|
141
|
+
/**
|
|
142
|
+
*
|
|
143
|
+
* @return {boolean}
|
|
144
|
+
*/
|
|
112
145
|
isEmpty() {
|
|
113
146
|
return this.size() === 0;
|
|
114
147
|
}
|
|
@@ -120,7 +153,7 @@ export class Deque {
|
|
|
120
153
|
|
|
121
154
|
do {
|
|
122
155
|
this.__data[cursor] = undefined;
|
|
123
|
-
cursor = this.
|
|
156
|
+
cursor = this.__circular_next_position(cursor);
|
|
124
157
|
} while (cursor !== tail);
|
|
125
158
|
|
|
126
159
|
this.__status = STATUS_EMPTY;
|
|
@@ -149,32 +182,45 @@ export class Deque {
|
|
|
149
182
|
/**
|
|
150
183
|
*
|
|
151
184
|
* @param {number} current
|
|
152
|
-
* @param {boolean}
|
|
185
|
+
* @param {boolean} shift_front should we shift elements before the removed element or after?
|
|
153
186
|
* @private
|
|
154
187
|
*/
|
|
155
|
-
|
|
188
|
+
__remove_internal(current, shift_front) {
|
|
156
189
|
let cursor = current;
|
|
157
|
-
|
|
190
|
+
|
|
191
|
+
if (shift_front) {
|
|
192
|
+
|
|
193
|
+
// shift towards tail
|
|
194
|
+
|
|
158
195
|
const head = this.__head;
|
|
196
|
+
|
|
159
197
|
while (cursor !== head) {
|
|
160
|
-
const next = this.
|
|
198
|
+
const next = this.__circular_previous_position(cursor);
|
|
161
199
|
this.__data[cursor] = this.__data[next];
|
|
162
200
|
cursor = next;
|
|
163
201
|
}
|
|
164
|
-
|
|
202
|
+
|
|
203
|
+
this.__head = this.__circular_next_position(head);
|
|
204
|
+
|
|
165
205
|
} else {
|
|
206
|
+
|
|
207
|
+
// shift towards head
|
|
208
|
+
|
|
166
209
|
const tail = this.__tail;
|
|
167
210
|
|
|
168
211
|
while (cursor !== tail) {
|
|
169
|
-
const next = this.
|
|
212
|
+
const next = this.__circular_next_position(cursor);
|
|
170
213
|
this.__data[cursor] = this.__data[next];
|
|
171
214
|
cursor = next;
|
|
172
215
|
}
|
|
173
216
|
|
|
174
|
-
this.__tail = this.
|
|
217
|
+
this.__tail = this.__circular_previous_position(tail);
|
|
218
|
+
|
|
175
219
|
}
|
|
176
220
|
|
|
221
|
+
// fill in slot of last moved element
|
|
177
222
|
this.__data[cursor] = undefined;
|
|
223
|
+
|
|
178
224
|
this.resetStatus(false);
|
|
179
225
|
}
|
|
180
226
|
|
|
@@ -190,7 +236,7 @@ export class Deque {
|
|
|
190
236
|
return false;
|
|
191
237
|
}
|
|
192
238
|
|
|
193
|
-
this.
|
|
239
|
+
this.__remove_internal(i, true);
|
|
194
240
|
|
|
195
241
|
return true;
|
|
196
242
|
}
|
|
@@ -234,20 +280,20 @@ export class Deque {
|
|
|
234
280
|
* @param {T} e
|
|
235
281
|
*/
|
|
236
282
|
addFirst(e) {
|
|
237
|
-
this.
|
|
238
|
-
this.__head = this.
|
|
283
|
+
this.__check_and_expand();
|
|
284
|
+
this.__head = this.__circular_previous_position(this.__head);
|
|
239
285
|
this.__data[this.__head] = e;
|
|
240
286
|
this.resetStatus(true);
|
|
241
287
|
}
|
|
242
288
|
|
|
243
289
|
/**
|
|
244
290
|
* Remove element from the front of the queue
|
|
245
|
-
* @returns {T}
|
|
291
|
+
* @returns {T|undefined}
|
|
246
292
|
*/
|
|
247
293
|
removeFirst() {
|
|
248
294
|
const element = this.__data[this.__head];
|
|
249
295
|
this.__data[this.__head] = undefined;
|
|
250
|
-
this.__head = this.
|
|
296
|
+
this.__head = this.__circular_next_position(this.__head);
|
|
251
297
|
this.resetStatus(false);
|
|
252
298
|
return element;
|
|
253
299
|
}
|
|
@@ -265,9 +311,9 @@ export class Deque {
|
|
|
265
311
|
* @param {T} e
|
|
266
312
|
*/
|
|
267
313
|
addLast(e) {
|
|
268
|
-
this.
|
|
314
|
+
this.__check_and_expand();
|
|
269
315
|
this.__data[this.__tail] = e;
|
|
270
|
-
this.__tail = this.
|
|
316
|
+
this.__tail = this.__circular_next_position(this.__tail);
|
|
271
317
|
this.resetStatus(true);
|
|
272
318
|
}
|
|
273
319
|
|
|
@@ -276,7 +322,7 @@ export class Deque {
|
|
|
276
322
|
* @returns {T}
|
|
277
323
|
*/
|
|
278
324
|
removeLast() {
|
|
279
|
-
const last = this.
|
|
325
|
+
const last = this.__circular_previous_position(this.__tail);
|
|
280
326
|
const element = this.__data[last];
|
|
281
327
|
this.__data[last] = undefined;
|
|
282
328
|
this.__tail = last;
|
|
@@ -287,10 +333,10 @@ export class Deque {
|
|
|
287
333
|
|
|
288
334
|
/**
|
|
289
335
|
* Peek element from the end of the queue without removing it
|
|
290
|
-
* @returns {T}
|
|
336
|
+
* @returns {T|undefined}
|
|
291
337
|
*/
|
|
292
338
|
getLast() {
|
|
293
|
-
const last = this.
|
|
339
|
+
const last = this.__circular_previous_position(this.__tail);
|
|
294
340
|
return this.__data[last];
|
|
295
341
|
}
|
|
296
342
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const abs = Math.abs;
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* NOTES:
|
|
@@ -35,7 +35,7 @@ export function aabb3_intersects_ray(
|
|
|
35
35
|
const diff_x = origin_x - center_x;
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
if (diff_x * direction_x >= 0.0 &&
|
|
38
|
+
if (diff_x * direction_x >= 0.0 && abs(diff_x) > extents_x) {
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -47,7 +47,7 @@ export function aabb3_intersects_ray(
|
|
|
47
47
|
const diff_y = origin_y - center_y;
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
if (diff_y * direction_y >= 0.0 &&
|
|
50
|
+
if (diff_y * direction_y >= 0.0 && abs(diff_y) > extents_y) {
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -59,28 +59,28 @@ export function aabb3_intersects_ray(
|
|
|
59
59
|
const diff_z = origin_z - center_z;
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
if (diff_z * direction_z >= 0.0 &&
|
|
62
|
+
if (diff_z * direction_z >= 0.0 && abs(diff_z) > extents_z) {
|
|
63
63
|
return false;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
const abs_direction_y =
|
|
67
|
-
const abs_direction_z =
|
|
66
|
+
const abs_direction_y = abs(direction_y);
|
|
67
|
+
const abs_direction_z = abs(direction_z);
|
|
68
68
|
|
|
69
|
-
const f0 =
|
|
69
|
+
const f0 = abs(direction_y * diff_z - direction_z * diff_y);
|
|
70
70
|
|
|
71
71
|
if (f0 > extents_y * abs_direction_z + extents_z * abs_direction_y) {
|
|
72
72
|
return false;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const abs_direction_x =
|
|
75
|
+
const abs_direction_x = abs(direction_x);
|
|
76
76
|
|
|
77
|
-
const f1 =
|
|
77
|
+
const f1 = abs(direction_z * diff_x - direction_x * diff_z);
|
|
78
78
|
|
|
79
79
|
if (f1 > extents_x * abs_direction_z + extents_z * abs_direction_x) {
|
|
80
80
|
return false;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
const f2 =
|
|
83
|
+
const f2 = abs(direction_x * diff_y - direction_y * diff_x);
|
|
84
84
|
|
|
85
85
|
return f2 <= extents_x * abs_direction_y + extents_y * abs_direction_x;
|
|
86
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../../../src/core/graph/v2/Graph.js"],"names":[],"mappings":"AAyBA;;GAEG;AACH;IAEI;;;;;OAKG;IACH,yBAAoB;IACpB;;;;;OAKG;IACH,yBAAoB;IAEpB;;OAEG;IACH;QACI;;WAEG;mBADO,OAAO,CAAC,EAAC,IAAI,CAAC;QAGxB;;WAEG;qBADO,OAAO,CAAC,EAAC,IAAI,CAAC;;;MAK1B;IAGF;;;;OAIG;IACH,cAHW,CAAC,GACC,OAAO,CAInB;IAED;;;;OAIG;IACH,cAHW,CAAC,GACC,OAAO,CAenB;IAED;;;;OAIG;IACH,iBAHW,CAAC,GACC,OAAO,CAiBnB;IAED;;;;OAIG;IACH,8BAHoB,CAAC,+BAOpB;IAED,wBAEC;IAED;;;OAGG;IACH,gBAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,wBAJoB,CAAC,KAAE,OAAO,kBAEjB,CAAC,GAAC,SAAS,CAgBvB;IAED;;;;OAIG;IACH,uBAHW,CAAC,GACC,cAAc,CAAC,CAAC,GAAC,SAAS,CAItC;IAED;;;;OAIG;IACH,oBAHW,CAAC,GACA,MAAM,CAUjB;IAED;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IACH,YAFY,SAAS,CAAC,CAAC,CAItB;IAED;;;OAGG;IACH,YAFY,IAAI,KAAK,CAAC,CAAC,CAAC,CAIvB;IAED;;;;;;OAMG;IACH,mBALW,CAAC,UACD,CAAC,cACD,iBAAiB,GACf,KAAK,CAAC,CAAC,CAgBnB;IAED;;;;;OAKG;IACH,cAJW,KAAK,CAAC,CAAC,GACL,OAAO,CA4BnB;IAED;;;;OAIG;IACH,iBAHW,KAAK,CAAC,CAAC,GACL,OAAO,CAwBnB;IAED;;;;OAIG;IACH,cAHW,KAAK,CAAC,CAAC,GACL,OAAO,CAQnB;IAED;;;;OAIG;IACH,8BAHoB,KAAK,CAAC,CAAC,+BAO1B;IAED,wBAEC;IAED;;;;;OAKG;IACH,qBAJW,CAAC,KACD,CAAC,GACC,OAAO,CAWnB;IAED;;;;;OAKG;IACH,qBAJW,CAAC,KACD,CAAC,GACC,KAAK,CAAC,CAAC,GAAC,SAAS,CAiB7B;IAED;;;;;OAKG;IACH,yBAJW,CAAC,MACD,CAAC,GACC,KAAK,CAAC,CAAC,GAAC,SAAS,CAU7B;IAED;;;;;OAKG;IACH,yBAJW,KAAK,CAAC,CAAC,EAAE,QACT,CAAC,GACC,MAAM,CA2BlB;IAED;;;;OAIG;IACH,oBAHW,CAAC,GACC,CAAC,EAAE,CAUf;IAED;;;;OAIG;IACH,mBAHW,CAAC,GACC,OAAO,CAYnB;IAED;;;;;OAKG;IACH,gBAJW,CAAC,QACD,CAAC,GACC,IAAI,GAAC,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../../../src/core/graph/v2/Graph.js"],"names":[],"mappings":"AAyBA;;GAEG;AACH;IAEI;;;;;OAKG;IACH,yBAAoB;IACpB;;;;;OAKG;IACH,yBAAoB;IAEpB;;OAEG;IACH;QACI;;WAEG;mBADO,OAAO,CAAC,EAAC,IAAI,CAAC;QAGxB;;WAEG;qBADO,OAAO,CAAC,EAAC,IAAI,CAAC;;;MAK1B;IAGF;;;;OAIG;IACH,cAHW,CAAC,GACC,OAAO,CAInB;IAED;;;;OAIG;IACH,cAHW,CAAC,GACC,OAAO,CAenB;IAED;;;;OAIG;IACH,iBAHW,CAAC,GACC,OAAO,CAiBnB;IAED;;;;OAIG;IACH,8BAHoB,CAAC,+BAOpB;IAED,wBAEC;IAED;;;OAGG;IACH,gBAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,wBAJoB,CAAC,KAAE,OAAO,kBAEjB,CAAC,GAAC,SAAS,CAgBvB;IAED;;;;OAIG;IACH,uBAHW,CAAC,GACC,cAAc,CAAC,CAAC,GAAC,SAAS,CAItC;IAED;;;;OAIG;IACH,oBAHW,CAAC,GACA,MAAM,CAUjB;IAED;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IACH,YAFY,SAAS,CAAC,CAAC,CAItB;IAED;;;OAGG;IACH,YAFY,IAAI,KAAK,CAAC,CAAC,CAAC,CAIvB;IAED;;;;;;OAMG;IACH,mBALW,CAAC,UACD,CAAC,cACD,iBAAiB,GACf,KAAK,CAAC,CAAC,CAgBnB;IAED;;;;;OAKG;IACH,cAJW,KAAK,CAAC,CAAC,GACL,OAAO,CA4BnB;IAED;;;;OAIG;IACH,iBAHW,KAAK,CAAC,CAAC,GACL,OAAO,CAwBnB;IAED;;;;OAIG;IACH,cAHW,KAAK,CAAC,CAAC,GACL,OAAO,CAQnB;IAED;;;;OAIG;IACH,8BAHoB,KAAK,CAAC,CAAC,+BAO1B;IAED,wBAEC;IAED;;;;;OAKG;IACH,qBAJW,CAAC,KACD,CAAC,GACC,OAAO,CAWnB;IAED;;;;;OAKG;IACH,qBAJW,CAAC,KACD,CAAC,GACC,KAAK,CAAC,CAAC,GAAC,SAAS,CAiB7B;IAED;;;;;OAKG;IACH,yBAJW,CAAC,MACD,CAAC,GACC,KAAK,CAAC,CAAC,GAAC,SAAS,CAU7B;IAED;;;;;OAKG;IACH,yBAJW,KAAK,CAAC,CAAC,EAAE,QACT,CAAC,GACC,MAAM,CA2BlB;IAED;;;;OAIG;IACH,oBAHW,CAAC,GACC,CAAC,EAAE,CAUf;IAED;;;;OAIG;IACH,mBAHW,CAAC,GACC,OAAO,CAYnB;IAED;;;;;OAKG;IACH,gBAJW,CAAC,QACD,CAAC,GACC,IAAI,GAAC,CAAC,EAAE,CA4EpB;IAED;;OAEG;IACH,cAGC;IAED;;;OAGG;IACH,YAFW,MAAM,CAAC,CAAC,QAOlB;IAED;;OAEG;IACH,SAFa,MAAM,CAAC,CAAC,CAQpB;CACJ;mBAtiBkB,+BAA+B;8BAEpB,oBAAoB;qBADV,YAAY;kCAAZ,YAAY"}
|
|
@@ -446,8 +446,17 @@ export class Graph {
|
|
|
446
446
|
*/
|
|
447
447
|
findPath(start, goal) {
|
|
448
448
|
const start_node_container = this.__nodes.get(start);
|
|
449
|
+
|
|
450
|
+
if (start_node_container === undefined) {
|
|
451
|
+
throw new Error(`Start node not found in the graph '${start}'`);
|
|
452
|
+
}
|
|
453
|
+
|
|
449
454
|
const goal_node_container = this.__nodes.get(goal);
|
|
450
455
|
|
|
456
|
+
if (goal_node_container === undefined) {
|
|
457
|
+
throw new Error(`Goal node not found in the graph '${goal}'`);
|
|
458
|
+
}
|
|
459
|
+
|
|
451
460
|
const open = new Set();
|
|
452
461
|
open.add(start_node_container);
|
|
453
462
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computes derivative of Catmull Rom spline
|
|
3
|
+
* @param {number[]} result_value
|
|
4
|
+
* @param {number} result_value_offset
|
|
5
|
+
* @param {number[]} result_derivative
|
|
6
|
+
* @param {number} result_derivative_offset
|
|
7
|
+
* @param {number[]} p0 spline point 0
|
|
8
|
+
* @param {number[]} p1 spline point 1
|
|
9
|
+
* @param {number[]} p2 spline point 2
|
|
10
|
+
* @param {number[]} p3 spline point 3
|
|
11
|
+
* @param {number} dimensions number of dimensions in the input and output vectors
|
|
12
|
+
* @param {number} f between 0..1
|
|
13
|
+
* @param {number} alpha between 0..1
|
|
14
|
+
*/
|
|
15
|
+
export function computeNonuniformCaltmullRomSplineDerivative(result_value: number[], result_value_offset: number, result_derivative: number[], result_derivative_offset: number, p0: number[], p1: number[], p2: number[], p3: number[], dimensions: number, f: number, alpha: number): void;
|
|
16
|
+
//# sourceMappingURL=computeNonuniformCaltmullRomSplineDerivative.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeNonuniformCaltmullRomSplineDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/spline/computeNonuniformCaltmullRomSplineDerivative.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,2EAZW,MAAM,EAAE,uBACR,MAAM,qBACN,MAAM,EAAE,4BACR,MAAM,MACN,MAAM,EAAE,MACR,MAAM,EAAE,MACR,MAAM,EAAE,MACR,MAAM,EAAE,cACR,MAAM,KACN,MAAM,SACN,MAAM,QA2EhB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { catmull_rom_compute_T } from "./catmull_rom_compute_T.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Computes derivative of Catmull Rom spline
|
|
5
|
+
* @param {number[]} result_value
|
|
6
|
+
* @param {number} result_value_offset
|
|
7
|
+
* @param {number[]} result_derivative
|
|
8
|
+
* @param {number} result_derivative_offset
|
|
9
|
+
* @param {number[]} p0 spline point 0
|
|
10
|
+
* @param {number[]} p1 spline point 1
|
|
11
|
+
* @param {number[]} p2 spline point 2
|
|
12
|
+
* @param {number[]} p3 spline point 3
|
|
13
|
+
* @param {number} dimensions number of dimensions in the input and output vectors
|
|
14
|
+
* @param {number} f between 0..1
|
|
15
|
+
* @param {number} alpha between 0..1
|
|
16
|
+
*/
|
|
17
|
+
export function computeNonuniformCaltmullRomSplineDerivative(
|
|
18
|
+
result_value, result_value_offset,
|
|
19
|
+
result_derivative, result_derivative_offset,
|
|
20
|
+
p0, p1, p2, p3,
|
|
21
|
+
dimensions, f, alpha
|
|
22
|
+
) {
|
|
23
|
+
/*
|
|
24
|
+
@see https://math.stackexchange.com/questions/843595/how-can-i-calculate-the-derivative-of-a-catmull-rom-spline-with-nonuniform-param
|
|
25
|
+
@see http://denkovacs.com/2016/02/catmull-rom-spline-derivatives/
|
|
26
|
+
@see https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
const half_alpha = alpha * 0.5;
|
|
30
|
+
|
|
31
|
+
// calculate T
|
|
32
|
+
const t0 = 0;
|
|
33
|
+
let t_01 = catmull_rom_compute_T(p0, p1, dimensions, half_alpha);
|
|
34
|
+
let t_02 = catmull_rom_compute_T(p1, p2, dimensions, half_alpha);
|
|
35
|
+
let t_03 = catmull_rom_compute_T(p2, p3, dimensions, half_alpha);
|
|
36
|
+
|
|
37
|
+
// safety check for repeated points, to prevent division by 0
|
|
38
|
+
if (t_01 < 1e-4) {
|
|
39
|
+
t_01 = 1;
|
|
40
|
+
}
|
|
41
|
+
if (t_02 < 1e-4) {
|
|
42
|
+
t_02 = t_01;
|
|
43
|
+
}
|
|
44
|
+
if (t_03 < 1e-4) {
|
|
45
|
+
t_03 = t_02;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const t1 = t_01 + t0;
|
|
49
|
+
const t2 = t_02 + t1;
|
|
50
|
+
const t3 = t_03 + t2;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Interpolation between points 1 and 2
|
|
54
|
+
* @type {number}
|
|
55
|
+
*/
|
|
56
|
+
const t = t1 * (1 - f) + t2 * f;
|
|
57
|
+
|
|
58
|
+
for (let i = 0; i < dimensions; i++) {
|
|
59
|
+
// read vector values for the dimension
|
|
60
|
+
const v0 = p0[i];
|
|
61
|
+
const v1 = p1[i];
|
|
62
|
+
const v2 = p2[i];
|
|
63
|
+
const v3 = p3[i];
|
|
64
|
+
|
|
65
|
+
const A1 = (t1 - t) / (t1 - t0) * v0 + (t - t0) / (t1 - t0) * v1;
|
|
66
|
+
const A2 = (t2 - t) / (t2 - t1) * v1 + (t - t1) / (t2 - t1) * v2;
|
|
67
|
+
const A3 = (t3 - t) / (t3 - t2) * v2 + (t - t2) / (t3 - t2) * v3;
|
|
68
|
+
|
|
69
|
+
const B1 = (t2 - t) / (t2 - t0) * A1 + (t - t0) / (t2 - t0) * A2;
|
|
70
|
+
const B2 = (t3 - t) / (t3 - t1) * A2 + (t - t1) / (t3 - t1) * A3;
|
|
71
|
+
|
|
72
|
+
const C = (t2 - t) / (t2 - t1) * B1 + (t - t1) / (t2 - t1) * B2;
|
|
73
|
+
|
|
74
|
+
result_value[result_value_offset + i] = C;
|
|
75
|
+
|
|
76
|
+
// derivatives
|
|
77
|
+
|
|
78
|
+
const dA1 = (v1 - v0) / (t1 - t0)
|
|
79
|
+
const dA2 = (v2 - v1) / (t2 - t1);
|
|
80
|
+
const dA3 = (v3 - v2) / (t3 - t2);
|
|
81
|
+
|
|
82
|
+
const dB1 = (A2 - A1) / (t2 - t0) + dA1 * (t2 - t) / (t2 - t0) + dA2 * (t - t0) / (t2 - t0);
|
|
83
|
+
const dB2 = (A3 - A2) / (t3 - t1) + dA2 * (t3 - t) / (t3 - t1) + dA3 * (t - t1) / (t3 - t1);
|
|
84
|
+
|
|
85
|
+
const dC = (B2 - B1) / (t2 - t1) + dB1 * (t2 - t) / (t2 - t1) + dB2 * (t - t1) / (t2 - t1);
|
|
86
|
+
|
|
87
|
+
result_derivative[result_derivative_offset + i] = dC;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
export default ParserError;
|
|
2
|
-
declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
declare class ParserError extends Error {
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number} position
|
|
6
|
+
* @param {string} message
|
|
7
|
+
* @param {string} input
|
|
8
|
+
*/
|
|
9
|
+
constructor(position: number, message: string, input: string);
|
|
10
|
+
position: number;
|
|
11
|
+
input: string;
|
|
12
|
+
getDetails(): string;
|
|
8
13
|
}
|
|
9
14
|
//# sourceMappingURL=ParserError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParserError.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/ParserError.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ParserError.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/ParserError.js"],"names":[],"mappings":";AAKA;IACI;;;;;OAKG;IACH,sBAJW,MAAM,WACN,MAAM,SACN,MAAM,EAiBhB;IAHG,iBAAwB;IAExB,cAAkB;IAGtB,qBAiBC;CAKJ"}
|
|
@@ -1,7 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { assert } from "../../assert.js";
|
|
2
|
+
import { max2 } from "../../math/max2.js";
|
|
3
|
+
import { min2 } from "../../math/min2.js";
|
|
4
|
+
import { string_repeat } from "../../primitives/strings/string_repeat.js";
|
|
5
|
+
|
|
6
|
+
class ParserError extends Error {
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {number} position
|
|
10
|
+
* @param {string} message
|
|
11
|
+
* @param {string} input
|
|
12
|
+
*/
|
|
13
|
+
constructor(
|
|
14
|
+
position,
|
|
15
|
+
message,
|
|
16
|
+
input
|
|
17
|
+
) {
|
|
18
|
+
|
|
19
|
+
super();
|
|
20
|
+
|
|
21
|
+
assert.isNonNegativeInteger(position, 'position');
|
|
22
|
+
assert.isString(message, 'message');
|
|
23
|
+
assert.isString(input, 'input');
|
|
24
|
+
|
|
25
|
+
this.position = position;
|
|
26
|
+
this.message = message;
|
|
27
|
+
this.input = input;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
getDetails() {
|
|
31
|
+
const input = this.input;
|
|
32
|
+
const position = this.position;
|
|
33
|
+
|
|
34
|
+
// get snippet around where the problem has occurred
|
|
35
|
+
const input_start = max2(0, position - 10);
|
|
36
|
+
|
|
37
|
+
const input_end = min2(input.length, position + 10);
|
|
38
|
+
|
|
39
|
+
const snippet = input.slice(input_start, input_end);
|
|
40
|
+
|
|
41
|
+
const offset_into_snippet = position - input_start;
|
|
42
|
+
|
|
43
|
+
// a piece of text with marker to show where the error occurs
|
|
44
|
+
const arrow_text = string_repeat(" ", offset_into_snippet) + "^"
|
|
45
|
+
|
|
46
|
+
return snippet + "\n" + arrow_text;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
toString() {
|
|
50
|
+
return `[ParseError] ${this.message}. Error at position ${this.position} near:\n${this.getDetails()}`
|
|
51
|
+
}
|
|
5
52
|
}
|
|
6
53
|
|
|
7
54
|
export default ParserError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/Token.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/Token.js"],"names":[],"mappings":";AAEA;IACI;;;;;;;OAOG;IACH,6BALW,MAAM,OACN,MAAM,QACN,MAAM,WAqChB;IA5BG;;;OAGG;IACH,kBAAkB;IAClB;;;;OAIG;IACH,gBAFU,MAAM,CAEE;IAClB;;;;OAIG;IACH,cAFU,MAAM,CAEF;IACd;;;OAGG;IACH,eAFU,MAAM,CAEA;IAChB;;;;OAIG;IACH,iBAAgB;IAGpB;;;;OAIG;IACH,cAHW,KAAK,GACH,OAAO,CASnB;IAED;;;OAGG;IACH,QAFY,MAAM,CAIjB;CACJ"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { assert } from "../../assert.js";
|
|
2
|
+
|
|
1
3
|
class Token {
|
|
2
4
|
/**
|
|
3
5
|
* @template V,T
|
|
@@ -8,6 +10,11 @@ class Token {
|
|
|
8
10
|
* @param {T} type
|
|
9
11
|
*/
|
|
10
12
|
constructor(value, start, end, name, type) {
|
|
13
|
+
|
|
14
|
+
assert.isNonNegativeInteger(start, 'start');
|
|
15
|
+
assert.isNonNegativeInteger(end, 'end');
|
|
16
|
+
assert.isString(name, 'name');
|
|
17
|
+
|
|
11
18
|
/**
|
|
12
19
|
* @readonly
|
|
13
20
|
* @type {V}
|
|
@@ -57,8 +64,7 @@ class Token {
|
|
|
57
64
|
* @return {number}
|
|
58
65
|
*/
|
|
59
66
|
hash() {
|
|
60
|
-
|
|
61
|
-
return 0;
|
|
67
|
+
return this.start ^ (this.end << 16);
|
|
62
68
|
}
|
|
63
69
|
}
|
|
64
70
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenType.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/TokenType.js"],"names":[],"mappings":";iBACU
|
|
1
|
+
{"version":3,"file":"TokenType.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/TokenType.js"],"names":[],"mappings":";iBACU,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readBooleanToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readBooleanToken.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"readBooleanToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readBooleanToken.js"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,uCALW,MAAM,UACN,MAAM,UACN,MAAM,SAgChB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { assert } from "../../assert.js";
|
|
2
|
+
import DataType from "./DataType.js";
|
|
1
3
|
import ParserError from "./ParserError.js";
|
|
2
4
|
import Token from "./Token.js";
|
|
3
5
|
import TokenType from "./TokenType.js";
|
|
4
|
-
import DataType from "./DataType.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
*
|
|
@@ -11,6 +12,10 @@ import DataType from "./DataType.js";
|
|
|
11
12
|
* @returns {Token}
|
|
12
13
|
*/
|
|
13
14
|
export function readBooleanToken(text, cursor, length) {
|
|
15
|
+
assert.isString(text, 'text');
|
|
16
|
+
assert.isNonNegativeInteger(cursor, 'cursor');
|
|
17
|
+
assert.isNonNegativeInteger(length, 'length');
|
|
18
|
+
|
|
14
19
|
const firstChar = text.charAt(cursor);
|
|
15
20
|
|
|
16
21
|
let value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readHexToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readHexToken.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"readHexToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readHexToken.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,mCALW,MAAM,UACN,MAAM,UACN,MAAM,SA0FhB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { assert } from "../../assert.js";
|
|
2
|
+
import DataType from "./DataType.js";
|
|
1
3
|
import ParserError from "./ParserError.js";
|
|
2
4
|
import Token from "./Token.js";
|
|
3
|
-
import DataType from "./DataType.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
*
|
|
@@ -10,6 +11,10 @@ import DataType from "./DataType.js";
|
|
|
10
11
|
* @returns {Token}
|
|
11
12
|
*/
|
|
12
13
|
export function readHexToken(text, cursor, length) {
|
|
14
|
+
assert.isString(text, 'text');
|
|
15
|
+
assert.isNonNegativeInteger(cursor, 'cursor');
|
|
16
|
+
assert.isNonNegativeInteger(length, 'length');
|
|
17
|
+
|
|
13
18
|
const c0 = text.charAt(cursor);
|
|
14
19
|
const c1 = text.charAt(cursor + 1);
|
|
15
20
|
|
|
@@ -91,5 +96,5 @@ export function readHexToken(text, cursor, length) {
|
|
|
91
96
|
}
|
|
92
97
|
|
|
93
98
|
|
|
94
|
-
return new Token(value, cursor, i,
|
|
99
|
+
return new Token(value, cursor, i, "uint", DataType.Number);
|
|
95
100
|
}
|