| 80438 | ]); |
| 80439 | } |
| 80440 | function pixelsToWorld(xyz, pixelUnprojectionMatrix, targetZ = 0) { |
| 80441 | const [x, y, z] = xyz; |
| 80442 | (0, _assertDefault.default)(Number.isFinite(x) && Number.isFinite(y), "invalid pixel coordinate"); |
| 80443 | if (Number.isFinite(z)) { |
| 80444 | const coord = (0, _mathUtils.transformVector)(pixelUnprojectionMatrix, [ |
| 80445 | x, |
| 80446 | y, |
| 80447 | z, |
| 80448 | 1 |
| 80449 | ]); |
| 80450 | return coord; |
| 80451 | } |
| 80452 | const coord0 = (0, _mathUtils.transformVector)(pixelUnprojectionMatrix, [ |
| 80453 | x, |
| 80454 | y, |
| 80455 | 0, |
| 80456 | 1 |
| 80457 | ]); |
| 80458 | const coord1 = (0, _mathUtils.transformVector)(pixelUnprojectionMatrix, [ |
| 80459 | x, |
| 80460 | y, |
| 80461 | 1, |
| 80462 | 1 |
| 80463 | ]); |
| 80464 | const z0 = coord0[2]; |
| 80465 | const z1 = coord1[2]; |
| 80466 | const t = z0 === z1 ? 0 : ((targetZ || 0) - z0) / (z1 - z0); |
| 80467 | return _vec2.lerp([], coord0, coord1, t); |
| 80468 | } |
| 80469 | |
| 80470 | },{"./math-utils":"g3X8f","gl-matrix/mat4":"aI9zp","gl-matrix/vec2":"29QfU","gl-matrix/vec3":"4RBb8","./assert":"8aOHi","@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"8aOHi":[function(require,module,exports) { |
| 80471 | var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); |