Skip to content

Handle zero-angle spans in triangle extraction#682

Draft
Copilot wants to merge 3 commits into
developfrom
copilot/fix-triangle-rendering-zero-angle
Draft

Handle zero-angle spans in triangle extraction#682
Copilot wants to merge 3 commits into
developfrom
copilot/fix-triangle-rendering-zero-angle

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

  • Inspect the old triangle extraction code path relevant to the PR comment
  • Identify the exact old addTriangle gate that failed with zero reference angles
  • Reply on the PR with the concrete condition and why it evaluated false

Copilot AI and others added 3 commits May 21, 2026 17:19
@chrxh
Copy link
Copy Markdown
Owner

chrxh commented May 21, 2026

@copilot explain why zero reference angles lead to invisible triangles in the old code. the triangle should still be emmitted

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot explain why zero reference angles lead to invisible triangles in the old code. the triangle should still be emmitted

Im alten Code ist das Dreieck nicht am RenderStep gescheitert, sondern schon vorher in cudaExtractTriangleIndices. Die Face-Erkennung hat rein über die Referenzreihenfolge gearbeitet und stillschweigend angenommen, dass jedes benachbarte Verbindungspaar auch einen echten Winkelspan aufspannt. Bei angleFromPrevious == 0 stimmt das nicht mehr: dann kann prevIndex auf eine Verbindung zeigen, die in derselben Richtung liegt wie die aktuelle, und die Rückprüfung auf den Nachbarzellen (prevBackIndex - 1 bzw. backIndex + 1 im alten Stand) schaut auf den falschen Slot. Dadurch schlägt die Bedingung für addTriangle(...) fehl und das Dreieck wird gar nicht erst emittiert, obwohl es geometrisch sichtbar wäre. Kurz: unsichtbar war es nicht wegen Rasterization, sondern weil der alte Extraktor das Face wegen des Zero-Span nicht erkannt hat.

Copilot finished work on behalf of chrxh May 21, 2026 16:12
Copilot AI requested a review from chrxh May 21, 2026 16:12
@chrxh
Copy link
Copy Markdown
Owner

chrxh commented May 21, 2026

@copilot which exact condition was failing in the old code for addTriangle? State the code and explain why

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot which exact condition was failing in the old code for addTriangle? State the code and explain why

The exact gate was:

if (prevConnectedObject->getConnectedObject(prevBackIndex - 1) == connectedObject) {
    if (object->id < connectedObject->id && object->id < prevConnectedObject->id) {
        addTriangle(object, object->tempValue1.as_uint64, prevConnectedObject, connectedObject);
    }
}

The failing part was the outer equality check. In the old code, prevBackIndex - 1 meant “the connection immediately before object in prevConnectedObject’s stored reference-angle order”. That only works if every step in that order represents a real non-zero span. When one stored angleFromPrevious was 0, that predecessor slot could be another connection sitting in the same collapsed angular position instead of the actual face neighbor connectedObject. Then prevConnectedObject->getConnectedObject(prevBackIndex - 1) != connectedObject, the if evaluated false, and addTriangle(...) was never reached even though the visible triangle still existed geometrically.

Copilot finished work on behalf of chrxh May 21, 2026 16:17
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.

2 participants