Skip to content

feat(viewer): display COMPAS Polygon and Arc - #36

Open
ericgozzi wants to merge 1 commit into
mainfrom
feature/polygon-arc-display
Open

ericgozzi wants to merge 1 commit into
mainfrom
feature/polygon-arc-display

Conversation

@ericgozzi

Copy link
Copy Markdown
Collaborator

Summary

Renders COMPAS Polygon and Arc, both previously listed as "deferred" in the support matrix.

  • Polygon: a filled face triangulated with three.js's earcut in the polygon's own plane (found with Newell's method), so concave polygons fill correctly, plus its outline as a child LineLoop. A horizontal polygon's face always points up, whichever way its points run. A closing point repeating the first is dropped.
  • Arc: a line sampled between its start and end angles in its circle's frame.
  • docs/support-matrix.md moves both to "Included".

Note: @gramaziokohler/compas-pb-ts 2.0.0 rejects an Arc whose startAngle or endAngle is exactly 0 (a falsy check in its constructor, also on decode), so such arcs never reach the viewer. Worth fixing upstream; the tests use non-zero angles.

Test plan

  • New tests in tests/converter.test.ts: a concave L-shaped polygon (6 vertices, 4 triangles, area 3, normal up) and a quarter arc (all samples on the circle, correct end points).
  • prettier, lint, typecheck, test, build:app, build:library pass.

🤖 Generated with Claude Code

Polygon renders as a filled face triangulated in its own plane (so
concave shapes fill correctly), facing up when horizontal, with its
outline. Arc renders as a line sampled between its start and end angles.
Both move from "deferred" to "included" in the support matrix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant