**2D Transformations in Computer Graphics-**

We have discussed-

- Transformation is a process of modifying and re-positioning the existing graphics.
- 2D Transformations take place in a two dimensional plane.

In computer graphics, various transformation techniques are-

In this article, we will discuss about 2D Reflection in Computer Graphics.

**2D Reflection in Computer Graphics-**

- Reflection is a kind of rotation where the angle of rotation is 180 degree.
- The reflected object is always formed on the other side of mirror.
- The size of reflected object is same as the size of original object.

Consider a point object O has to be reflected in a 2D plane.

Let-

- Initial coordinates of the object O = (X
_{old}, Y_{old}) - New coordinates of the reflected object O after reflection = (X
_{new}, Y_{new})

**Reflection On X-Axis:**

This reflection is achieved by using the following reflection equations-

- X
_{new}= X_{old} - Y
_{new}= -Y_{old}

In Matrix form, the above reflection equations may be represented as-

For homogeneous coordinates, the above reflection matrix may be represented as a 3 x 3 matrix as-

**Reflection On Y-Axis:**

This reflection is achieved by using the following reflection equations-

- X
_{new}= -X_{old} - Y
_{new}= Y_{old}

In Matrix form, the above reflection equations may be represented as-

For homogeneous coordinates, the above reflection matrix may be represented as a 3 x 3 matrix as-

**PRACTICE PROBLEMS BASED ON 2D REFLECTION IN COMPUTER GRAPHICS-**

**Problem-01:**

Given a triangle with coordinate points A(3, 4), B(6, 4), C(5, 6). Apply the reflection on the X axis and obtain the new coordinates of the object.

**Solution-**

Given-

- Old corner coordinates of the triangle = A (3, 4), B(6, 4), C(5, 6)
- Reflection has to be taken on the X axis

**For Coordinates A(3, 4)**

Let the new coordinates of corner A after reflection = (X_{new}, Y_{new}).

Applying the reflection equations, we have-

- X
_{new}= X_{old}= 3 - Y
_{new}= -Y_{old}= -4

Thus, New coordinates of corner A after reflection = (3, -4).

**For Coordinates B(6, 4)**

Let the new coordinates of corner B after reflection = (X_{new}, Y_{new}).

Applying the reflection equations, we have-

- X
_{new}= X_{old}= 6 - Y
_{new}= -Y_{old}= -4

Thus, New coordinates of corner B after reflection = (6, -4).

**For Coordinates C(5, 6)**

Let the new coordinates of corner C after reflection = (X_{new}, Y_{new}).

Applying the reflection equations, we have-

- X
_{new}= X_{old}= 5 - Y
_{new}= -Y_{old}= -6

Thus, New coordinates of corner C after reflection = (5, -6).

Thus, New coordinates of the triangle after reflection = A (3, -4), B(6, -4), C(5, -6).

**Problem-02:**

Given a triangle with coordinate points A(3, 4), B(6, 4), C(5, 6). Apply the reflection on the Y axis and obtain the new coordinates of the object.

**Solution-**

Given-

- Old corner coordinates of the triangle = A (3, 4), B(6, 4), C(5, 6)
- Reflection has to be taken on the Y axis

**For Coordinates A(3, 4)**

Let the new coordinates of corner A after reflection = (X_{new}, Y_{new}).

Applying the reflection equations, we have-

- X
_{new}= -X_{old}= -3 - Y
_{new}= Y_{old}= 4

Thus, New coordinates of corner A after reflection = (-3, 4).

**For Coordinates B(6, 4)**

Let the new coordinates of corner B after reflection = (X_{new}, Y_{new}).

Applying the reflection equations, we have-

- X
_{new}= -X_{old}= -6 - Y
_{new}= Y_{old}= 4

Thus, New coordinates of corner B after reflection = (-6, 4).

**For Coordinates C(5, 6)**

Let the new coordinates of corner C after reflection = (X_{new}, Y_{new}).

Applying the reflection equations, we have-

- X
_{new}= -X_{old}= -5 - Y
_{new}= Y_{old}= 6

Thus, New coordinates of corner C after reflection = (-5, 6).

Thus, New coordinates of the triangle after reflection = A (-3, 4), B(-6, 4), C(-5, 6).

To gain better understanding about 2D Reflection in Computer Graphics,

**Next Article-****2D Shearing in Computer Graphics**

Get more notes and other study material of **Computer Graphics**.

Watch video lectures by visiting our YouTube channel **LearnVidFun**.