@@ -227,7 +227,12 @@ 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 sharp angles (less than threshold)."""
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+ """
231236 def calculate_interior_angle (prev_pt : Point , curr_pt : Point , next_pt : Point ) -> float :
232237 """Calculate the interior angle at curr_pt."""
233238 # Vectors from current point to adjacent points
@@ -267,8 +272,14 @@ def calculate_interior_angle(prev_pt: Point, curr_pt: Point, next_pt: Point) ->
267272
268273 interior_angle = calculate_interior_angle (prev_vertex , curr_vertex , next_vertex )
269274
270- # Check if angle is sharp (less than threshold)
271- if interior_angle < threshold_degrees :
272- sharp_angles .append (i )
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 )
273284
274285 return sharp_angles
0 commit comments