Re: [csswg-drafts] [css-values] Re-adding min() and max()?

If you give two random angles, there are two possible arcs described. Unless the angles are diametrically opposite (in which case I guess the function would simply return `val` without clamping), there should be a big arc, and a small arc.

For instance, if you pass 0° and 90°, there are two arcs: one is 90° and the other 270°.

Thus, when clamping an angle, say you just passed as parameters 0deg for the `start`, 90deg for the `end` and 110° for the `val`. Surely you want the function to return 90°, even though 110° is within the greater arc.

This seems intuitive, and behaves just like the previous example, until you look at things like passing 270° and 0°. You still want to clamp to the the smaller arc of 90°, not the greater arc of 270°. Therefore, passing 110° as `val` would return 0°, since that is what is closest to being within the arc bounds (you only have to turn 110° to get to 0° as opposed to the 160° you'd need to get to 270°).

Things also get confusing when you start providing things like 3600° (or any value bigger than 360°, really), but the trivial solution is to just **mod** it to 360° which would make 3600° equal to 0°.

Alternatively there could be an `angleclamp()` function so that people aren't confused by special behavior (for instance `start: 2700°`, `end: 3600°`, `val: 10°` returns `0°` instead of `2700°` which might be what they are expecting with clamp)

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

Received on Tuesday, 15 August 2017 07:53:14 UTC