Transform Function Order Matters Note

Compare geometric translate-then-rotate vs rotate-then-translate about origin, input radians and common units; CSS transform-list composition acts rightmost first. Explicit supplied computed/layout context only; not a browser cascade/layout engine or cross-browser guarantee.

Description

Rotation and translation generally do not commute.

Rotation and translation generally do not commute.1

Comparing both mathematical sequences explains why changing transform order can change the final position. Use Transform Function Order Matters Note to evaluate the supplied inputs under the specific model below.

When to use Transform Function Order Matters Note

Use Transform Function Order Matters Note to evaluate the supplied inputs under the specific model below. Define the supplied layout, token or rendering scenario and establish the relevant units and browser context independently.

How to use Transform Function Order Matters Note and understand its results

  1. Define the supplied layout, token or rendering scenario and establish the relevant units and browser context independently.
  2. Enter Point x, Point y, Translate x, Translate y, Rotation radians using the field table and validation rules below, then run the tool.
  3. Read Translate then rotate point, Rotate then translate point and interpret units, signs, ordering and placeholders as explained below.
  4. If the tool reports an input error, correct that field and rerun. A successful false result, empty match list or unknown-evidence placeholder has the specific meaning described here; check the limitations before applying the result.
Input fieldMeaningValue typeRequirement
pointXPoint xnumberRequired; constraints below
pointYPoint ynumberRequired; constraints below
translateXTranslate xnumberRequired; constraints below
translateYTranslate ynumberRequired; constraints below
rotationRadiansRotation radiansnumberRequired; constraints below

Enter a finite planar point, translation and angle in radians. Compute both rotation of the translated point and translation of the rotated point with the ordinary 2D rotation matrix. These two outputs demonstrate noncommuting operations; map the mathematical operation order to the transform-list convention independently.

rotateAfterTranslate = R(θ)×(point+translation); translateAfterRotate = R(θ)×point+translation

Field order, units and branch conditions follow the implementation explanation above.

Output fieldMeaningValue type
translateThenRotatePointTranslate then rotate pointarray of number
rotateThenTranslatePointRotate then translate pointarray of number
json
{
  "input": {
    "pointX": 1,
    "pointY": 0,
    "translateX": 10,
    "translateY": 0,
    "rotationRadians": 1.5707963267948966
  },
  "output": {
    "translateThenRotatePoint": [
      6.735557395310443e-16,
      11
    ],
    "rotateThenTranslatePoint": [
      10,
      1
    ]
  }
}

Limitations and assumptions

Comparing both mathematical sequences explains why changing transform order can change the final position. Apply the exact scope and assumptions described above.

All listed fields require explicit values. Unexpected fields, incorrect types, nonfinite numbers and sparse arrays fail validation. Domain-specific bounds, alignments and supported tokens are stated above; extremely large inputs or outputs can also be rejected. These errors differ from successful results such as false, no matches or unknown evidence.

Alternative or Complementary methods

Use aspect-ratio Property vs Padding-Hack Note for a related task: Aspect-ratio sizing and percentage-padding techniques can use different width bases.

Use Rotate Origin Offset Effect Note for a related task: Rotation about an offset origin first expresses the point relative to that origin.

References

  1. Transform Function Order Matters Note — tool.io

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies