@woosh/meep-engine 2.109.20 → 2.109.22
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-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +66 -33
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +66 -33
- package/package.json +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray_segment.js +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray_segment.js +1 -1
- package/src/core/collection/array/isArrayEqualStrict.d.ts.map +1 -1
- package/src/core/collection/array/isArrayEqualStrict.js +1 -3
- package/src/core/collection/array/isArraysEqualWithComparator.d.ts.map +1 -1
- package/src/core/collection/array/isArraysEqualWithComparator.js +3 -2
- package/src/core/collection/array/typed/is_typed_array_equals.d.ts +1 -1
- package/src/core/collection/array/typed/is_typed_array_equals.d.ts.map +1 -1
- package/src/core/collection/array/typed/is_typed_array_equals.js +8 -2
- package/src/core/geom/3d/aabb/aabb3_array_near_distance_to_intersection_ray_segment.d.ts +16 -0
- package/src/core/geom/3d/aabb/aabb3_array_near_distance_to_intersection_ray_segment.d.ts.map +1 -0
- package/src/core/geom/3d/aabb/aabb3_array_near_distance_to_intersection_ray_segment.js +30 -0
- package/src/core/geom/3d/aabb/aabb3_intersects_ray_segment.d.ts +4 -5
- package/src/core/geom/3d/aabb/aabb3_intersects_ray_segment.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_intersects_ray_segment.js +6 -9
- package/src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.d.ts +20 -0
- package/src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.d.ts.map +1 -0
- package/src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.js +67 -0
- package/src/core/geom/3d/line/line3_compute_nearest_point_to_point.d.ts.map +1 -1
- package/src/core/geom/3d/line/line3_compute_nearest_point_to_point.js +15 -1
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts +2 -1
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts.map +1 -1
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js +6 -1
- package/src/core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.d.ts +20 -0
- package/src/core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.d.ts.map +1 -0
- package/src/core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.js +147 -0
- package/src/core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.spec.d.ts +2 -0
- package/src/core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.spec.d.ts.map +1 -0
- package/src/core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.spec.js +100 -0
- package/src/core/geom/octahedral_uv_crease_distance.d.ts +8 -0
- package/src/core/geom/octahedral_uv_crease_distance.d.ts.map +1 -0
- package/src/core/geom/octahedral_uv_crease_distance.js +26 -0
- package/src/core/math/random/generate_halton_jitter.js +2 -2
- package/src/core/math/statistics/generate_hammersley_jitter.d.ts +7 -0
- package/src/core/math/statistics/generate_hammersley_jitter.d.ts.map +1 -0
- package/src/core/math/statistics/generate_hammersley_jitter.js +16 -0
- package/src/core/math/statistics/hammersley_sequence_2d.js +2 -1
- package/src/core/model/object/objectDeepEquals.d.ts +1 -1
- package/src/core/model/object/objectDeepEquals.d.ts.map +1 -1
- package/src/core/model/object/objectDeepEquals.js +54 -26
- package/src/engine/graphics/geometry/buffered/computeGeometryEquality.d.ts.map +1 -1
- package/src/engine/graphics/geometry/buffered/computeGeometryEquality.js +4 -0
- package/src/engine/graphics/sh3/gi/material/common.glsl +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +0 -7
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +0 -11
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts +7 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.js +39 -25
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +1 -1
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.js +34 -35
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts +18 -0
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js +421 -21
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +4 -4
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +4 -2
- package/src/engine/graphics/texture/virtual/prototype.js +3 -1
package/build/meep.module.js
CHANGED
|
@@ -12,9 +12,7 @@ function isArrayEqualStrict(a, b) {
|
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
let i = 0;
|
|
16
|
-
|
|
17
|
-
for (; i < il; i++) {
|
|
15
|
+
for (let i = 0; i < il; i++) {
|
|
18
16
|
|
|
19
17
|
if (a[i] !== b[i]) {
|
|
20
18
|
return false;
|
|
@@ -49014,7 +49012,7 @@ function compute_typed_array_constructor_from_data_type(dt) {
|
|
|
49014
49012
|
//
|
|
49015
49013
|
|
|
49016
49014
|
/**
|
|
49017
|
-
*
|
|
49015
|
+
* Optimized equality method for typed arrays, typically significantly faster than `isArrayEqualStrict`, especially for larger arrays
|
|
49018
49016
|
* @param {Uint8Array|Uint32Array} a
|
|
49019
49017
|
* @param {Uint8Array|Uint32Array} b
|
|
49020
49018
|
* @returns {boolean}
|
|
@@ -49032,7 +49030,12 @@ function is_typed_array_equals(a, b) {
|
|
|
49032
49030
|
return false;
|
|
49033
49031
|
}
|
|
49034
49032
|
|
|
49035
|
-
if (a_length
|
|
49033
|
+
if (a_length === 0) {
|
|
49034
|
+
// both arrays are empty
|
|
49035
|
+
return true;
|
|
49036
|
+
}
|
|
49037
|
+
|
|
49038
|
+
if (a_length < 128) { // size is determined empirically, nothing special about the number itself
|
|
49036
49039
|
// small array, do direct compare
|
|
49037
49040
|
return isArrayEqualStrict(a, b);
|
|
49038
49041
|
}
|
|
@@ -49071,6 +49074,7 @@ function is_typed_array_equals(a, b) {
|
|
|
49071
49074
|
a_proxy = new Uint32Array(a_buffer, a.byteOffset, byte_length / 4);
|
|
49072
49075
|
b_proxy = new Uint32Array(b_buffer, b.byteOffset, byte_length / 4);
|
|
49073
49076
|
} else if (bytes_per_element < 2 && byte_length % 2 === 0) {
|
|
49077
|
+
// 2 byte alignment, can use uint16
|
|
49074
49078
|
a_proxy = new Uint16Array(a_buffer, a.byteOffset, byte_length / 2);
|
|
49075
49079
|
b_proxy = new Uint16Array(b_buffer, b.byteOffset, byte_length / 2);
|
|
49076
49080
|
}
|
|
@@ -76722,9 +76726,10 @@ function planesEqual(a, b) {
|
|
|
76722
76726
|
* @param {T[]} a
|
|
76723
76727
|
* @param {T[]} b
|
|
76724
76728
|
* @param {function(T,T):boolean} elements_equal
|
|
76729
|
+
* @param {*} [element_equal_context]
|
|
76725
76730
|
* @returns {boolean}
|
|
76726
76731
|
*/
|
|
76727
|
-
function isArraysEqualWithComparator(a, b, elements_equal) {
|
|
76732
|
+
function isArraysEqualWithComparator(a, b, elements_equal, element_equal_context) {
|
|
76728
76733
|
if (a === b) {
|
|
76729
76734
|
// same object
|
|
76730
76735
|
return true;
|
|
@@ -76745,7 +76750,7 @@ function isArraysEqualWithComparator(a, b, elements_equal) {
|
|
|
76745
76750
|
const aE = a[i];
|
|
76746
76751
|
const bE = b[i];
|
|
76747
76752
|
|
|
76748
|
-
if (!elements_equal(aE, bE)) {
|
|
76753
|
+
if (!elements_equal.call(element_equal_context, aE, bE)) {
|
|
76749
76754
|
return false;
|
|
76750
76755
|
}
|
|
76751
76756
|
}
|
|
@@ -102531,9 +102536,16 @@ function easeInOutQuad(t) {
|
|
|
102531
102536
|
* @template A,B
|
|
102532
102537
|
* @param {A} a
|
|
102533
102538
|
* @param {B} b
|
|
102539
|
+
* @param {function(a:A, b:B):boolean} [value_equality_function] allows you to insert custom element comparison function
|
|
102540
|
+
* @param {*} [value_equality_function_context]
|
|
102534
102541
|
* @returns {boolean}
|
|
102535
102542
|
*/
|
|
102536
|
-
function objectDeepEquals(
|
|
102543
|
+
function objectDeepEquals(
|
|
102544
|
+
a, b,
|
|
102545
|
+
value_equality_function = objectDeepEquals,
|
|
102546
|
+
value_equality_function_context = null
|
|
102547
|
+
) {
|
|
102548
|
+
|
|
102537
102549
|
if (a === b) {
|
|
102538
102550
|
// identity shortcut
|
|
102539
102551
|
return true;
|
|
@@ -102549,43 +102561,64 @@ function objectDeepEquals(a, b) {
|
|
|
102549
102561
|
if (tA !== "object") {
|
|
102550
102562
|
// primitive types, identity equality already checked
|
|
102551
102563
|
return false;
|
|
102552
|
-
}
|
|
102564
|
+
}
|
|
102565
|
+
|
|
102566
|
+
if (a === null || b === null) {
|
|
102567
|
+
// we know that A and B are not the same, so if one of them is a null - there is no possible equality
|
|
102568
|
+
return false;
|
|
102569
|
+
}
|
|
102553
102570
|
|
|
102554
|
-
|
|
102555
|
-
|
|
102571
|
+
if (Array.isArray(a)) {
|
|
102572
|
+
// special fast path for arrays
|
|
102573
|
+
if (!Array.isArray(b)) {
|
|
102574
|
+
// one is an array, the other is not
|
|
102556
102575
|
return false;
|
|
102557
102576
|
}
|
|
102577
|
+
return isArraysEqualWithComparator(a, b, value_equality_function, value_equality_function_context);
|
|
102578
|
+
}
|
|
102558
102579
|
|
|
102559
|
-
|
|
102560
|
-
|
|
102561
|
-
|
|
102562
|
-
|
|
102563
|
-
|
|
102564
|
-
|
|
102565
|
-
|
|
102566
|
-
}
|
|
102580
|
+
// try equals function
|
|
102581
|
+
if (
|
|
102582
|
+
typeof a.equals === "function"
|
|
102583
|
+
&& typeof b.equals === "function"
|
|
102584
|
+
) {
|
|
102585
|
+
return a.equals(b);
|
|
102586
|
+
}
|
|
102567
102587
|
|
|
102568
|
-
|
|
102569
|
-
|
|
102588
|
+
const keys_a = Object.keys(a);
|
|
102589
|
+
const keys_b = Object.keys(b);
|
|
102570
102590
|
|
|
102571
|
-
|
|
102572
|
-
|
|
102573
|
-
|
|
102574
|
-
}
|
|
102591
|
+
// sort keys to eliminate ordering concerns
|
|
102592
|
+
keys_a.sort();
|
|
102593
|
+
keys_b.sort();
|
|
102575
102594
|
|
|
102576
|
-
|
|
102595
|
+
if (!isArrayEqualStrict(keys_a, keys_b)) {
|
|
102596
|
+
// different fields
|
|
102597
|
+
return false;
|
|
102598
|
+
}
|
|
102577
102599
|
|
|
102578
|
-
|
|
102579
|
-
const key = keys_a[i];
|
|
102600
|
+
const key_count = keys_a.length;
|
|
102580
102601
|
|
|
102581
|
-
|
|
102582
|
-
|
|
102583
|
-
}
|
|
102584
|
-
}
|
|
102602
|
+
for (let i = 0; i < key_count; i++) {
|
|
102603
|
+
const key = keys_a[i];
|
|
102585
102604
|
|
|
102586
|
-
|
|
102605
|
+
const a_value = a[key];
|
|
102606
|
+
const b_value = b[key];
|
|
102587
102607
|
|
|
102608
|
+
const values_are_equal = value_equality_function.call(
|
|
102609
|
+
value_equality_function_context,
|
|
102610
|
+
a_value,
|
|
102611
|
+
b_value
|
|
102612
|
+
);
|
|
102613
|
+
|
|
102614
|
+
if (!values_are_equal) {
|
|
102615
|
+
return false;
|
|
102616
|
+
}
|
|
102588
102617
|
}
|
|
102618
|
+
|
|
102619
|
+
// looks like we have equality
|
|
102620
|
+
return true;
|
|
102621
|
+
|
|
102589
102622
|
}
|
|
102590
102623
|
|
|
102591
102624
|
/**
|
package/package.json
CHANGED
|
@@ -66,7 +66,7 @@ export function bvh_query_leaves_ray_segment(
|
|
|
66
66
|
float32[address], float32[address + 1], float32[address + 2],
|
|
67
67
|
float32[address + 3], float32[address + 4], float32[address + 5],
|
|
68
68
|
origin_x, origin_y, origin_z,
|
|
69
|
-
direction_x, direction_y, direction_z,
|
|
69
|
+
1 / direction_x, 1 / direction_y, 1 / direction_z,
|
|
70
70
|
t_min, t_max
|
|
71
71
|
);
|
|
72
72
|
|
|
@@ -70,7 +70,7 @@ export function bvh_query_user_data_ray_segment(
|
|
|
70
70
|
float32[address], float32[address + 1], float32[address + 2],
|
|
71
71
|
float32[address + 3], float32[address + 4], float32[address + 5],
|
|
72
72
|
origin_x, origin_y, origin_z,
|
|
73
|
-
direction_x, direction_y, direction_z,
|
|
73
|
+
1 / direction_x, 1 / direction_y, 1 / direction_z,
|
|
74
74
|
t_min, t_max
|
|
75
75
|
);
|
|
76
76
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isArrayEqualStrict.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/isArrayEqualStrict.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,sCAJW,QAAM,UAAU,KAChB,QAAM,UAAU,GACd,OAAO,
|
|
1
|
+
{"version":3,"file":"isArrayEqualStrict.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/isArrayEqualStrict.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,sCAJW,QAAM,UAAU,KAChB,QAAM,UAAU,GACd,OAAO,CAoBnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isArraysEqualWithComparator.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/isArraysEqualWithComparator.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"isArraysEqualWithComparator.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/isArraysEqualWithComparator.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qGAJyB,OAAO,gCAEnB,OAAO,CA6BnB"}
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* @param {T[]} a
|
|
4
4
|
* @param {T[]} b
|
|
5
5
|
* @param {function(T,T):boolean} elements_equal
|
|
6
|
+
* @param {*} [element_equal_context]
|
|
6
7
|
* @returns {boolean}
|
|
7
8
|
*/
|
|
8
|
-
export function isArraysEqualWithComparator(a, b, elements_equal) {
|
|
9
|
+
export function isArraysEqualWithComparator(a, b, elements_equal, element_equal_context) {
|
|
9
10
|
if (a === b) {
|
|
10
11
|
// same object
|
|
11
12
|
return true;
|
|
@@ -26,7 +27,7 @@ export function isArraysEqualWithComparator(a, b, elements_equal) {
|
|
|
26
27
|
const aE = a[i];
|
|
27
28
|
const bE = b[i];
|
|
28
29
|
|
|
29
|
-
if (!elements_equal(aE, bE)) {
|
|
30
|
+
if (!elements_equal.call(element_equal_context, aE, bE)) {
|
|
30
31
|
return false;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is_typed_array_equals.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/is_typed_array_equals.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,yCAJW,UAAU,GAAC,WAAW,KACtB,UAAU,GAAC,WAAW,GACpB,OAAO,
|
|
1
|
+
{"version":3,"file":"is_typed_array_equals.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/is_typed_array_equals.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,yCAJW,UAAU,GAAC,WAAW,KACtB,UAAU,GAAC,WAAW,GACpB,OAAO,CAiEnB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { isArrayEqualStrict } from "../isArrayEqualStrict.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Optimized equality method for typed arrays, typically significantly faster than `isArrayEqualStrict`, especially for larger arrays
|
|
6
6
|
* @param {Uint8Array|Uint32Array} a
|
|
7
7
|
* @param {Uint8Array|Uint32Array} b
|
|
8
8
|
* @returns {boolean}
|
|
@@ -20,7 +20,12 @@ export function is_typed_array_equals(a, b) {
|
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
if (a_length
|
|
23
|
+
if (a_length === 0) {
|
|
24
|
+
// both arrays are empty
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (a_length < 128) { // size is determined empirically, nothing special about the number itself
|
|
24
29
|
// small array, do direct compare
|
|
25
30
|
return isArrayEqualStrict(a, b);
|
|
26
31
|
}
|
|
@@ -59,6 +64,7 @@ export function is_typed_array_equals(a, b) {
|
|
|
59
64
|
a_proxy = new Uint32Array(a_buffer, a.byteOffset, byte_length / 4);
|
|
60
65
|
b_proxy = new Uint32Array(b_buffer, b.byteOffset, byte_length / 4);
|
|
61
66
|
} else if (bytes_per_element < 2 && byte_length % 2 === 0) {
|
|
67
|
+
// 2 byte alignment, can use uint16
|
|
62
68
|
a_proxy = new Uint16Array(a_buffer, a.byteOffset, byte_length / 2);
|
|
63
69
|
b_proxy = new Uint16Array(b_buffer, b.byteOffset, byte_length / 2);
|
|
64
70
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see Ray Tracing Gems II, Chapter 2 "RAY AXIS-ALIGNED BOUNDING BOX INTERSECTION"
|
|
3
|
+
* @param {number[]|Float32Array} box
|
|
4
|
+
* @param {number} box_address
|
|
5
|
+
* @param {number} origin_x
|
|
6
|
+
* @param {number} origin_y
|
|
7
|
+
* @param {number} origin_z
|
|
8
|
+
* @param {number} inv_direction_x 1/ direction_X
|
|
9
|
+
* @param {number} inv_direction_y 1/ direction_Y
|
|
10
|
+
* @param {number} inv_direction_z 1/ direction_Z
|
|
11
|
+
* @param {number} min_distance
|
|
12
|
+
* @param {number} max_distance
|
|
13
|
+
* @returns {number}
|
|
14
|
+
*/
|
|
15
|
+
export function aabb3_array_near_distance_to_intersection_ray_segment(box: number[] | Float32Array, box_address: number, origin_x: number, origin_y: number, origin_z: number, inv_direction_x: number, inv_direction_y: number, inv_direction_z: number, min_distance: number, max_distance: number): number;
|
|
16
|
+
//# sourceMappingURL=aabb3_array_near_distance_to_intersection_ray_segment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aabb3_array_near_distance_to_intersection_ray_segment.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_array_near_distance_to_intersection_ray_segment.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,2EAZW,MAAM,EAAE,GAAC,YAAY,eACrB,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,mBACN,MAAM,mBACN,MAAM,mBACN,MAAM,gBACN,MAAM,gBACN,MAAM,GACJ,MAAM,CAelB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { aabb3_near_distance_to_intersection_ray_segment } from "./aabb3_near_distance_to_intersection_ray_segment.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @see Ray Tracing Gems II, Chapter 2 "RAY AXIS-ALIGNED BOUNDING BOX INTERSECTION"
|
|
5
|
+
* @param {number[]|Float32Array} box
|
|
6
|
+
* @param {number} box_address
|
|
7
|
+
* @param {number} origin_x
|
|
8
|
+
* @param {number} origin_y
|
|
9
|
+
* @param {number} origin_z
|
|
10
|
+
* @param {number} inv_direction_x 1/ direction_X
|
|
11
|
+
* @param {number} inv_direction_y 1/ direction_Y
|
|
12
|
+
* @param {number} inv_direction_z 1/ direction_Z
|
|
13
|
+
* @param {number} min_distance
|
|
14
|
+
* @param {number} max_distance
|
|
15
|
+
* @returns {number}
|
|
16
|
+
*/
|
|
17
|
+
export function aabb3_array_near_distance_to_intersection_ray_segment(
|
|
18
|
+
box, box_address,
|
|
19
|
+
origin_x, origin_y, origin_z,
|
|
20
|
+
inv_direction_x, inv_direction_y, inv_direction_z,
|
|
21
|
+
min_distance, max_distance) {
|
|
22
|
+
return aabb3_near_distance_to_intersection_ray_segment(
|
|
23
|
+
box[box_address], box[box_address + 1], box[box_address + 2],
|
|
24
|
+
box[box_address + 3], box[box_address + 4], box[box_address + 5],
|
|
25
|
+
|
|
26
|
+
origin_x, origin_y, origin_z,
|
|
27
|
+
inv_direction_x, inv_direction_y, inv_direction_z,
|
|
28
|
+
min_distance, max_distance
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -9,13 +9,12 @@
|
|
|
9
9
|
* @param {number} origin_x
|
|
10
10
|
* @param {number} origin_y
|
|
11
11
|
* @param {number} origin_z
|
|
12
|
-
* @param {number}
|
|
13
|
-
* @param {number}
|
|
14
|
-
* @param {number}
|
|
12
|
+
* @param {number} inv_direction_x 1/ direction_X
|
|
13
|
+
* @param {number} inv_direction_y 1/ direction_Y
|
|
14
|
+
* @param {number} inv_direction_z 1/ direction_Z
|
|
15
15
|
* @param {number} min_distance
|
|
16
16
|
* @param {number} max_distance
|
|
17
17
|
* @returns {boolean}
|
|
18
|
-
* @returns {boolean}
|
|
19
18
|
*/
|
|
20
|
-
export function aabb3_intersects_ray_segment(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, origin_x: number, origin_y: number, origin_z: number,
|
|
19
|
+
export function aabb3_intersects_ray_segment(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, origin_x: number, origin_y: number, origin_z: number, inv_direction_x: number, inv_direction_y: number, inv_direction_z: number, min_distance: number, max_distance: number): boolean;
|
|
21
20
|
//# sourceMappingURL=aabb3_intersects_ray_segment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aabb3_intersects_ray_segment.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_intersects_ray_segment.js"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"aabb3_intersects_ray_segment.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_intersects_ray_segment.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AACH,iDAhBW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,mBACN,MAAM,mBACN,MAAM,mBACN,MAAM,gBACN,MAAM,gBACN,MAAM,GACJ,OAAO,CA2CnB"}
|
|
@@ -12,19 +12,18 @@ import { min2 } from "../../../math/min2.js";
|
|
|
12
12
|
* @param {number} origin_x
|
|
13
13
|
* @param {number} origin_y
|
|
14
14
|
* @param {number} origin_z
|
|
15
|
-
* @param {number}
|
|
16
|
-
* @param {number}
|
|
17
|
-
* @param {number}
|
|
15
|
+
* @param {number} inv_direction_x 1/ direction_X
|
|
16
|
+
* @param {number} inv_direction_y 1/ direction_Y
|
|
17
|
+
* @param {number} inv_direction_z 1/ direction_Z
|
|
18
18
|
* @param {number} min_distance
|
|
19
19
|
* @param {number} max_distance
|
|
20
20
|
* @returns {boolean}
|
|
21
|
-
* @returns {boolean}
|
|
22
21
|
*/
|
|
23
22
|
export function aabb3_intersects_ray_segment(
|
|
24
23
|
x0, y0, z0,
|
|
25
24
|
x1, y1, z1,
|
|
26
25
|
origin_x, origin_y, origin_z,
|
|
27
|
-
|
|
26
|
+
inv_direction_x, inv_direction_y, inv_direction_z,
|
|
28
27
|
min_distance, max_distance
|
|
29
28
|
) {
|
|
30
29
|
|
|
@@ -37,9 +36,6 @@ export function aabb3_intersects_ray_segment(
|
|
|
37
36
|
const _y1 = y1 - origin_y;
|
|
38
37
|
const _z1 = z1 - origin_z;
|
|
39
38
|
|
|
40
|
-
const inv_direction_x = 1 / direction_x;
|
|
41
|
-
const inv_direction_y = 1 / direction_y;
|
|
42
|
-
const inv_direction_z = 1 / direction_z;
|
|
43
39
|
|
|
44
40
|
// Absolute distances to lower and upper box coordinates
|
|
45
41
|
const t_lower_x = _x0 * inv_direction_x;
|
|
@@ -64,4 +60,5 @@ export function aabb3_intersects_ray_segment(
|
|
|
64
60
|
const t_box_max = Math.min(t_max_x, t_max_y, t_max_z, max_distance);
|
|
65
61
|
|
|
66
62
|
return t_box_min <= t_box_max;
|
|
67
|
-
}
|
|
63
|
+
}
|
|
64
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see Ray Tracing Gems II, Chapter 2 "RAY AXIS-ALIGNED BOUNDING BOX INTERSECTION"
|
|
3
|
+
* @param {number} x0
|
|
4
|
+
* @param {number} y0
|
|
5
|
+
* @param {number} z0
|
|
6
|
+
* @param {number} x1
|
|
7
|
+
* @param {number} y1
|
|
8
|
+
* @param {number} z1
|
|
9
|
+
* @param {number} origin_x
|
|
10
|
+
* @param {number} origin_y
|
|
11
|
+
* @param {number} origin_z
|
|
12
|
+
* @param {number} inv_direction_x 1/ direction_X
|
|
13
|
+
* @param {number} inv_direction_y 1/ direction_Y
|
|
14
|
+
* @param {number} inv_direction_z 1/ direction_Z
|
|
15
|
+
* @param {number} min_distance
|
|
16
|
+
* @param {number} max_distance
|
|
17
|
+
* @returns {number} Infinity when no intersection found
|
|
18
|
+
*/
|
|
19
|
+
export function aabb3_near_distance_to_intersection_ray_segment(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, origin_x: number, origin_y: number, origin_z: number, inv_direction_x: number, inv_direction_y: number, inv_direction_z: number, min_distance: number, max_distance: number): number;
|
|
20
|
+
//# sourceMappingURL=aabb3_near_distance_to_intersection_ray_segment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aabb3_near_distance_to_intersection_ray_segment.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AACH,oEAhBW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,mBACN,MAAM,mBACN,MAAM,mBACN,MAAM,gBACN,MAAM,gBACN,MAAM,GACJ,MAAM,CA+ClB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { max2 } from "../../../math/max2.js";
|
|
2
|
+
import { min2 } from "../../../math/min2.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @see Ray Tracing Gems II, Chapter 2 "RAY AXIS-ALIGNED BOUNDING BOX INTERSECTION"
|
|
6
|
+
* @param {number} x0
|
|
7
|
+
* @param {number} y0
|
|
8
|
+
* @param {number} z0
|
|
9
|
+
* @param {number} x1
|
|
10
|
+
* @param {number} y1
|
|
11
|
+
* @param {number} z1
|
|
12
|
+
* @param {number} origin_x
|
|
13
|
+
* @param {number} origin_y
|
|
14
|
+
* @param {number} origin_z
|
|
15
|
+
* @param {number} inv_direction_x 1/ direction_X
|
|
16
|
+
* @param {number} inv_direction_y 1/ direction_Y
|
|
17
|
+
* @param {number} inv_direction_z 1/ direction_Z
|
|
18
|
+
* @param {number} min_distance
|
|
19
|
+
* @param {number} max_distance
|
|
20
|
+
* @returns {number} Infinity when no intersection found
|
|
21
|
+
*/
|
|
22
|
+
export function aabb3_near_distance_to_intersection_ray_segment(
|
|
23
|
+
x0, y0, z0,
|
|
24
|
+
x1, y1, z1,
|
|
25
|
+
origin_x, origin_y, origin_z,
|
|
26
|
+
inv_direction_x, inv_direction_y, inv_direction_z,
|
|
27
|
+
min_distance, max_distance
|
|
28
|
+
) {
|
|
29
|
+
|
|
30
|
+
// move aabb into ray space
|
|
31
|
+
const _x0 = x0 - origin_x;
|
|
32
|
+
const _y0 = y0 - origin_y;
|
|
33
|
+
const _z0 = z0 - origin_z;
|
|
34
|
+
|
|
35
|
+
const _x1 = x1 - origin_x;
|
|
36
|
+
const _y1 = y1 - origin_y;
|
|
37
|
+
const _z1 = z1 - origin_z;
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
// Absolute distances to lower and upper box coordinates
|
|
41
|
+
const t_lower_x = _x0 * inv_direction_x;
|
|
42
|
+
const t_lower_y = _y0 * inv_direction_y;
|
|
43
|
+
const t_lower_z = _z0 * inv_direction_z;
|
|
44
|
+
|
|
45
|
+
const t_upper_x = _x1 * inv_direction_x;
|
|
46
|
+
const t_upper_y = _y1 * inv_direction_y;
|
|
47
|
+
const t_upper_z = _z1 * inv_direction_z;
|
|
48
|
+
|
|
49
|
+
// The four t-intervals (for x-/y-/z-slabs, and ray p(t))
|
|
50
|
+
const t_min_x = min2(t_lower_x, t_upper_x);
|
|
51
|
+
const t_min_y = min2(t_lower_y, t_upper_y);
|
|
52
|
+
const t_min_z = min2(t_lower_z, t_upper_z);
|
|
53
|
+
|
|
54
|
+
const t_max_x = max2(t_lower_x, t_upper_x);
|
|
55
|
+
const t_max_y = max2(t_lower_y, t_upper_y);
|
|
56
|
+
const t_max_z = max2(t_lower_z, t_upper_z);
|
|
57
|
+
|
|
58
|
+
// Easy to remember: ``max of mins, and min of maxes''
|
|
59
|
+
const t_box_min = Math.max(t_min_x, t_min_y, t_min_z, min_distance);
|
|
60
|
+
const t_box_max = Math.min(t_max_x, t_max_y, t_max_z, max_distance);
|
|
61
|
+
|
|
62
|
+
if (t_box_min > t_box_max) {
|
|
63
|
+
return Infinity;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return t_box_min;
|
|
67
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line3_compute_nearest_point_to_point.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/line/line3_compute_nearest_point_to_point.js"],"names":[],"mappings":"AAGA,
|
|
1
|
+
{"version":3,"file":"line3_compute_nearest_point_to_point.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/line/line3_compute_nearest_point_to_point.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,6DAZW,MAAM,EAAE,iBACR,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,SACN,MAAM,SACN,MAAM,SACN,MAAM,QAkChB"}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import { v3_dot } from "../../vec3/v3_dot.js";
|
|
2
1
|
import { clamp01 } from "../../../math/clamp01.js";
|
|
2
|
+
import { v3_dot } from "../../vec3/v3_dot.js";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {number[]} result
|
|
7
|
+
* @param {number} result_offset
|
|
8
|
+
* @param {number} ax
|
|
9
|
+
* @param {number} ay
|
|
10
|
+
* @param {number} az
|
|
11
|
+
* @param {number} bx
|
|
12
|
+
* @param {number} by
|
|
13
|
+
* @param {number} bz
|
|
14
|
+
* @param {number} ref_x
|
|
15
|
+
* @param {number} ref_y
|
|
16
|
+
* @param {number} ref_z
|
|
17
|
+
*/
|
|
4
18
|
export function line3_compute_nearest_point_to_point(
|
|
5
19
|
result, result_offset,
|
|
6
20
|
ax, ay, az,
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @param {number} output_offset
|
|
6
6
|
* @param {number} u range [-1,1]
|
|
7
7
|
* @param {number} v range [-1,1]
|
|
8
|
+
* @returns {number} length of octahedral vector, larger value means more distortion
|
|
8
9
|
*/
|
|
9
|
-
export function decode_octahedron_to_unit(output: number[] | Vector3 | Float32Array, output_offset: number, u: number, v: number):
|
|
10
|
+
export function decode_octahedron_to_unit(output: number[] | Vector3 | Float32Array, output_offset: number, u: number, v: number): number;
|
|
10
11
|
//# sourceMappingURL=decode_octahedron_to_unit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode_octahedron_to_unit.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"decode_octahedron_to_unit.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,kDANW,MAAM,EAAE,aAAS,YAAY,iBAC7B,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CA8BlB"}
|
|
@@ -8,6 +8,7 @@ import { v3_length } from "../../../vec3/v3_length.js";
|
|
|
8
8
|
* @param {number} output_offset
|
|
9
9
|
* @param {number} u range [-1,1]
|
|
10
10
|
* @param {number} v range [-1,1]
|
|
11
|
+
* @returns {number} length of octahedral vector, larger value means more distortion
|
|
11
12
|
*/
|
|
12
13
|
export function decode_octahedron_to_unit(
|
|
13
14
|
output, output_offset,
|
|
@@ -28,9 +29,13 @@ export function decode_octahedron_to_unit(
|
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
// normalize
|
|
31
|
-
const
|
|
32
|
+
const octahedral_length = v3_length(v_x, v_y, v_z);
|
|
33
|
+
|
|
34
|
+
const m = 1 / octahedral_length;
|
|
32
35
|
|
|
33
36
|
output[output_offset] = v_x * m;
|
|
34
37
|
output[output_offset + 1] = v_y * m;
|
|
35
38
|
output[output_offset + 2] = v_z * m;
|
|
39
|
+
|
|
40
|
+
return octahedral_length;
|
|
36
41
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]} result result is written as a 2d vector, since barycentrics add up to 1, we omit the last value
|
|
4
|
+
* @param {number} result_offset
|
|
5
|
+
* @param {number} px reference point
|
|
6
|
+
* @param {number} py reference point
|
|
7
|
+
* @param {number} pz reference point
|
|
8
|
+
* @param {number} ax Triangle apex A
|
|
9
|
+
* @param {number} ay Triangle apex A
|
|
10
|
+
* @param {number} az Triangle apex A
|
|
11
|
+
* @param {number} bx Triangle apex B
|
|
12
|
+
* @param {number} by Triangle apex B
|
|
13
|
+
* @param {number} bz Triangle apex B
|
|
14
|
+
* @param {number} cx Triangle apex C
|
|
15
|
+
* @param {number} cy Triangle apex C
|
|
16
|
+
* @param {number} cz Triangle apex C
|
|
17
|
+
* @returns {void}
|
|
18
|
+
*/
|
|
19
|
+
export function computeTriangleClosestPointToPointBarycentric(result: number[], result_offset: number, px: number, py: number, pz: number, ax: number, ay: number, az: number, bx: number, by: number, bz: number, cx: number, cy: number, cz: number): void;
|
|
20
|
+
//# sourceMappingURL=computeTriangleClosestPointToPointBarycentric.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeTriangleClosestPointToPointBarycentric.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,sEAhBW,MAAM,EAAE,iBACR,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,IAAI,CAgIhB"}
|