Re: [csswg-drafts] [css-borders-4] Specify how borders are rendered for `corner-shape` (#11610)

@smfr I looked at the bevel formula and generalized it to any superellipse, by using the approximate tangent.
It basically works like a bevel, where the line goes to the control point of the arc equivalent to the superellipse (have the same value at t=0.5).

It looks something like this:
```
  // a and b are the coordinates for the contol point of the approximate arc
  a = 1 / (2 ^ (1/k));
  b = 1 - a;
  slope = a / b;
  magnitude = Math.hypot(a, b);
  norm_a = a / magnitude;
  norm_b = b / magnitude;

  // This compute the intercept of a line parallel to the tangent, at distance (1)
  outer_offset = norm_b + slope * (norm_a - 1);

  // outer_offset can now be multiplied by the stroke width to compute the join size (actual outer offset)
```

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


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

Received on Tuesday, 25 February 2025 15:18:41 UTC