Skip to content

Build and prove the 2D World->image rendering path #896

@tigercosmos

Description

@tigercosmos

Build and prove the 2D World->image rendering path

Related to #754.

Intention

Make modmesh's 2D drawing API produce a deterministic image of a World that both the live pilot widget and an offscreen renderer share. This is the foundation for the AI-friendly drawing work: the corpus images an AI model reasons about must be the same pixels a user sees, by construction.

Today R2DWidget renders a World only inside paintEvent (private paintWorld, coupled to widget state). There is no shared render routine, no offscreen QImage path, and no pixel-level test. This milestone closes those gaps and adds the overlay and text representations the experiment's input arms need (A2 overlay, A3 basic state, A4 state+diagnostics; A1 is the raw rendered image).

The work is split into small PRs (each < 500 LOC). PR3 is the gate: nothing downstream is trusted until a known World renders to expected pixels.

PR list

  • PR1 - Extract shared paint(QPainter&, World&, view) routine. Move the body of R2DWidget::paintWorld into a free function with explicit arguments. Pure refactor, pixels unchanged, existing tests stay green. pilot: Extract world render logic into RWorldRenderer2d (issue #754 PR1) #899
  • PR2 - Offscreen QImage renderer + Python binding. Render a World to a QImage via the PR1 routine with no event loop, and expose a 2D image capture binding (the current capture is R3DWidget-only). Antialiasing toggle for deterministic corpus images. pilot: Add offscreen 2D world renderer and Python binding (issue #754 PR2) #900
  • PR3 - Real pixel test (gate). Replace the misleading skipped test at tests/test_pilot.py:47. Build a known World, render via PR2, assert non-blank pixels and that known endpoints map to expected pixels under the view transform.
  • PR4 - Non-diagnostic annotation overlay (arm A2). Toggleable overlay: shape ids, axis labels, world-coordinate ticks, per-shape bbox, highlight-by-id. Legibility only - no derived facts.
  • PR5 - World.describe_state(level="basic") (arm A3). Serialize shapes and control points to structured text - only what is also visible in the image, just as text. Add World::describe_state for visible 2D geometry #902
  • PR6 - describe_state(level="+diagnostics") (arm A4). PR5 plus derived facts: intersections (reusing the polygon_boolean sweep-line) and degeneracies. The "oracle-ish" arm, kept separate so its advantage is attributable to information, not legibility.

Metadata

Metadata

Assignees

Labels

pilotGUI and visualization
No fields configured for Feature.

Projects

Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions