-
Notifications
You must be signed in to change notification settings - Fork 7
Description
For Rounded polygons, if the rounding radii of two adjacent corners are exactly equal to half the polygon’s side length usually it is successful — both corners get rounded. But occasionally some of the corners don’t get rounded. It looks like there's a numerical precision issue when two Rounded corners exactly collide (e.g. radius is approx equal to the side length available on the second rounding for 90 degree corners).
import Unitful: nm, μm, mm
r = Rectangle(1.0μm, 1.0μm)
rr = Polygons._round_poly(r, 500.0nm; corner_indices=[2, 4])
rrr = Polygons._round_poly(rr, 500.0nm; corner_indices=[1])
This can be "fixed" simply by:
rrr = Polygons._round_poly(rr, 500.0nm; corner_indices=[1], min_side_len=499.99999nm)
which suggests a numerical precision issue.
There's an issue that might be related where we sometimes see points very close to one another on adjacent rounded curves. On the other hand that might just be our discretization not taking into account how close the endpoint is.
Might be solvable by just making the min_side_length
comparison approximate, but I worry we could end up with tiny inverted slivers. (Although maybe not with GDS rounding to integers, and for the equivalent issue with CurvilinearPolygon rendering to SolidModel we should be collapsing points within tolerance.)