Relax threshold angle to avoid false positive corner detection in STL file #2946
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Greptile Overview
Updated On: 2025-10-30 23:56:51 UTC
Greptile Summary
This PR increases the default
angle_thresholdinCornerFinderSpecfrom 0.1π to 0.25π (π/4) to reduce false positive corner detection when processing STL files.Key changes:
CORNER_ANGLE_THRESOLDconstant from0.1 * np.pito0.25 * np.piintidy3d/components/grid/corner_finder.py:18angle_thresholdinCornerFinderSpecnow defaults to pi/4Technical context:
The angle threshold determines when a vertex qualifies as a corner. A vertex is considered a corner if the angle spanned by its two edges is larger than π minus the threshold value. The previous threshold of 0.1π (18°) was too sensitive, causing false positives when detecting corners in STL files. The new threshold of 0.25π (45°) is more conservative and will only detect vertices as corners when the angle deviation from straight is more pronounced.
Confidence Score: 5/5
Important Files Changed
File Analysis
Sequence Diagram
sequenceDiagram participant User participant CornerFinderSpec participant LayerRefinementSpec participant GridSpec participant Simulation User->>CornerFinderSpec: Create with default angle_threshold Note over CornerFinderSpec: angle_threshold = 0.25π (NEW)<br/>previously 0.1π User->>LayerRefinementSpec: Configure with corner_finder LayerRefinementSpec->>CornerFinderSpec: Use corner detection User->>Simulation: Create with layer_refinement_specs Simulation->>GridSpec: Generate grid with layer specs GridSpec->>LayerRefinementSpec: Apply layer refinement LayerRefinementSpec->>CornerFinderSpec: Find corners on 2D plane CornerFinderSpec->>CornerFinderSpec: _filter_collinear_vertices() Note over CornerFinderSpec: Filter vertices where<br/>angle <= π - angle_threshold<br/>(now π - 0.25π = 0.75π) CornerFinderSpec-->>LayerRefinementSpec: Return corner coordinates LayerRefinementSpec-->>GridSpec: Apply corner-based refinement GridSpec-->>Simulation: Generate refined grid