Re: [csswg-drafts] [css-shapes] Allow optional rounding parameter for `polygon()` (#9843)

It may be better to think in terms of clamping the position of the center of the circle. The center must always lie on the angle bisector of the corner, typically at a distance `d = r / sin(α/2)` from the corner, where `r` is the desired radius and `α` the angle of the corner.

However, we would clamp this distance by both midpoints of the sides, projected (perpendicularly to the sides) towards the angle bisector.

So if the sides have lengths `s₁` and `s₂`, the distance between the corner and the center of the circle should be `d' = min(d, s₁ / (2 cos(α/2)), s₂ / (2 cos(α/2)))`

And then the clamped radius is `r' = d' sin(α/2)`.

I'm not sure if that's the best approach (it might be too strict), but it should work.



-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9843#issuecomment-1918309953 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 31 January 2024 03:19:46 UTC