gps-plus-slam-app-framework 1.0.6 → 1.0.7
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/LICENSE +4 -4
- package/README.md +249 -108
- package/dist/accuracy-circles-CsxE_7x1.d.ts +43 -0
- package/dist/{app-selectors-CHt7DLuq.d.ts → app-selectors-BeU0_ab8.d.ts} +8 -10
- package/dist/ar/camera-blit-capture.d.ts +1 -1
- package/dist/ar/capture-failure-tracker.d.ts +1 -1
- package/dist/ar/chromium-camera-access-workaround.d.ts +1 -1
- package/dist/ar/depth-sampler.d.ts +2 -2
- package/dist/ar/frame-loop.d.ts +2 -0
- package/dist/ar/frame-loop.js +40 -0
- package/dist/ar/image-capture.d.ts +1 -1
- package/dist/ar/image-capture.js +1 -1
- package/dist/ar/index.d.ts +12 -12
- package/dist/ar/index.js +3 -3
- package/dist/ar/replay-scene.d.ts +1 -1
- package/dist/ar/scene-node-names.d.ts +1 -1
- package/dist/ar/webxr-session.d.ts +4 -4
- package/dist/ar/webxr-session.js +150 -55
- package/dist/ar/xr-camera-texture.d.ts +1 -1
- package/dist/ar/xr-error-handler.d.ts +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +2 -2
- package/dist/create-slam-app-store-CNsZ3rcX.d.ts +371 -0
- package/dist/{depth-sampler-BNCtnEoP.d.ts → depth-sampler-xg8vna6c.d.ts} +1 -1
- package/dist/{file-system-DD5TczSO.d.ts → file-system-DTApEv_Q.d.ts} +32 -2
- package/dist/frame-loop-QJIxLin0.d.ts +42 -0
- package/dist/frustum-visibility-BHnFrSKQ.d.ts +58 -0
- package/dist/{fused-path-DtqCSqJh.d.ts → fused-path-CB4DwWOG.d.ts} +1 -1
- package/dist/geo/h3-proximity.d.ts +1 -1
- package/dist/geo/index.d.ts +1 -1
- package/dist/{geo-types-Xx-LVcnw.d.ts → geo-types-CTuF23gG.d.ts} +16 -1
- package/dist/{gps-GKc6_Cly.d.ts → gps-DXoQb9Kf.d.ts} +1 -1
- package/dist/gps-anchor-CnWY61XK.d.ts +48 -0
- package/dist/gps-anchor-DjC_3MoT.js +257 -0
- package/dist/{gps-ar-pose-sampler-D_Zso40V.d.ts → gps-ar-pose-sampler-DsM1Kb2N.d.ts} +1 -1
- package/dist/{gps-event-coordinator-fwvmVfku.d.ts → gps-event-coordinator-DBx9I1YX.d.ts} +3 -3
- package/dist/gps-event-markers-BGr-iLvi.d.ts +103 -0
- package/dist/{image-capture-2pKjYUS6.d.ts → image-capture-DZLxHDN9.d.ts} +1 -1
- package/dist/index-gzWJMVpo.d.ts +2 -0
- package/dist/index-pOjUCKEP.d.ts +24 -0
- package/dist/index.d.ts +58 -52
- package/dist/index.js +11 -5
- package/dist/{leaflet-map-overlay-CQZcnxbc.d.ts → leaflet-map-overlay-Cew7XAoO.d.ts} +22 -11
- package/dist/{logger-B81iwxx0.d.ts → logger-C9vugiQb.d.ts} +7 -1
- package/dist/map-data-sih4g64v.d.ts +49 -0
- package/dist/map-overlay-draw-B3R1c9Xp.d.ts +42 -0
- package/dist/{null-storage-backend-C0TiwwzQ.d.ts → null-storage-backend-BKOS7JpL.d.ts} +2 -2
- package/dist/{opfs-storage-backend-Gt3rd76D.d.ts → opfs-storage-backend-Cj_7PWoq.d.ts} +2 -2
- package/dist/{permission-checker-Cu3nbH1S.d.ts → permission-checker-DPJl_RU6.d.ts} +41 -1
- package/dist/persistence-middleware-BkHIqvaA.d.ts +55 -0
- package/dist/{recording-replayer-BFhFs7Mc.d.ts → recording-replayer-CmCIIZ02.d.ts} +2 -2
- package/dist/{recording-slice-BiktUIWF.d.ts → recording-slice-d6OtCrza.d.ts} +2 -2
- package/dist/{replay-engine-B88Va62x.d.ts → replay-engine-BGBRQyXs.d.ts} +1 -1
- package/dist/{replay-scene-DtUm6bsr.d.ts → replay-scene-DpAGcAKY.d.ts} +3 -3
- package/dist/sensors/gps-error-handler.d.ts +1 -1
- package/dist/sensors/gps.d.ts +1 -1
- package/dist/sensors/gps.js +2 -2
- package/dist/sensors/index.d.ts +3 -3
- package/dist/sensors/permission-checker.d.ts +2 -2
- package/dist/sensors/permission-checker.js +79 -1
- package/dist/state/app-selectors.d.ts +2 -2
- package/dist/state/app-selectors.js +33 -3
- package/dist/state/combined-root-state.d.ts +2 -0
- package/dist/state/combined-root-state.js +1 -0
- package/dist/state/create-slam-app-store.d.ts +1 -1
- package/dist/state/create-slam-app-store.js +27 -13
- package/dist/state/gps-ar-pose-sampler.d.ts +3 -3
- package/dist/state/gps-event-coordinator.d.ts +1 -1
- package/dist/state/index.d.ts +17 -16
- package/dist/state/index.js +6 -4
- package/dist/state/persistence-middleware.d.ts +2 -2
- package/dist/state/persistence-middleware.js +35 -7
- package/dist/state/recording-options.d.ts +1 -1
- package/dist/state/recording-replayer.d.ts +2 -2
- package/dist/state/recording-slice.d.ts +1 -1
- package/dist/state/replay-engine.d.ts +1 -1
- package/dist/state/store-subscribers.d.ts +2 -2
- package/dist/state/store-subscribers.js +38 -12
- package/dist/state/subscribe-to-selector.d.ts +1 -1
- package/dist/state/tracking-quality.d.ts +2 -0
- package/dist/state/tracking-quality.js +723 -0
- package/dist/state/tracking-slice.d.ts +2 -0
- package/dist/state/tracking-slice.js +147 -0
- package/dist/storage/file-system-utils.d.ts +1 -1
- package/dist/storage/file-system.d.ts +2 -2
- package/dist/storage/file-system.js +52 -1
- package/dist/storage/index.d.ts +8 -8
- package/dist/storage/null-storage-backend.d.ts +1 -1
- package/dist/storage/opfs-storage-backend.d.ts +1 -1
- package/dist/storage/opfs-storage.d.ts +1 -1
- package/dist/storage/storage-backend.d.ts +1 -1
- package/dist/storage/zip-export.d.ts +1 -1
- package/dist/storage/zip-reader.d.ts +1 -1
- package/dist/storage/zip-reader.js +8 -4
- package/dist/{storage-backend-yVnuWGTr.d.ts → storage-backend-CT0Il_AB.d.ts} +1 -1
- package/dist/{store-subscribers-DKKHld49.d.ts → store-subscribers-Dce_CoJF.d.ts} +31 -6
- package/dist/{subscribe-to-selector-ghDKYtap.d.ts → subscribe-to-selector-DIHm3BRZ.d.ts} +1 -1
- package/dist/test-utils/browser-mocks.d.ts +1 -1
- package/dist/test-utils/zip-round-trip-helpers.d.ts +7 -1
- package/dist/test-utils/zip-round-trip-helpers.js +2 -1
- package/dist/tracking-slice-utCNND8t.d.ts +86 -0
- package/dist/types/ar-types.d.ts +1 -1
- package/dist/types/geo-types.d.ts +2 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/utils/concurrency.d.ts +1 -1
- package/dist/utils/failure-tracker.d.ts +1 -1
- package/dist/utils/format-file-size.d.ts +1 -1
- package/dist/utils/fused-path.d.ts +1 -1
- package/dist/utils/index.d.ts +6 -6
- package/dist/utils/list-formatter.d.ts +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.js +68 -8
- package/dist/visualization/accuracy-circles.d.ts +2 -0
- package/dist/visualization/accuracy-circles.js +57 -0
- package/dist/visualization/alignment-lerper.d.ts +1 -1
- package/dist/visualization/camera-follower.d.ts +1 -1
- package/dist/visualization/css3d-renderer-manager.d.ts +1 -1
- package/dist/visualization/frustum-visibility.d.ts +2 -0
- package/dist/visualization/frustum-visibility.js +139 -0
- package/dist/visualization/gps-anchor.d.ts +2 -0
- package/dist/visualization/gps-anchor.js +2 -0
- package/dist/visualization/gps-compass-cubes.d.ts +1 -1
- package/dist/visualization/gps-event-markers.d.ts +2 -2
- package/dist/visualization/gps-event-markers.js +69 -2
- package/dist/visualization/index.d.ts +17 -12
- package/dist/visualization/index.js +6 -2
- package/dist/visualization/leaflet-map-overlay.d.ts +1 -1
- package/dist/visualization/leaflet-map-overlay.js +33 -79
- package/dist/visualization/lerp-utils.d.ts +1 -1
- package/dist/visualization/map-data.d.ts +2 -0
- package/dist/visualization/map-data.js +33 -0
- package/dist/visualization/map-overlay-draw.d.ts +2 -0
- package/dist/visualization/map-overlay-draw.js +107 -0
- package/dist/visualization/map-overlay.d.ts +1 -1
- package/dist/visualization/three-dispose.d.ts +1 -1
- package/dist/visualization/vis-colors.d.ts +1 -1
- package/dist/{webxr-session-COlSrXdL.d.ts → webxr-session-DB5cIZnN.d.ts} +53 -12
- package/dist/{zip-reader-KgJEXbca.d.ts → zip-reader-D1105idz.d.ts} +5 -0
- package/package.json +16 -16
- package/dist/ar/tracking-state.d.ts +0 -2
- package/dist/ar/tracking-state.js +0 -164
- package/dist/combined-root-state-B3SvPNjU.d.ts +0 -6
- package/dist/create-slam-app-store-DBm7g2Zd.d.ts +0 -85
- package/dist/gps-anchored-mesh-manager-CovAFK4g.d.ts +0 -56
- package/dist/gps-event-markers-sVyO9utS.d.ts +0 -67
- package/dist/persistence-middleware-z-75iisb.d.ts +0 -31
- package/dist/tracking-state-B9QfuZCg.d.ts +0 -101
- package/dist/visualization/gps-anchored-mesh-manager.d.ts +0 -2
- package/dist/visualization/gps-anchored-mesh-manager.js +0 -128
- /package/dist/{alignment-lerper-D9BeDwZX.d.ts → alignment-lerper-L1RbWHQ4.d.ts} +0 -0
- /package/dist/{ar-types-B-ORgk6Z.d.ts → ar-types-Ck8LEq8k.d.ts} +0 -0
- /package/dist/{camera-blit-capture-DHuyrrxr.d.ts → camera-blit-capture-C1V9I1Z6.d.ts} +0 -0
- /package/dist/{camera-follower-BMqPddxx.d.ts → camera-follower-1k8mnw5J.d.ts} +0 -0
- /package/dist/{capture-failure-tracker-2Q6oI2uQ.d.ts → capture-failure-tracker-JKb1ST8E.d.ts} +0 -0
- /package/dist/{chromium-camera-access-workaround-CU5zSKNr.d.ts → chromium-camera-access-workaround-NvChXsi8.d.ts} +0 -0
- /package/dist/{concurrency-p6gB30fT.d.ts → concurrency-CMw8pSaG.d.ts} +0 -0
- /package/dist/{css3d-renderer-manager-rgLMVAvd.d.ts → css3d-renderer-manager-CkjCb2HW.d.ts} +0 -0
- /package/dist/{failure-tracker-1sQ_Cgyw.d.ts → failure-tracker-DnHXOIRa.d.ts} +0 -0
- /package/dist/{file-system-utils-BH8FdyIu.d.ts → file-system-utils-CtKiiw27.d.ts} +0 -0
- /package/dist/{format-file-size-onGq0k1Q.d.ts → format-file-size-BTS5H62-.d.ts} +0 -0
- /package/dist/{gps-compass-cubes-jRIJMOuh.d.ts → gps-compass-cubes-CsLtFv4B.d.ts} +0 -0
- /package/dist/{gps-error-handler-CH1S528z.d.ts → gps-error-handler-Dg3ziRVY.d.ts} +0 -0
- /package/dist/{h3-proximity-GwesPTFT.d.ts → h3-proximity-BhfgNbdW.d.ts} +0 -0
- /package/dist/{lerp-utils-CZgQlrmu.d.ts → lerp-utils-B8MM8zCR.d.ts} +0 -0
- /package/dist/{list-formatter-DKQQVLcl.d.ts → list-formatter-CNqi-E2j.d.ts} +0 -0
- /package/dist/{map-overlay-C9ifl_4-.d.ts → map-overlay-DAmreyA3.d.ts} +0 -0
- /package/dist/{opfs-storage-Dlq1I_Gb.d.ts → opfs-storage-DOPkzgeT.d.ts} +0 -0
- /package/dist/{recording-options-BYUFX8iU.d.ts → recording-options-Dq6IsKAv.d.ts} +0 -0
- /package/dist/{scene-node-names-DPsaE2z3.d.ts → scene-node-names-6LBjPmwz.d.ts} +0 -0
- /package/dist/{three-dispose-qt_r5wR1.d.ts → three-dispose-C2drkp6f.d.ts} +0 -0
- /package/dist/{vis-colors-BKkdTIKb.d.ts → vis-colors-CHQhjal3.d.ts} +0 -0
- /package/dist/{xr-camera-texture-BbukNE79.d.ts → xr-camera-texture-BU5YvKAM.d.ts} +0 -0
- /package/dist/{xr-error-handler-DTHfmvrl.d.ts → xr-error-handler-CDY5QxGb.d.ts} +0 -0
- /package/dist/{zip-export-BjrQPv0X.d.ts → zip-export-QO4iLIi7.d.ts} +0 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { t as ARPose } from "./ar-types-Ck8LEq8k.js";
|
|
2
|
+
import { a as TrackingSliceState, t as DeviceOrientation } from "./tracking-slice-utCNND8t.js";
|
|
3
|
+
import { t as RecordingState } from "./recording-slice-d6OtCrza.js";
|
|
4
|
+
import { n as SessionMetadata } from "./opfs-storage-DOPkzgeT.js";
|
|
5
|
+
import { n as StorageBackend } from "./storage-backend-CT0Il_AB.js";
|
|
6
|
+
import { GpsPoint, LatLong, Matrix4, RootState, Vector3 } from "gps-plus-slam-js";
|
|
7
|
+
import * as _$_reduxjs_toolkit0 from "@reduxjs/toolkit";
|
|
8
|
+
import { Middleware, Reducer, ReducersMapObject, configureStore } from "@reduxjs/toolkit";
|
|
9
|
+
|
|
10
|
+
//#region ../src/state/combined-root-state.d.ts
|
|
11
|
+
type CombinedRootState = SlamAppCombinedState;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region ../src/state/tracking-quality.d.ts
|
|
14
|
+
type TrackingQualityState = 'warming-up' | 'ar-lost' | 'degraded' | 'ok';
|
|
15
|
+
interface TrackingQualityReport {
|
|
16
|
+
state: TrackingQualityState;
|
|
17
|
+
/** 0..1, monotonically combined from {@link subScores}. */
|
|
18
|
+
confidence: number;
|
|
19
|
+
subScores: {
|
|
20
|
+
convergence: number;
|
|
21
|
+
residualConsensus: number; /** `null` when the device cannot supply an absolute compass heading. */
|
|
22
|
+
compassAgreement: number | null;
|
|
23
|
+
gpsAccuracy: number;
|
|
24
|
+
coverage: number;
|
|
25
|
+
};
|
|
26
|
+
diagnostics: {
|
|
27
|
+
/**
|
|
28
|
+
* §4.1 (Finding 6): **sum of |Δrotation|** across the last
|
|
29
|
+
* `matrixHistorySize - 1` consecutive snapshot pairs in the ring
|
|
30
|
+
* buffer, in degrees. Replaced the per-pair `recentMaxRotationDeltaDeg`
|
|
31
|
+
* on 2026-05-23 — see
|
|
32
|
+
* `GpsPlusSlamJs_Docs/docs/2026-05-23-tracking-quality-hud-user-feedback.md`
|
|
33
|
+
* (Finding 6). Surfaced in the recorder HUD as `ΣΔrot:`.
|
|
34
|
+
*/
|
|
35
|
+
recentSumRotationDeltaDeg: number; /** §4.1 (Finding 6): sum of |Δtranslation| across the same window, in metres. Surfaced as `ΣΔpos:`. */
|
|
36
|
+
recentSumTranslationDeltaM: number;
|
|
37
|
+
medianResidualM: number;
|
|
38
|
+
medianRecentGpsAccuracyM: number;
|
|
39
|
+
walkedDistanceM: number;
|
|
40
|
+
directionSpreadDeg: number; /** `null` when §4.3 is unavailable (no absolute compass). */
|
|
41
|
+
headingDeltaDeg: number | null;
|
|
42
|
+
compassDriftDetected: boolean;
|
|
43
|
+
observationsSeen: number; /** §4.6 — diagnostic only, never feeds the aggregate. */
|
|
44
|
+
gpsVsFusedMaxDivergenceM: number;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
interface TrackingQualityOptions {
|
|
48
|
+
/** §4.1 ring-buffer length. Seed default; corpus-tuned in §6.1. */
|
|
49
|
+
matrixHistorySize?: number;
|
|
50
|
+
/** §4.2 GPS-window length. Seed default; corpus-tuned in §6.1. */
|
|
51
|
+
residualWindowSize?: number;
|
|
52
|
+
/** Confidence threshold below which `state` reports `'degraded'`. */
|
|
53
|
+
degradedThreshold?: number;
|
|
54
|
+
/** §4.4 window length for GPS-accuracy budget. */
|
|
55
|
+
gpsAccuracyWindowSize?: number;
|
|
56
|
+
/** §4.5 walked-distance threshold for coverage = 1.0. */
|
|
57
|
+
coverageWalkedDistanceM?: number;
|
|
58
|
+
/** §4.5 direction-spread threshold for coverage = 1.0. */
|
|
59
|
+
coverageDirectionSpreadDeg?: number;
|
|
60
|
+
/** §4.1 ΣΔrotation (deg) at/below which convergence scores 1.0. Fail ramp ends at 4×. */
|
|
61
|
+
convergenceRotationWarnDeg?: number;
|
|
62
|
+
/** §4.1 ΣΔtranslation (m) at/below which convergence scores 1.0. Fail ramp ends at 4×. */
|
|
63
|
+
convergenceTranslationWarnM?: number;
|
|
64
|
+
/** §4.3 EMA threshold (deg) below which compass scores 1.0. */
|
|
65
|
+
compassWarnDeg?: number;
|
|
66
|
+
/** §4.3 EMA threshold (deg) above which compass scores 0.0. */
|
|
67
|
+
compassFailDeg?: number;
|
|
68
|
+
/** Minimum GPS observations before leaving `warming-up`. */
|
|
69
|
+
warmupMinObservations?: number;
|
|
70
|
+
/** Minimum coverage score before leaving `warming-up`. */
|
|
71
|
+
warmupMinCoverage?: number;
|
|
72
|
+
/** §4.2 residual saturation target (m). */
|
|
73
|
+
residualConfidenceTargetM?: number;
|
|
74
|
+
/** §4.4 GPS-accuracy floor used to normalise residuals (m). */
|
|
75
|
+
gpsAccuracyFloorM?: number;
|
|
76
|
+
/** §4.3 consecutive compass-agreeing observations for first agreement. */
|
|
77
|
+
firstAgreementMinStreak?: number;
|
|
78
|
+
/** §4.8 consecutive sub-threshold observations before ok → degraded. */
|
|
79
|
+
degradedHoldoff?: number;
|
|
80
|
+
/**
|
|
81
|
+
* §4.8b (Finding 4) — EMA blend factor applied to `subScores.convergence`.
|
|
82
|
+
* `1.0` disables smoothing (raw value). `0 < α < 1` blends as
|
|
83
|
+
* `smoothed = prevSmoothed + α * (raw - prevSmoothed)`. First observation
|
|
84
|
+
* (no prior smoothed value) is seeded to the raw value.
|
|
85
|
+
*/
|
|
86
|
+
convergenceEmaAlpha?: number;
|
|
87
|
+
}
|
|
88
|
+
declare const DEFAULT_TRACKING_QUALITY_OPTIONS: Required<TrackingQualityOptions>;
|
|
89
|
+
/**
|
|
90
|
+
* Single buffered alignment matrix snapshot. `matrix` is stored as a
|
|
91
|
+
* plain `number[]` (length 16, row-major) so it stays serializable for
|
|
92
|
+
* RTK's `SerializableStateInvariantMiddleware` and for action logs.
|
|
93
|
+
*/
|
|
94
|
+
interface AlignmentSnapshot {
|
|
95
|
+
observationIndex: number;
|
|
96
|
+
matrix: number[];
|
|
97
|
+
}
|
|
98
|
+
interface TrackingQualitySliceState {
|
|
99
|
+
recentAlignments: AlignmentSnapshot[];
|
|
100
|
+
firstAgreementObservationIndex: number | null;
|
|
101
|
+
report: TrackingQualityReport | null;
|
|
102
|
+
/** §4.8 — consecutive observations with raw confidence < degradedThreshold. */
|
|
103
|
+
degradedConsecutiveCount: number;
|
|
104
|
+
/**
|
|
105
|
+
* §4.8b (Finding 4) — last EMA-smoothed convergence sub-score. `null`
|
|
106
|
+
* means "no prior observation" and the next aggregator run will seed
|
|
107
|
+
* the value with the raw convergence score. Reset on
|
|
108
|
+
* `resetTrackingQuality`.
|
|
109
|
+
*/
|
|
110
|
+
smoothedConvergence: number | null;
|
|
111
|
+
}
|
|
112
|
+
interface ConvergenceResult {
|
|
113
|
+
score: number;
|
|
114
|
+
/** §4.1 (Finding 6): sum of |Δrotation| across the last N-1 pairs. */
|
|
115
|
+
recentSumRotationDeltaDeg: number;
|
|
116
|
+
/** §4.1 (Finding 6): sum of |Δtranslation| across the last N-1 pairs. */
|
|
117
|
+
recentSumTranslationDeltaM: number;
|
|
118
|
+
/** Pair count used (≥ 2 snapshots ⇒ ≥ 1 pair, else 0). */
|
|
119
|
+
pairCount: number;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* §4.1 matrix-history convergence over the buffered snapshots.
|
|
123
|
+
*
|
|
124
|
+
* Reuses the same kernel idea as `computeStabilityDelta` from the
|
|
125
|
+
* Investigation helpers (rotation + translation delta between two 4×4
|
|
126
|
+
* matrices). With 0 or 1 snapshot we return score 0 — convergence is
|
|
127
|
+
* undefined until at least one consecutive pair exists.
|
|
128
|
+
*
|
|
129
|
+
* Finding 6 (2026-05-23 field test): the per-pair `max` aggregation was
|
|
130
|
+
* replaced with a **sum** across the window. `max` is a burst detector
|
|
131
|
+
* — dominated by one bad pair, blind to slow drift; `sum` answers
|
|
132
|
+
* "how much alignment motion accumulated over the window?" and exposes
|
|
133
|
+
* slow creeping drift in user-readable units (°, m). The HUD now shows
|
|
134
|
+
* the raw sums (`ΣΔrot:`, `ΣΔpos:`) alongside the EMA-smoothed `Conv:`
|
|
135
|
+
* sub-score (Finding 4) so the user can debug an unstable reading.
|
|
136
|
+
*/
|
|
137
|
+
declare function computeConvergence(snapshots: readonly AlignmentSnapshot[], options?: {
|
|
138
|
+
rotationWarnDeg?: number;
|
|
139
|
+
translationWarnM?: number;
|
|
140
|
+
}): ConvergenceResult;
|
|
141
|
+
/**
|
|
142
|
+
* Rotation and translation delta between two 4×4 alignment matrices in
|
|
143
|
+
* the column-major layout that gl-matrix and the framework use.
|
|
144
|
+
*
|
|
145
|
+
* Rotation: extract the orientation quaternion with `mat4.getRotation`
|
|
146
|
+
* and compute the relative angle via `quat.getAngle` (degrees).
|
|
147
|
+
* Translation: extract the origin column with `mat4.getTranslation` and
|
|
148
|
+
* compute the Euclidean distance.
|
|
149
|
+
*
|
|
150
|
+
* This is the **single shared kernel** for the AppFramework reporter and
|
|
151
|
+
* the Investigation harness (see §11 (a) of the tracking-quality plan).
|
|
152
|
+
* `GpsPlusSlamJs_Investigation/src/investigation-helpers.ts` re-exports
|
|
153
|
+
* `computeStabilityDelta` as a thin wrapper around this function so the
|
|
154
|
+
* §6.1 corpus sweep and the runtime convergence score share one numeric
|
|
155
|
+
* definition.
|
|
156
|
+
*/
|
|
157
|
+
declare function matrixDelta(prev: readonly number[], curr: readonly number[]): {
|
|
158
|
+
rotationDeltaDeg: number;
|
|
159
|
+
translationDeltaM: number;
|
|
160
|
+
};
|
|
161
|
+
interface ResidualConsensusResult {
|
|
162
|
+
score: number;
|
|
163
|
+
medianResidualM: number;
|
|
164
|
+
count: number;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* §4.2 — Median residual between the last `K` GPS observations and the
|
|
168
|
+
* positions you would have predicted by transforming the matching
|
|
169
|
+
* odometry positions through the current alignment matrix.
|
|
170
|
+
*
|
|
171
|
+
* Returns `score = 0`, `medianResidualM = 0` when we have fewer than
|
|
172
|
+
* 2 paired observations or when the alignment matrix / zero ref is
|
|
173
|
+
* not yet set.
|
|
174
|
+
*/
|
|
175
|
+
declare function computeResidualConsensus(alignmentMatrix: Matrix4 | null, gpsPositions: readonly GpsPoint[], odometryPositions: readonly Vector3[], zeroRef: LatLong | null, options?: Pick<Required<TrackingQualityOptions>, 'residualWindowSize' | 'residualConfidenceTargetM' | 'gpsAccuracyFloorM'>): ResidualConsensusResult;
|
|
176
|
+
interface GpsAccuracyResult {
|
|
177
|
+
score: number;
|
|
178
|
+
medianM: number;
|
|
179
|
+
countAccurate: number;
|
|
180
|
+
countTotal: number;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* §4.4 — Median `latLongAccuracy` of the last `K` GPS points, with
|
|
184
|
+
* an "accurate-fix count" diagnostic. Cheap, always available.
|
|
185
|
+
*
|
|
186
|
+
* `score` ramps from 1.0 at median ≤ 3 m to 0.0 at median ≥ 25 m
|
|
187
|
+
* (linear), matching the plan's "≤ 5 m is good" heuristic with a
|
|
188
|
+
* generous fail tail.
|
|
189
|
+
*/
|
|
190
|
+
declare function computeGpsAccuracy(gpsPositions: readonly GpsPoint[], options?: {
|
|
191
|
+
windowSize?: number;
|
|
192
|
+
goodMedianM?: number;
|
|
193
|
+
badMedianM?: number;
|
|
194
|
+
}): GpsAccuracyResult;
|
|
195
|
+
interface CoverageResult {
|
|
196
|
+
score: number;
|
|
197
|
+
walkedDistanceM: number;
|
|
198
|
+
directionSpreadDeg: number;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* §4.5 — Coverage = how far the user has walked AND how diverse the
|
|
202
|
+
* walking direction has been. Both required: a long but unidirectional
|
|
203
|
+
* walk leaves the rotation about the walking axis under-determined.
|
|
204
|
+
*/
|
|
205
|
+
declare function computeCoverage(odometryPositions: readonly Vector3[], options?: {
|
|
206
|
+
walkedDistanceM?: number;
|
|
207
|
+
directionSpreadDeg?: number;
|
|
208
|
+
}): CoverageResult;
|
|
209
|
+
interface CompassAgreementResult {
|
|
210
|
+
/** `null` when `absolute !== true` on the sensor orientation. */
|
|
211
|
+
score: number | null;
|
|
212
|
+
headingDeltaDeg: number | null;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* §4.3 — Compare the alignment matrix's mapping of AR-forward to ENU
|
|
216
|
+
* against the device compass heading. Returns `score = null` whenever
|
|
217
|
+
* the sensor's `absolute !== true` so the aggregate excludes the
|
|
218
|
+
* sub-score (per Q2 in the plan).
|
|
219
|
+
*
|
|
220
|
+
* AR-forward in our `ARPose` convention is `(0, 0, -1)` (right-handed,
|
|
221
|
+
* Y-up). We rotate that by the alignment's 3×3 rotation, take its
|
|
222
|
+
* North/East components, and compare against the compass alpha.
|
|
223
|
+
*/
|
|
224
|
+
declare function computeCompassAgreement(alignmentMatrix: Matrix4 | null, sensorOrientation: DeviceOrientation | null, arPose: ARPose | null, options?: {
|
|
225
|
+
warnDeg?: number;
|
|
226
|
+
failDeg?: number;
|
|
227
|
+
}): CompassAgreementResult;
|
|
228
|
+
/**
|
|
229
|
+
* §4.6 — Maximum lateral distance between raw GPS positions and the
|
|
230
|
+
* positions you would predict by transforming the matching odometry
|
|
231
|
+
* positions through the current alignment. Diagnostic only — never
|
|
232
|
+
* feeds the aggregate confidence per the plan.
|
|
233
|
+
*/
|
|
234
|
+
declare function computeGpsVsFusedDivergence(alignmentMatrix: Matrix4 | null, gpsPositions: readonly GpsPoint[], odometryPositions: readonly Vector3[], zeroRef: LatLong | null, windowSize?: number): number;
|
|
235
|
+
declare const snapshotPushed: _$_reduxjs_toolkit0.ActionCreatorWithPayload<AlignmentSnapshot, "trackingQuality/snapshotPushed">, snapshotsTrimmed: _$_reduxjs_toolkit0.ActionCreatorWithPayload<{
|
|
236
|
+
size: number;
|
|
237
|
+
}, "trackingQuality/snapshotsTrimmed">, reportUpdated: _$_reduxjs_toolkit0.ActionCreatorWithPayload<TrackingQualityReport | null, "trackingQuality/reportUpdated">, firstAgreementReached: _$_reduxjs_toolkit0.ActionCreatorWithPayload<number, "trackingQuality/firstAgreementReached">, degradedCountUpdated: _$_reduxjs_toolkit0.ActionCreatorWithPayload<number, "trackingQuality/degradedCountUpdated">, resetTrackingQuality: _$_reduxjs_toolkit0.ActionCreatorWithoutPayload<"trackingQuality/resetTrackingQuality">;
|
|
238
|
+
declare const trackingQualityReducer: _$_reduxjs_toolkit0.Reducer<TrackingQualitySliceState>;
|
|
239
|
+
interface RootWithTrackingQuality {
|
|
240
|
+
trackingQuality?: TrackingQualitySliceState;
|
|
241
|
+
}
|
|
242
|
+
declare function selectTrackingQuality(state: RootWithTrackingQuality): TrackingQualityReport | null;
|
|
243
|
+
declare function selectRecentAlignments(state: RootWithTrackingQuality): readonly AlignmentSnapshot[];
|
|
244
|
+
declare function selectFirstAgreementObservationIndex(state: RootWithTrackingQuality): number | null;
|
|
245
|
+
/**
|
|
246
|
+
* Pure function — produces a {@link TrackingQualityReport} from a root
|
|
247
|
+
* state and options. The Investigation harness imports this directly to
|
|
248
|
+
* sweep `(N, K)` without going through the Redux listener middleware.
|
|
249
|
+
*
|
|
250
|
+
* The report's `state` enum follows §5 of the plan:
|
|
251
|
+
* - `ar-lost` whenever `tracking.phase !== 'tracking'`
|
|
252
|
+
* - `warming-up` until `coverage ≥ warmupMinCoverage` AND
|
|
253
|
+
* `observationsSeen ≥ warmupMinObservations`
|
|
254
|
+
* - then `ok` / `degraded` from `min(subScores)` vs.
|
|
255
|
+
* `degradedThreshold`.
|
|
256
|
+
*/
|
|
257
|
+
declare function computeTrackingQualityReport(rootState: CombinedRootState, options?: TrackingQualityOptions): TrackingQualityReport;
|
|
258
|
+
/**
|
|
259
|
+
* Build the listener middleware that drives the `trackingQuality`
|
|
260
|
+
* slice. Register the returned middleware in `createSlamAppStore`.
|
|
261
|
+
*
|
|
262
|
+
* Behaviour:
|
|
263
|
+
* - On `gpsData/recordGpsEvent` and `gpsData/setZeroPos`: if the
|
|
264
|
+
* alignment matrix changed, dispatch `snapshotPushed` +
|
|
265
|
+
* `snapshotsTrimmed`. Then recompute the report and dispatch
|
|
266
|
+
* `reportUpdated` if it changed.
|
|
267
|
+
* - On `recording/startSession` and `tracking/resetTracking`:
|
|
268
|
+
* dispatch `resetTrackingQuality` and recompute the report.
|
|
269
|
+
* - On `tracking/poseReceived` and `tracking/poseLost`: only
|
|
270
|
+
* recompute the report (no buffer change).
|
|
271
|
+
* - All dispatches are idempotency-gated so quiet motion does not
|
|
272
|
+
* churn the store.
|
|
273
|
+
*/
|
|
274
|
+
declare function createTrackingQualityListenerMiddleware(options?: TrackingQualityOptions): Middleware;
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region ../src/state/create-slam-app-store.d.ts
|
|
277
|
+
/**
|
|
278
|
+
* Base shape produced by `createSlamAppStore` with no `extraReducers`.
|
|
279
|
+
*
|
|
280
|
+
* Library state (`gpsData` / `gpsElements` / `arElements`) plus the
|
|
281
|
+
* framework recording slice (`recording`).
|
|
282
|
+
*/
|
|
283
|
+
interface SlamAppRootState extends RootState {
|
|
284
|
+
recording: RecordingState;
|
|
285
|
+
tracking: TrackingSliceState;
|
|
286
|
+
trackingQuality: TrackingQualitySliceState;
|
|
287
|
+
}
|
|
288
|
+
/** A bare-minimum middleware signature compatible with RTK's middleware list. */
|
|
289
|
+
type SlamAppMiddleware = Middleware<any, any, any>;
|
|
290
|
+
/**
|
|
291
|
+
* Options for {@link createSlamAppStore}.
|
|
292
|
+
*/
|
|
293
|
+
interface SlamAppStoreOptions<ExtraReducers extends ReducersMapObject = Record<string, never>> {
|
|
294
|
+
/**
|
|
295
|
+
* Persistence backend used to bridge Redux actions to durable storage.
|
|
296
|
+
* Tests / replay paths should pass `NullStorageBackend`.
|
|
297
|
+
*/
|
|
298
|
+
storageBackend: StorageBackend;
|
|
299
|
+
/**
|
|
300
|
+
* Caller-supplied reducers added alongside the framework's built-ins.
|
|
301
|
+
* Use this seam to plug recorder slices (routing, refPoints, scenario)
|
|
302
|
+
* or any app-specific state without forking the factory.
|
|
303
|
+
*/
|
|
304
|
+
extraReducers?: ExtraReducers;
|
|
305
|
+
/**
|
|
306
|
+
* Caller-supplied middlewares appended after RTK defaults and the
|
|
307
|
+
* persistence middleware.
|
|
308
|
+
*/
|
|
309
|
+
extraMiddleware?: ReadonlyArray<SlamAppMiddleware>;
|
|
310
|
+
/**
|
|
311
|
+
* Additional slice prefixes to persist beyond the framework built-ins
|
|
312
|
+
* (`gpsData`, `recording`). Pass caller-owned slice names derived from
|
|
313
|
+
* the slice itself — e.g. `slicePrefixOf(addRefPointEntry.type)` or
|
|
314
|
+
* `refPointsSlice.name` — never a hand-typed literal, so a rename can
|
|
315
|
+
* never silently drop the slice's actions from recordings.
|
|
316
|
+
*/
|
|
317
|
+
persistedExtraPrefixes?: readonly string[];
|
|
318
|
+
/**
|
|
319
|
+
* Invoked when the persistence middleware fails to durably write an action.
|
|
320
|
+
*/
|
|
321
|
+
onWriteFailure?: (error: Error) => void;
|
|
322
|
+
/**
|
|
323
|
+
* Disables RTK's expensive dev-only middleware (Serializable / Immutable
|
|
324
|
+
* checks). Default `true`; set `false` for high-throughput replay scenarios.
|
|
325
|
+
*/
|
|
326
|
+
enableDevChecks?: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* License key for the core library. Defaults to the bundled community key.
|
|
329
|
+
* Apps with a paid license override here. Validation always runs and throws
|
|
330
|
+
* on invalid / expired / empty keys.
|
|
331
|
+
*
|
|
332
|
+
* @see EULA.md §3 — License Key
|
|
333
|
+
*/
|
|
334
|
+
licenseKey?: string;
|
|
335
|
+
/**
|
|
336
|
+
* Optional overrides for the tracking-quality reporter
|
|
337
|
+
* (matrix-history size, residual window, thresholds, etc.).
|
|
338
|
+
*
|
|
339
|
+
* @see docs/2026-05-16-tracking-quality-metrics-plan.md
|
|
340
|
+
*/
|
|
341
|
+
trackingQualityOptions?: Partial<TrackingQualityOptions>;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Combined root state: the framework's base state plus any caller-supplied
|
|
345
|
+
* extras. Generic so consumers get exact typing for the slices they add.
|
|
346
|
+
*/
|
|
347
|
+
type SlamAppCombinedState<ExtraReducers extends ReducersMapObject = Record<never, never>> = SlamAppRootState & { [K in keyof ExtraReducers]: ExtraReducers[K] extends Reducer<infer S> ? S : never };
|
|
348
|
+
/**
|
|
349
|
+
* The store object returned by {@link createSlamAppStore}.
|
|
350
|
+
*
|
|
351
|
+
* Wraps RTK's store and adds storage-delegation helpers so consumers can
|
|
352
|
+
* issue frame / metadata writes without holding a separate handle to the
|
|
353
|
+
* `StorageBackend`.
|
|
354
|
+
*/
|
|
355
|
+
interface SlamAppStore<ExtraReducers extends ReducersMapObject = Record<string, never>> {
|
|
356
|
+
getState: () => SlamAppCombinedState<ExtraReducers>;
|
|
357
|
+
dispatch: ReturnType<typeof configureStore>['dispatch'];
|
|
358
|
+
subscribe: (listener: () => void) => () => void;
|
|
359
|
+
/** Persist a captured camera frame via the configured backend. */
|
|
360
|
+
writeFrame: (blob: Blob, index: number) => Promise<void>;
|
|
361
|
+
/** Persist session metadata (`session.json`) via the configured backend. */
|
|
362
|
+
writeSessionMetadata: (metadata: SessionMetadata) => Promise<void>;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Build a Redux store wired with library + recording slices, persistence
|
|
366
|
+
* middleware, and any caller-supplied extras. See module docstring for the
|
|
367
|
+
* design rationale.
|
|
368
|
+
*/
|
|
369
|
+
declare function createSlamAppStore<ExtraReducers extends ReducersMapObject = Record<string, never>>(options: SlamAppStoreOptions<ExtraReducers>): SlamAppStore<ExtraReducers>;
|
|
370
|
+
//#endregion
|
|
371
|
+
export { resetTrackingQuality as A, computeResidualConsensus as C, firstAgreementReached as D, degradedCountUpdated as E, snapshotsTrimmed as F, trackingQualityReducer as I, CombinedRootState as L, selectRecentAlignments as M, selectTrackingQuality as N, matrixDelta as O, snapshotPushed as P, computeGpsVsFusedDivergence as S, createTrackingQualityListenerMiddleware as T, TrackingQualityState as _, SlamAppStoreOptions as a, computeCoverage as b, CompassAgreementResult as c, DEFAULT_TRACKING_QUALITY_OPTIONS as d, GpsAccuracyResult as f, TrackingQualitySliceState as g, TrackingQualityReport as h, SlamAppStore as i, selectFirstAgreementObservationIndex as j, reportUpdated as k, ConvergenceResult as l, TrackingQualityOptions as m, SlamAppMiddleware as n, createSlamAppStore as o, ResidualConsensusResult as p, SlamAppRootState as r, AlignmentSnapshot as s, SlamAppCombinedState as t, CoverageResult as u, computeCompassAgreement as v, computeTrackingQualityReport as w, computeGpsAccuracy as x, computeConvergence as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as SessionMetadata } from "./opfs-storage-
|
|
1
|
+
import { n as SessionMetadata } from "./opfs-storage-DOPkzgeT.js";
|
|
2
2
|
|
|
3
3
|
//#region ../src/storage/file-system.d.ts
|
|
4
4
|
/**
|
|
@@ -80,5 +80,35 @@ declare function setCurrentScenario(scenarioName: string): Promise<FileSystemDir
|
|
|
80
80
|
* Legacy: used during OPFS recovery.
|
|
81
81
|
*/
|
|
82
82
|
declare function ensureScenarioDirectory(scenarioName: string): Promise<FileSystemDirectoryHandle | null>;
|
|
83
|
+
/**
|
|
84
|
+
* Result of clearing the reference-point cache across all scenarios.
|
|
85
|
+
*/
|
|
86
|
+
interface ClearRefPointsCacheResult {
|
|
87
|
+
/** Number of scenarios whose `refPoints/` directory was deleted. */
|
|
88
|
+
readonly scenariosCleared: number;
|
|
89
|
+
/** Total number of scenarios scanned (including ones with no cache). */
|
|
90
|
+
readonly scenariosScanned: number;
|
|
91
|
+
/** Names of scenarios that failed to clear, with reason. */
|
|
92
|
+
readonly errors: {
|
|
93
|
+
scenarioName: string;
|
|
94
|
+
reason: string;
|
|
95
|
+
}[];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Clear the cached `refPoints/` directory for every scenario in OPFS.
|
|
99
|
+
*
|
|
100
|
+
* Used by the "Clear Reference Point Cache" maintenance action so that the
|
|
101
|
+
* next scenario load re-imports ref points from the read folder's `*.zip`
|
|
102
|
+
* recordings (see ref-point-recovery in the recorder app).
|
|
103
|
+
*
|
|
104
|
+
* Failures for individual scenarios are collected in `errors` rather than
|
|
105
|
+
* aborting the whole operation — partial progress is still useful.
|
|
106
|
+
*
|
|
107
|
+
* @throws Error if OPFS storage is unavailable (e.g. `initStorage()` not yet
|
|
108
|
+
* called, or browser does not support OPFS). Surfacing this loudly avoids
|
|
109
|
+
* reporting a silent "0 scenarios cleared" success that would mask the
|
|
110
|
+
* real failure to the user.
|
|
111
|
+
*/
|
|
112
|
+
declare function clearRefPointsCacheForAllScenarios(): Promise<ClearRefPointsCacheResult>;
|
|
83
113
|
//#endregion
|
|
84
|
-
export {
|
|
114
|
+
export { getCurrentScenarioHandle as a, resetForNewSession as c, startSession as d, verifyWriteAccess as f, writeSessionMetadata as h, ensureScenarioDirectory as i, resetStorageState as l, writeFrame as m, WriteAccessResult as n, initStorage as o, writeAction as p, clearRefPointsCacheForAllScenarios as r, listSessions as s, ClearRefPointsCacheResult as t, setCurrentScenario as u };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region ../src/ar/frame-loop.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Per-frame callback registry. The WebXR session owns the single
|
|
4
|
+
* `renderer.setAnimationLoop(...)` hook for the page; components that need
|
|
5
|
+
* a per-frame tick register here and the session's `onXRFrame` invokes
|
|
6
|
+
* `runFrameUpdates(dt, elapsed)` once per frame.
|
|
7
|
+
*
|
|
8
|
+
* Plain functions, not a class: there is exactly one frame loop per session
|
|
9
|
+
* and singletons-of-singletons add no value. See
|
|
10
|
+
* `2026-05-13-ecs-migration-plan.md` for the design rationale and the
|
|
11
|
+
* rules new `FrameUpdate` bodies must follow (pure function of `dt` plus
|
|
12
|
+
* selectors; no direct Redux dispatch from inside a tick).
|
|
13
|
+
*/
|
|
14
|
+
type FrameUpdate = (dt: number, elapsed: number) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Register a per-frame callback. Returns an unregister function.
|
|
17
|
+
*
|
|
18
|
+
* Registration is idempotent — calling with the same `fn` twice is a no-op
|
|
19
|
+
* (it remains a single entry in the underlying `Set`).
|
|
20
|
+
*/
|
|
21
|
+
declare function registerFrameUpdate(fn: FrameUpdate): () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Invoke all registered callbacks. Called by the WebXR session's
|
|
24
|
+
* `onXRFrame` once per frame with the XR-derived `dt` (seconds since the
|
|
25
|
+
* previous frame; 0 on the first frame after a reset) and `elapsed`
|
|
26
|
+
* (seconds since the session started).
|
|
27
|
+
*
|
|
28
|
+
* The set is snapshotted before iterating so that
|
|
29
|
+
* `registerFrameUpdate` / unregister calls made by a handler during the
|
|
30
|
+
* same frame are deferred to the next tick. Iterating the live `Set`
|
|
31
|
+
* would otherwise skip a not-yet-visited entry that an earlier handler
|
|
32
|
+
* unregistered — a hard-to-debug source of non-determinism.
|
|
33
|
+
*/
|
|
34
|
+
declare function runFrameUpdates(dt: number, elapsed: number): void;
|
|
35
|
+
/**
|
|
36
|
+
* Clear all registrations. Called from `resetWebXRState()` so a fresh
|
|
37
|
+
* session starts with an empty registry (any callbacks from the previous
|
|
38
|
+
* session are dropped along with their owning components).
|
|
39
|
+
*/
|
|
40
|
+
declare function clearFrameUpdates(): void;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { runFrameUpdates as i, clearFrameUpdates as n, registerFrameUpdate as r, FrameUpdate as t };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
|
|
3
|
+
//#region ../src/visualization/frustum-visibility.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Build (or refresh) a Three.js `Frustum` from `camera`'s current world
|
|
6
|
+
* transform and projection matrix. If `out` is provided, the frustum is
|
|
7
|
+
* written into it and returned; otherwise the module-level scratch frustum
|
|
8
|
+
* is used. Callers MUST treat the returned frustum as immutable until they
|
|
9
|
+
* next call this function or use one of the predicates without an injected
|
|
10
|
+
* frustum (both reuse the same scratch).
|
|
11
|
+
*/
|
|
12
|
+
declare function buildCameraFrustum(camera: THREE.Camera, out?: THREE.Frustum): THREE.Frustum;
|
|
13
|
+
/**
|
|
14
|
+
* Strictly check whether a single world-space point lies inside all six
|
|
15
|
+
* frustum planes. Useful for HUD/follow logic where the caller already has
|
|
16
|
+
* the target world position and wants the cheapest possible check.
|
|
17
|
+
*/
|
|
18
|
+
declare function isPointInCameraFrustum(camera: THREE.Camera, point: THREE.Vector3, frustum?: THREE.Frustum): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Check whether a world-space bounding sphere intersects the camera frustum
|
|
21
|
+
* (returns true even for partial overlap). Useful for callers that maintain
|
|
22
|
+
* a precomputed bounding sphere (LOD systems, instanced meshes, future
|
|
23
|
+
* `ArPowerSaver`).
|
|
24
|
+
*/
|
|
25
|
+
declare function isSphereInCameraFrustum(camera: THREE.Camera, sphere: THREE.Sphere, frustum?: THREE.Frustum): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Check whether an `Object3D` is currently (at least partially) inside the
|
|
28
|
+
* camera frustum. The world bounding volume is resolved in tiers, cheapest
|
|
29
|
+
* first, so each common Three.js object type is gated by where it actually
|
|
30
|
+
* draws:
|
|
31
|
+
*
|
|
32
|
+
* 1. **Sprites** (`isSprite`) are screen-space billboards with no meaningful
|
|
33
|
+
* world geometry, so their world-space origin is tested as a point.
|
|
34
|
+
* 2. **Objects carrying an object-level `boundingSphere`** (`InstancedMesh`,
|
|
35
|
+
* `SkinnedMesh`, or any caller that pre-populates one) use that sphere,
|
|
36
|
+
* which reflects the instance spread / posed extent — unlike the base
|
|
37
|
+
* geometry sphere. It is computed lazily via `computeBoundingSphere()`
|
|
38
|
+
* when missing.
|
|
39
|
+
* 3. **Single renderables carrying a `geometry`** (`Mesh`, `Points`, `Line`,
|
|
40
|
+
* …) use the geometry's local bounding sphere × `matrixWorld`.
|
|
41
|
+
* 4. **Containers with children** (`Group`, `LOD`, …) use the world-space
|
|
42
|
+
* union of their descendants' bounding boxes (`Box3.setFromObject`),
|
|
43
|
+
* converted to a sphere.
|
|
44
|
+
* 5. **Truly empty / geometry-less objects** have no bounding volume and are
|
|
45
|
+
* treated as visible (`true`) — the conservative default for visibility
|
|
46
|
+
* gating.
|
|
47
|
+
*
|
|
48
|
+
* This deliberately avoids `Frustum.intersectsObject`, which unconditionally
|
|
49
|
+
* dereferences `object.geometry.boundingSphere` and therefore throws a
|
|
50
|
+
* `TypeError` for geometry-less objects such as `Group`s.
|
|
51
|
+
*
|
|
52
|
+
* Callers should ensure `object.updateMatrixWorld()` (with descendants, for
|
|
53
|
+
* containers: `updateMatrixWorld(true)`) has already run this frame (it
|
|
54
|
+
* normally has, via `renderer.render`).
|
|
55
|
+
*/
|
|
56
|
+
declare function isObjectInCameraFrustum(camera: THREE.Camera, object: THREE.Object3D, frustum?: THREE.Frustum): boolean;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { isSphereInCameraFrustum as i, isObjectInCameraFrustum as n, isPointInCameraFrustum as r, buildCameraFrustum as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as gpsToH3, i as findNearbyGeoAnchor, n as KnownGeoAnchor, o as h3CellsMatch, r as approxDistanceMetres, s as isH3Index, t as H3_RESOLUTION } from "../h3-proximity-
|
|
1
|
+
import { a as gpsToH3, i as findNearbyGeoAnchor, n as KnownGeoAnchor, o as h3CellsMatch, r as approxDistanceMetres, s as isH3Index, t as H3_RESOLUTION } from "../h3-proximity-BhfgNbdW.js";
|
|
2
2
|
export { H3_RESOLUTION, KnownGeoAnchor, approxDistanceMetres, findNearbyGeoAnchor, gpsToH3, h3CellsMatch, isH3Index };
|
package/dist/geo/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as gpsToH3, i as findNearbyGeoAnchor, n as KnownGeoAnchor, o as h3CellsMatch, r as approxDistanceMetres, s as isH3Index, t as H3_RESOLUTION } from "../h3-proximity-
|
|
1
|
+
import { a as gpsToH3, i as findNearbyGeoAnchor, n as KnownGeoAnchor, o as h3CellsMatch, r as approxDistanceMetres, s as isH3Index, t as H3_RESOLUTION } from "../h3-proximity-BhfgNbdW.js";
|
|
2
2
|
export { H3_RESOLUTION, type KnownGeoAnchor, approxDistanceMetres, findNearbyGeoAnchor, gpsToH3, h3CellsMatch, isH3Index };
|
|
@@ -18,6 +18,21 @@ interface GpsCoord {
|
|
|
18
18
|
readonly lat: number;
|
|
19
19
|
readonly lng: number;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* A raw GPS sample with optional accuracy (1σ horizontal radius in meters,
|
|
23
|
+
* mirroring the browser's `GeolocationCoordinates.accuracy`).
|
|
24
|
+
*
|
|
25
|
+
* Used for 2D map visualizations that draw a per-event accuracy circle
|
|
26
|
+
* alongside the GPS polyline so that low-quality fixes (large radius) are
|
|
27
|
+
* visually distinguishable from accurate fixes (small radius).
|
|
28
|
+
*/
|
|
29
|
+
interface RawGpsSample extends GpsCoord {
|
|
30
|
+
/**
|
|
31
|
+
* Horizontal accuracy in meters (1σ / 68% confidence).
|
|
32
|
+
* `undefined` when the source GPS event lacked the field.
|
|
33
|
+
*/
|
|
34
|
+
readonly accuracy?: number;
|
|
35
|
+
}
|
|
21
36
|
/**
|
|
22
37
|
* A reference point with GPS location and a human-readable name.
|
|
23
38
|
* Extends GpsCoord so it is usable wherever GpsCoord is expected.
|
|
@@ -26,4 +41,4 @@ interface RefPointMarker extends GpsCoord {
|
|
|
26
41
|
readonly name: string;
|
|
27
42
|
}
|
|
28
43
|
//#endregion
|
|
29
|
-
export {
|
|
44
|
+
export { RawGpsSample as n, RefPointMarker as r, GpsCoord as t };
|
|
@@ -17,7 +17,7 @@ interface GpsPosition {
|
|
|
17
17
|
/**
|
|
18
18
|
* Raw device orientation from the browser's DeviceOrientationEvent API.
|
|
19
19
|
* Fields are nullable because sensors may be unavailable on some devices.
|
|
20
|
-
* See also: DeviceOrientation in
|
|
20
|
+
* See also: DeviceOrientation in state/tracking-slice.ts (resolved, non-nullable).
|
|
21
21
|
*/
|
|
22
22
|
interface RawDeviceOrientation {
|
|
23
23
|
alpha: number | null;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { i as LatLongAlt, r as LatLong } from "./index-gzWJMVpo.js";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
|
|
4
|
+
//#region ../src/visualization/gps-anchor.d.ts
|
|
5
|
+
type GpsAnchorMode = 'snap-when-offscreen' | 'snap-every-tick';
|
|
6
|
+
type GpsAnchorPhase = 'bootstrap' | 'anchored';
|
|
7
|
+
/**
|
|
8
|
+
* The minimum shape needed for the bootstrap median — a `LatLong` with
|
|
9
|
+
* optional altitude. Re-exported as a named alias so the sidecar and
|
|
10
|
+
* tests can refer to "the kind of point the anchor samples" without
|
|
11
|
+
* importing core types.
|
|
12
|
+
*/
|
|
13
|
+
type GpsAnchorSamplePoint = LatLong | LatLongAlt;
|
|
14
|
+
interface GpsAnchorOptions {
|
|
15
|
+
readonly object3D: THREE.Object3D;
|
|
16
|
+
readonly arWorldGroup: THREE.Object3D;
|
|
17
|
+
readonly camera: THREE.Camera;
|
|
18
|
+
readonly gpsPoint: LatLong | LatLongAlt;
|
|
19
|
+
readonly skipBootstrap?: boolean;
|
|
20
|
+
readonly getAlignmentMatrix: () => readonly number[] | null;
|
|
21
|
+
readonly getGpsZeroRef: () => LatLong | null;
|
|
22
|
+
/** Returns the current GPS reading at "now", or null when no fix yet. */
|
|
23
|
+
readonly getCurrentGpsPoint: () => GpsAnchorSamplePoint | null;
|
|
24
|
+
readonly mode?: GpsAnchorMode;
|
|
25
|
+
readonly floorY?: () => number | null;
|
|
26
|
+
readonly distanceThreshold?: number;
|
|
27
|
+
readonly angleThresholdInDegrees?: number;
|
|
28
|
+
readonly targetPosRefreshRateInSec?: number;
|
|
29
|
+
/** Number of 1 Hz samples collected during bootstrap. Default 7. */
|
|
30
|
+
readonly secondsToAccumulateGpsPose?: number;
|
|
31
|
+
/** Wait window (seconds) at phase entry during which no samples are taken. Default 0. */
|
|
32
|
+
readonly settlingSeconds?: number;
|
|
33
|
+
readonly heightAboveGround?: number | null;
|
|
34
|
+
}
|
|
35
|
+
interface GpsAnchor {
|
|
36
|
+
readonly phase: GpsAnchorPhase;
|
|
37
|
+
readonly isFullyAnchored: boolean;
|
|
38
|
+
/** Current target GPS pose; during `bootstrap` this is the seed, post-bootstrap the median. */
|
|
39
|
+
readonly gpsPoint: LatLong | LatLongAlt;
|
|
40
|
+
markMovedExternally(): void;
|
|
41
|
+
setGpsPoint(point: LatLong | LatLongAlt): void;
|
|
42
|
+
dispose(): void;
|
|
43
|
+
/** @internal — testing seam; exposed in lieu of pumping `runFrameUpdates`. */
|
|
44
|
+
__tickForTests(dt: number, elapsed: number): void;
|
|
45
|
+
}
|
|
46
|
+
declare function createGpsAnchor(options: GpsAnchorOptions): GpsAnchor;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { GpsAnchorSamplePoint as a, GpsAnchorPhase as i, GpsAnchorMode as n, createGpsAnchor as o, GpsAnchorOptions as r, GpsAnchor as t };
|