# Reflection in Computer Graphics

A reflection is a transformation that produces a mirror image of an object. In 2D reflection, we consider any line in a 2D plane as the mirror, the original object and the reflected object are both in the same plane of the mirror line.

## Basic Principle of Reflection:

1. The image of an object is formed on the side opposite to where the object is lying concerning the mirror line.
2. The perpendicular distance of the object from the mirror line is identical to the distance of the reflected image from the same mirror line.
So, the relation between the point P(x,y) and its image P'(x’,y’) about X-axis.
x’=x
y’=-y The transformation matrix for reflection about X axis or y=0 axis is :  A reflection about Y-axis flips x coordinates while y coordinates remain the same. For the reflection of P(x,y) to P'(x’,y’)
x’=-x
y’=y

This transformation is identified by the reflection

## Reflection about the straight Line y=x

To find the relation between a point’s coordinates (x,y) and those of its image (x’,y’) reflected through y=x straight line. Hence,
x’=y
y’=x

## Reflection about the straight Line y=-x This time, we can’t simply state x’=y and y’=x because that is only the equations of magnitude.
Hence,
x’=-y
y’=-x