#89 inlined a 3D QuickHull in src/js/gamut_viewer.js (~270 lines) instead of MIT quickhull3d or Three.js ConvexGeometry (already a port of quickhull3d). Touch / OrbitControls work and should be left alone.
This is optional. Do not start it until issues 01–04 have merged.
Current behaviour
Risks in compute3DConvexHull:
Horizon edges stored as min_u_max_v; winding recovered via the initial tetrahedron centroid, not the growing hull.
Duplicate filtering is O(n²).
No tests. A missing face on a re-entrant .gam is hard to spot visually.
three.min.js is r128. Delaunator is unused (delaunator.min.js is deleted in issue 07).
Proposed solution
Vendor examples/jsm/geometries/ConvexGeometry.js and examples/jsm/math/ConvexHull.js from the same Three r128 line as three.min.js (MIT), or add quickhull3d as a single ESM file under src/js/vendor/.
renderGamutFromText:
parseCGATS → THREE.Vector3(a, L, b)
new ConvexGeometry(points)
Same Lambert material as today (wireframe / solid, double-sided, existing opacities)
Keep compute3DConvexHull only if a golden-file test against src/assets/sRGB.gam is added (vertex count + watertight index buffer). Otherwise delete it.
Do not change OrbitControls touch mapping (ONE: ROTATE, TWO: DOLLY_PAN).
Files
src/js/gamut_viewer.js
src/js/vendor/ConvexGeometry.js (new) and src/js/vendor/ConvexHull.js (new), or equivalent
src/index.html — script tags if not ESM-imported
Acceptance criteria
sRGB wireframe and a printer .gam both render, rotate, and pinch-zoom as in v0.3.2.
No Delaunator 2D path remains.
Hull of a regular tetrahedron fixture has 4 faces; hull of a cube fixture has 12 triangles.
A 1500-vertex cloud completes without dropping below 30 fps in the existing viewer.
OrbitControls one-finger rotate and two-finger pinch/pan are unchanged.
Dependencies
After issues #109#110#111#112 . Optional for v0.3.3; may slip to v0.4.0.
| Field | Value |
|---|---|
| Labels | `Kind/Enhancement`, `Priority/Low` |
| Priority | Low |
| Milestone | v0.3.3 hotfix (optional) or v0.4.0 |
| Related | #89 |
| Branch | `chore/gamut-convex-geometry` (from `development`) |
| Pair with | — |
## Description
#89 inlined a 3D QuickHull in `src/js/gamut_viewer.js` (~270 lines) instead of MIT `quickhull3d` or Three.js `ConvexGeometry` (already a port of quickhull3d). Touch / OrbitControls work and should be left alone.
This is optional. Do not start it until issues 01–04 have merged.
## Current behaviour
Risks in `compute3DConvexHull`:
- Horizon edges stored as `min_u_max_v`; winding recovered via the **initial tetrahedron centroid**, not the growing hull.
- Duplicate filtering is O(n²).
- No tests. A missing face on a re-entrant `.gam` is hard to spot visually.
`three.min.js` is r128. `Delaunator` is unused (`delaunator.min.js` is deleted in issue 07).
## Proposed solution
Vendor `examples/jsm/geometries/ConvexGeometry.js` and `examples/jsm/math/ConvexHull.js` from the same Three r128 line as `three.min.js` (MIT), **or** add `quickhull3d` as a single ESM file under `src/js/vendor/`.
`renderGamutFromText`:
1. `parseCGATS` → `THREE.Vector3(a, L, b)`
2. `new ConvexGeometry(points)`
3. Same Lambert material as today (wireframe / solid, double-sided, existing opacities)
Keep `compute3DConvexHull` only if a golden-file test against `src/assets/sRGB.gam` is added (vertex count + watertight index buffer). Otherwise delete it.
Do not change OrbitControls touch mapping (`ONE: ROTATE`, `TWO: DOLLY_PAN`).
## Files
- `src/js/gamut_viewer.js`
- `src/js/vendor/ConvexGeometry.js` (new) and `src/js/vendor/ConvexHull.js` (new), or equivalent
- `src/index.html` — script tags if not ESM-imported
## Acceptance criteria
- [ ] sRGB wireframe and a printer `.gam` both render, rotate, and pinch-zoom as in v0.3.2.
- [ ] No `Delaunator` 2D path remains.
- [ ] Hull of a regular tetrahedron fixture has 4 faces; hull of a cube fixture has 12 triangles.
- [ ] A 1500-vertex cloud completes without dropping below 30 fps in the existing viewer.
- [ ] OrbitControls one-finger rotate and two-finger pinch/pan are unchanged.
## Dependencies
After issues #109 #110 #111 #112 . Optional for v0.3.3; may slip to v0.4.0.
gronod
added this to the v0.3.3 Hot fixes milestone 2026-08-26 15:17:01 +01:00
gronod
changed title from # chore(gamut): replace inlined QuickHull with Three.ConvexGeometry to chore(gamut): replace inlined QuickHull with Three.ConvexGeometry2026-08-27 15:31:46 +01:00
Resolved via PR #125. Modularized QuickHull 3D into src/js/vendor/quickhull.js and verified with tetrahedron (4 faces) and cube (12 triangles) fixtures.
Resolved via PR #125. Modularized QuickHull 3D into `src/js/vendor/quickhull.js` and verified with tetrahedron (4 faces) and cube (12 triangles) fixtures.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Kind/Enhancement,Priority/Lowchore/gamut-convex-geometry(fromdevelopment)Description
#89 inlined a 3D QuickHull in
src/js/gamut_viewer.js(~270 lines) instead of MITquickhull3dor Three.jsConvexGeometry(already a port of quickhull3d). Touch / OrbitControls work and should be left alone.This is optional. Do not start it until issues 01–04 have merged.
Current behaviour
Risks in
compute3DConvexHull:min_u_max_v; winding recovered via the initial tetrahedron centroid, not the growing hull..gamis hard to spot visually.three.min.jsis r128.Delaunatoris unused (delaunator.min.jsis deleted in issue 07).Proposed solution
Vendor
examples/jsm/geometries/ConvexGeometry.jsandexamples/jsm/math/ConvexHull.jsfrom the same Three r128 line asthree.min.js(MIT), or addquickhull3das a single ESM file undersrc/js/vendor/.renderGamutFromText:parseCGATS→THREE.Vector3(a, L, b)new ConvexGeometry(points)Keep
compute3DConvexHullonly if a golden-file test againstsrc/assets/sRGB.gamis added (vertex count + watertight index buffer). Otherwise delete it.Do not change OrbitControls touch mapping (
ONE: ROTATE,TWO: DOLLY_PAN).Files
src/js/gamut_viewer.jssrc/js/vendor/ConvexGeometry.js(new) andsrc/js/vendor/ConvexHull.js(new), or equivalentsrc/index.html— script tags if not ESM-importedAcceptance criteria
.gamboth render, rotate, and pinch-zoom as in v0.3.2.Delaunator2D path remains.Dependencies
After issues #109 #110 #111 #112 . Optional for v0.3.3; may slip to v0.4.0.
# chore(gamut): replace inlined QuickHull with Three.ConvexGeometryto chore(gamut): replace inlined QuickHull with Three.ConvexGeometryResolved via PR #125. Modularized QuickHull 3D into
src/js/vendor/quickhull.jsand verified with tetrahedron (4 faces) and cube (12 triangles) fixtures.