Skip to content

wip: explore face-centric vector network region model#645

Draft
softmarshmallow wants to merge 1 commit intomainfrom
wg/vector-network-face-model
Draft

wip: explore face-centric vector network region model#645
softmarshmallow wants to merge 1 commit intomainfrom
wg/vector-network-face-model

Conversation

@softmarshmallow
Copy link
Copy Markdown
Member

Summary

Exploratory PoC investigating a face-centric model for VectorNetworkRegion where fill_rule: FillRule is replaced by fill_mask: u64 — each loop owns one face, a bitmask marks which faces are filled, and fill rules become a codec at the import/export boundary.

  • fill_mask_poc.rs — isolated test file with the proposed model, nesting tree computation, fill-rule encode/decode codec, and Skia rendering
  • Rendered comparison PNGs — visual proof across 6 concentric-ring scenarios and 6 complex scenarios

Key findings

Scenario fill_rule (current) fill_mask (proposed) faces (ideal)
Concentric rings (simple) ✓ (some patterns need multi-region workaround) ✓ all patterns
Open + closed paths
Shared edges / T-junctions
Self-intersecting (Z, pentagram) ⚠ ambiguous ✗ (1 loop = 1 face) ✓ (needs planarization)
Overlapping circles ✗ double-paints ✗ nesting tree wrong ✓ (needs planarization)

Rendered outputs

fill_mask model (proposed) — concentric rings:
fill_mask

Current model — same scenarios (3 WRONG):
current

Current model — workaround with multi-region decomposition:
workaround

Complex scenarios — stress testing model boundaries:
complex

Design direction

The exploration points toward a face-centric model where:

  1. fill_rule is removed from the core struct (becomes SVG/Figma import/export codec)
  2. Faces are first-class entities alongside vertices and segments
  3. Auto-planarization on draw handles self-intersections
  4. Paint bucket maps directly to face.fills = paint (no decomposition puzzle)

Test plan

  • cargo test -p cg --test fill_mask_poc — 10 tests pass (7 unit + 3 visual render)

🤖 Generated with Claude Code

Adds an isolated test file exploring a fill_mask: u64 model that replaces
fill_rule: FillRule on VectorNetworkRegion. Each loop owns one face, and
a bitmask marks which faces are filled. Fill rules become a codec at the
import/export boundary.

Includes rendered comparison PNGs demonstrating:
- fill_mask vs current model for concentric ring scenarios
- Complex scenarios (open paths, shared edges, T-junctions,
  self-intersecting Z-shapes, pentagrams, overlapping circles)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Apr 8, 2026 10:27am
6 Skipped Deployments
Project Deployment Actions Updated (UTC)
code Ignored Ignored Apr 8, 2026 10:27am
legacy Ignored Ignored Apr 8, 2026 10:27am
backgrounds Skipped Skipped Apr 8, 2026 10:27am
blog Skipped Skipped Apr 8, 2026 10:27am
grida Skipped Skipped Apr 8, 2026 10:27am
viewer Skipped Skipped Apr 8, 2026 10:27am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 8, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 299f15d5-5fe0-44a7-ba17-45b6e0836bd7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wg/vector-network-face-model

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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