Skip to content

Commit 8d02434

Browse files
committed
[css-color-5] Adjustments to edge cases and set notation for hue interpolation types.
This makes a few adjustments to the definitions of hue interpolation types to follow up on the discussions in w3c#4735. First, it adjusts the pseudo-code so that for 'shorter' and 'longer', angles that differ by 180 degrees will always go in the decreasing direction, as described in w3c#4735 (comment) Second, it adjusts the set notation to match the pseudo-code. (They were not matching even prior to this change.) The set notation previously seemed to assume that there were absolute-value functions present that were not actually there. However, given the asymmetry of always going in the decreasing direction, it's more correct to write it without absolute values.
1 parent b6368ad commit 8d02434

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

css-color-5/Overview.bs

+6-6
Original file line numberDiff line numberDiff line change
@@ -752,20 +752,20 @@ Unless the type of hue interpolation is ''specified'', both angles need to be co
752752
One way to do this is <code><i>θ</i> = ((<i>θ</i> % 360) + 360) % 360</code>.
753753

754754
: ''shorter''
755-
:: Angles are adjusted so that θ₂ - θ₁ ∈ [0, 180). In pseudo-Javascript:
755+
:: Angles are adjusted so that θ₂ - θ₁ ∈ [-180, 180). In pseudo-Javascript:
756756
<pre>
757757
if (θ₂ - θ₁ >= 180) {
758758
θ₁ += 360;
759759
}
760-
else if (θ₂ - θ₁ <= -180) {
760+
else if (θ₂ - θ₁ < -180) {
761761
θ₂ += 360;
762762
}
763763
</pre>
764764

765765
: ''longer''
766-
:: Angles are adjusted so that θ₂ - θ₁ ∈ [180, 360). In pseudo-Javascript:
766+
:: Angles are adjusted so that θ₂ - θ₁ ∈ {(-360, -180], 0, (180, 360)}. In pseudo-Javascript:
767767
<pre>
768-
if (0 < θ₂ - θ₁ < 180) {
768+
if (0 < θ₂ - θ₁ <= 180) {
769769
θ₁ += 360;
770770
}
771771
else if (-180 < θ₂ - θ₁ < 0) {
@@ -774,15 +774,15 @@ One way to do this is <code><i>θ</i> = ((<i>θ</i> % 360) + 360) % 360</code>.
774774
</pre>
775775

776776
: ''increasing''
777-
:: Angles are adjusted so that θ₂ - θ₁ ∈ [0, 360) and θ₁ ≤ θ₂. In pseudo-Javascript:
777+
:: Angles are adjusted so that θ₂ - θ₁ ∈ [0, 360). In pseudo-Javascript:
778778
<pre>
779779
if (θ₂ < θ₁) {
780780
θ₂ += 360;
781781
}
782782
</pre>
783783

784784
: ''decreasing''
785-
:: Angles are adjusted so that θ₂ - θ₁ ∈ [0, 360) and θ₁ ≥ θ₂. In pseudo-Javascript:
785+
:: Angles are adjusted so that θ₂ - θ₁ ∈ (-360, 0]. In pseudo-Javascript:
786786
<pre>
787787
if (θ₁ < θ₂) {
788788
θ₁ += 360;

0 commit comments

Comments
 (0)