Skip to content

fix(cloud): spurious overlapping side-wall polygons on cloud shape #2

Description

@Mandalorian-Wang

Bug

The RenderIsoCloud function renders multiple overlapping data-face="side" polygons on the cloud node. In the test case the LLM node produced 8 side polygons all drawn at the same screen position with identical fill colour — no visual value, pure noise.

Root cause

The camera-facing visibility test (ny > 0) is applied per-edge on the complex 4-circle cloud outline. Because the outline has bumps with arcs that curve downward at multiple locations, the test finds several disconnected "visible" runs instead of the single contiguous lower silhouette. Each run is rendered as an independent polygon, all overlapping.

Fix (local commit 78558af on claude/adoring-feynman-6cklb1)

After collecting all visible runs, keep only the longest one — that is always the true lower silhouette. Discard the rest.

// Keep only the longest run — the true lower silhouette.
if len(runs) > 1 {
    best := 0
    for i, r := range runs {
        if len(r.idx) > len(runs[best].idx) {
            best = i
        }
    }
    runs = runs[best : best+1]
}

Side polygon count drops from 8 → 1. Golden file updated, all tests pass.

Reproduction

Any cloud node with non-trivial height (h > 10) will exhibit this — visible in data-face="side" count inside the rendered SVG fragment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions