Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edge renderer: Add a switch to remove degeneratd triangles #10315

Merged
merged 1 commit into from May 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/Rendering/edgesRenderer.ts
Expand Up @@ -169,6 +169,12 @@ export interface IEdgesRendererOptions {
* This option is used only if useAlternateEdgeFinder = true
*/
epsilonVertexAligned?: number;

/**
* Gets or sets a boolean indicating that degenerated triangles should not be processed.
* Degenerated triangles are triangles that have 2 or 3 vertices with the same coordinates
*/
removeDegeneratedTriangles?: boolean;
}

/**
Expand Down Expand Up @@ -659,7 +665,7 @@ export class EdgesRenderer implements IEdgesRenderer {
let p1Index = remapVertexIndices[indices[index + (i + 1) % 3]];
let p2Index = remapVertexIndices[indices[index + (i + 2) % 3]];

if (p0Index === p1Index) { continue; }
if (p0Index === p1Index || (p0Index === p2Index || p1Index === p2Index) && this._options?.removeDegeneratedTriangles) { continue; }

TmpVectors.Vector3[0].copyFromFloats(positions[p0Index * 3 + 0], positions[p0Index * 3 + 1], positions[p0Index * 3 + 2]);
TmpVectors.Vector3[1].copyFromFloats(positions[p1Index * 3 + 0], positions[p1Index * 3 + 1], positions[p1Index * 3 + 2]);
Expand Down