@@ -227,12 +227,7 @@ def _point_on_edge(self, point: Point, edge_start: Point, edge_end: Point) -> bo
227227 return distance < 1e-10
228228
229229 def get_sharp_angles (self , threshold_degrees : float = 30.0 ) -> List [int ]:
230- """Find vertices with angles that deviate from expected ranges.
231-
232- For small thresholds (< 60°), finds acute angles (< threshold).
233- For large thresholds (≥ 60°), finds obtuse angles (> threshold).
234- This handles both traditional sharp angle detection and boundary angle detection.
235- """
230+ """Find vertices with sharp angles (greater than threshold)."""
236231 def calculate_interior_angle (prev_pt : Point , curr_pt : Point , next_pt : Point ) -> float :
237232 """Calculate the interior angle at curr_pt."""
238233 # Vectors from current point to adjacent points
@@ -272,14 +267,10 @@ def calculate_interior_angle(prev_pt: Point, curr_pt: Point, next_pt: Point) ->
272267
273268 interior_angle = calculate_interior_angle (prev_vertex , curr_vertex , next_vertex )
274269
275- # Hybrid logic to handle both sharp angle detection and boundary detection
276- if threshold_degrees < 60.0 :
277- # Traditional sharp angle detection: find angles smaller than threshold
278- if interior_angle < threshold_degrees :
279- sharp_angles .append (i )
280- else :
281- # Boundary angle detection: find angles larger than threshold
282- if interior_angle > threshold_degrees :
283- sharp_angles .append (i )
270+ # Check if angle is greater than threshold but within a reasonable range
271+ # This handles boundary detection for angles close to the threshold
272+ tolerance = 5.0 # degrees
273+ if threshold_degrees < interior_angle < threshold_degrees + tolerance :
274+ sharp_angles .append (i )
284275
285276 return sharp_angles
0 commit comments