Skip to main content

2D reflection matrices and line y+x=0

Short answer

Reflection about x-axis: [1 0 0; 0 −1 0; 0 0 1]; y-axis: [−1 0 0; 0 1 0; 0 0 1]; origin: [−1 0 0; 0 −1 0; 0 0 1]. For line y = −x, rotate by −135°, reflect about x-axis, rotate back by 135° gives matrix [0 −1 0; −1 0 0; 0 0 1], mapping (x,y) to (−y, −x).

Write the matrices for 2D reflection about the axes. Derive the transformation matrix responsible for the reflection of a 2D object about the line y + x = 0.

Reflection matrices (2D, homogeneous)

About the x-axis (y → −y):     | 1  0 0 |
                               | 0 −1 0 |
                               | 0  0 1 |

About the y-axis (x → −x):     | −1 0 0 |
                               |  0 1 0 |
                               |  0 0 1 |

About the origin (x,y → −x,−y): | −1  0 0 |
                                |  0 −1 0 |
                                |  0  0 1 |

Reflection about the line y + x = 0 (that is y = −x)

This line passes through the origin with slope −1, so it makes the angle θ = 135° (or −45°) with the x-axis.

Steps

  1. Rotate by −θ = −135° so that the line coincides with the x-axis: R(−135°).
  2. Reflect about the x-axis: Ref_x.
  3. Rotate back by +135°: R(135°).

M = R(135°) · Ref_x · R(−135°)

cos135° = −0.7071,  sin135° = 0.7071

R(−135°) = | cos135°   sin135° | = | −0.7071  0.7071 |
           | −sin135°  cos135° |   | −0.7071 −0.7071 |

Ref_x · R(−135°) = | −0.7071   0.7071 |
                   |  0.7071   0.7071 |

R(135°) = | −0.7071  −0.7071 |
          |  0.7071  −0.7071 |

M = R(135°) · [Ref_x · R(−135°)]
  = | (−0.7071)(−0.7071)+(−0.7071)(0.7071)   (−0.7071)(0.7071)+(−0.7071)(0.7071) |
    | (0.7071)(−0.7071)+(−0.7071)(0.7071)    (0.7071)(0.7071)+(−0.7071)(0.7071)  |
  = | 0.5 − 0.5   −0.5 − 0.5 |   | 0 −1 |
    | −0.5 − 0.5   0.5 − 0.5 | = | −1  0 |

(Equivalently cos2θ = cos270° = 0 and sin2θ = sin270° = −1 in the matrix [[cos2θ, sin2θ], [sin2θ, −cos2θ]].)

Answer:

M = |  0 −1 0 |
    | −1  0 0 |        i.e. (x, y) → (−y, −x)
    |  0  0 1 |

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Graphics chapter 3 questions →