Skip to content

feat(layers): math.gl path and polygon refinement (3/3) - #10837

Merged
ibgreen merged 19 commits into
masterfrom
codex/math-ring-subdivision
Nov 8, 2026
Merged

ibgreen merged 19 commits into
masterfrom
codex/math-ring-subdivision

Conversation

@ibgreen

@ibgreen ibgreen commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Follow up of #10835

Background

Source grids do not adapt to nonlinear projection curvature. This independent PR adds sampled map-space edge refinement while retaining existing grid cuts and separate polygon triangulation.

Change List

  • Add _projectionTolerance to paths and polygon layers
  • Densify paths and closed rings with math.gl subdividePolyline
  • Preserve holes, closure, altitude, and hidden cut-edge flags
  • Forward tolerance through PolygonLayer fill and outline sublayers
  • Rebuild all geometry when refinement configuration changes
  • Reject unsupported pre-tessellated buffers and per-vertex path styles
  • Documentation

Verified with yarn exec ocular-build layers and yarn lint. Passed 38 focused path/polygon headless tests. Local render checks timed out capturing screenshots on this update; prior CI passed.


Note

Medium Risk
Modifies geometry tessellation logic in core path and polygon layers, though the capability is experimental and disabled by default.

Overview
Adds an experimental _projectionTolerance prop to PathLayer, SolidPolygonLayer, and PolygonLayer to adaptively subdivide path edges and polygon rings when projecting across curved coordinate systems.

Tessellators use subdividePolyline from @math.gl/geometry to densify geometry down to a sampled map-meter error while preserving ring closure, holes, vertex elevations, and cut-edge visibility flags. Refinement requires normalized, CPU-accessible coordinates and validates that styling accessors (such as colors, widths, and elevations) are per-object rather than per-vertex.

Reviewed by Cursor Bugbot for commit 5b4e346. Bugbot is set up for automated code reviews on this repo. Configure here.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 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-10T12:04:42.996216Z d37e8e8 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d37e8e88a6

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@greptile-apps

greptile-apps Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues remain.

Summary

Adds experimental _projectionTolerance support to paths and polygon boundaries.

  • Path edges gain vertices where projected lines bend.
  • Polygon boundaries gain vertices where projections bend.

All eight supplied previous threads were checked against the current code and their replies. Their reported issues are addressed. None supplied a Comment number, so previousFindings is empty. No new actionable issues were found. This review checked source and tests; it did not run them.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Source paths or polygon rings] --> B[Normalize geometry]
  B --> C[Apply existing grid cuts]
  C --> D[Sample projected edge error in meters]
  D --> E[Insert source positions]
  E --> F[Project generated positions]
  F --> G[Build path segments or polygon triangles]
  G --> H[Render with per-object styling]
Loading

Reviews (14) · Last reviewed commit: "fix(layers): address projection refineme..." · Reviewed by Greptile

Comment thread docs/api-reference/layers/path-layer.md Resolved

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@ibgreen

ibgreen commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

Fixed the CI binary-data render regression in a7828ab. Even a no-op attribute transform forces binary attributes through CPU conversion; with refinement disabled, this converted float colors into the default unorm8 representation and made paths/polygons black. Styling transforms are now attached only while _projectionTolerance is enabled and removed when it is disabled.

Added four regression tests covering binary float color preservation and toggling refinement off for PathLayer and SolidPolygonLayer. All 36 focused headless tests, the binary-data WebGL render test, the layers build, and lint pass locally. The first render retry encountered a browser connection failure; the next run passed. CI is rerunning on the new commit.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@coveralls

coveralls commented Oct 10, 2026 •

Copy link
Copy Markdown

Coverage Status

No base build to compare — codex/math-ring-subdivision into master

@ibgreen
ibgreen requested a review from Pessimistress October 10, 2026 14:09
@ibgreen
ibgreen force-pushed the codex/math-ring-subdivision branch from 6bf78ef to b777c9c Compare November 5, 2026 17:20

ibgreen commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

Refreshed this branch by rebasing it independently onto current master (12496f0a9e). I preserved master’s CRS-aware wrapping, subdivision-step, model-matrix, and geocentric handling, and updated subdividePolyline to come from the current @math.gl/geometry package. The refreshed head is b777c9ca; CI is running.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

ibgreen commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator Author

Fixed the formatting issue from the previous CI run in test/modules/layers/custom-projection.spec.ts (f4b67bc), then merged current master (bf303a11) into this branch independently. The refreshed head is f272255, and CI is running.

Comment thread docs/whats-new.md Resolved

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 90b15a9. Configure here.

@chrisgervang chrisgervang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed f272255; comments only at this point. One P1: a reverted test import fails CI. With _projectionTolerance at 0, a node probe of 60 paths and polygons with holes, wrapLongitude and grid cuts gave buffers identical to master. The -2013 lines are the truncated docs/whats-new.md from the open greptile thread. That thread and the cursor thread on split outlines still hold.

Non-blocking: After the restore, the _projectionTolerance note in docs/whats-new.md would sit under ### Layer source CRS with no link. Could it move under ### Custom projections (Experimental) and read like this?

Paths and polygons can follow curved projected edges with the experimental _projectionTolerance prop.

Labels: P1 settle before this is merged, P2 can follow, Non-blocking optional.

@ibgreen
ibgreen merged commit 622fd9b into master Nov 8, 2026
7 checks passed
@ibgreen
ibgreen deleted the codex/math-ring-subdivision branch November 8, 2026 18:46
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.

3 participants