Skip to content

feat(polygon): refine projected polygon and bitmap meshes with UV provenance - #167

Merged
ibgreen merged 1 commit into
masterfrom
codex/projected-triangle-mesh-subdivision
Oct 3, 2026
Merged

ibgreen merged 1 commit into
masterfrom
codex/projected-triangle-mesh-subdivision

Conversation

@ibgreen

@ibgreen ibgreen commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Subdividing a polygon outline does not deform its filled triangles, and projecting the four corners of a bitmap leaves its interior represented by two flat triangles. Add subdivideTriangleMesh to refine indexed source geometry through a supplied coordinate transform, including both boundary and interior deformation.

Based on master. #166 has merged; this PR is rebased onto master and contains only the triangle-mesh refinement follow-up.

Behavior and API

  • Accept flat XY/XYZ positions and triangle indices with a deterministic transform and a tolerance in target units. Polygon rings and holes can be triangulated with earcut first; existing indexed loader meshes can be passed directly.
  • Probe quarter/midpoint edge positions plus the centroid and three interior barycentric positions. A failing face splits its three edges; neighboring faces use matching splits to preserve conformity without creating T-junctions.
  • Share inserted vertices by indexed edge and preserve source winding. Coincident vertices at UV/attribute seams stay independent.
  • Return source and transformed Float64 coordinate buffers, refined indices, original face attribution, and three original-vertex indices/weights per output vertex. These weights reconstruct UVs, heights, colors, and other linearly interpolated attributes.
  • Bound global refinement passes, vertices, and triangles; reject invalid transform samples and exhausted budgets without returning partial output. Input storage remains untouched; no dependencies are added.
  • Add API documentation, polygon-hole and bitmap-UV examples, sidebar wiring, release notes, and a cross-link from the polyline utility.

Design limits

The error criterion is sampled, not a guaranteed bound for arbitrary transforms. Source interpolation is linear and uses the source mesh's piecewise affine attribute mapping; it does not choose geodesic semantics. Input topology must already be conforming. Callers own triangulation, domain clipping, seam splitting, camera-based tolerance selection, and GPU resources. A transform can reverse or fold target geometry; this utility does not repair that topology. Normals and categorical attributes require their own policies.

Validation

  • yarn build — passed for the repository, including package/declaration output.
  • yarn lint — passed.
  • Polygon Node suite — 8 files, 127 tests passed; eight new mesh cases cover affine behavior, interior-only deformation, dense surface error checks, polygon holes, UV reconstruction, source face attribution, attribute seams, one/two-edge conformity templates across rotations, source XYZ altitude, invalid inputs/domains, and resource exhaustion.
  • Strict standalone TypeScript check — passed.
  • Browser/headless suites and website production build were not run.

Supports the shared geometry boundary discussed for the deck.gl custom projection series. deck.gl adoption remains a separate change.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T14:48:44.927884Z 29c277a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coveralls

coveralls commented Oct 2, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 37127200348

Coverage increased (+0.05%) to 92.761%

Details

  • Coverage increased (+0.05%) from the base build.
  • Patch coverage: 1 uncovered change across 1 file (116 of 117 lines covered, 99.15%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
modules/polygon/src/subdivide-triangle-mesh.ts 117 116 99.15%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 15549
Covered Lines: 14827
Line Coverage: 95.36%
Relevant Branches: 8528
Covered Branches: 7507
Branch Coverage: 88.03%
Branches in Coverage %: Yes
Coverage Strength: 12175.23 hits per line

💛 - Coveralls

Base automatically changed from codex/projected-polyline-subdivision to master October 3, 2026 13:43
@ibgreen
ibgreen force-pushed the codex/projected-triangle-mesh-subdivision branch from 29c277a to f525d32 Compare October 3, 2026 13:44
@ibgreen
ibgreen merged commit 6ff11ce into master Oct 3, 2026
7 checks passed
@ibgreen
ibgreen deleted the codex/projected-triangle-mesh-subdivision branch October 3, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants