Skip to content

[css-transforms] Interpolation of 2D matrices #3709

@kevers-google

Description

@kevers-google

Interpolation of 2D matrices
(https://drafts.csswg.org/css-transforms/#interpolation-of-decomposed-2d-matrix-values)

The pseudo code for matrix interpolation contains the following:

// Don’t rotate the long way around.
if (!angleA)
angleA = 360
if (!angleB)
angleB = 360

if (abs(angleA - angleB) > 180)
...

Having conditions whose truth value depends on precise floating point tends to introduce sensitivity to small errors in numerical precision. In this case, however, it looks like the !angle checks are superfluous. Having an angle of 0 versus +/-1e-6 does not affect the interpolation path unless right at the 180 degree boundary. Rotating from 360 to 181 degrees, is equivalent to rotating from 0 to -179 degrees. These conditional angle tweaks from 0 to 360 should probably be removed from the spec.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions