# Reflection in Computer Graphics

In Computer Graphics, **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:__

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

y’=-y

__Types of Reflection in Computer Graphics:__

### Reflection about X-Axis:

The transformation matrix for reflection about X axis or y=0 axis is :

### Reflection about Y-Axis:

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**