Reflection deals with obtaining a mirror image of the 2D object.
About x-axis:
If P(x, y) is the point on x-y plane then P’(x’, y’) is the reflection about x-axis given as x’=x ; y’=-y

Matrix Form:

About y-axis :
If P(x, y) is the point on x-y plane then P’(x’, y’) is the reflection about y-axis given as x’=-x ; y’=y


Along origin :
If P(x, y) is the point on x-y plane then P’(x’, y’) is the reflection about origin given as x’=-x ; y’=-y


About x=y line : To do this move x=y line to any of the axis. In the given diagram the angle of rotation is 45o as the points are plotted as (0, 0), (1, 1), (2, 2), and so on.

Imposing the line clockwise (-45o) imposing it on the x-axis we have,

We know,
![]()
and
![]()

Now perform reflection along x-axis,

Now rotate the line back 45o in an anticlockwise direction,

Now if P(x, y) is the point on x-y plane then P’(x’, y’) is the reflection about x=y line given as x’=y ; y’=x
Matrix Form:

Recommended Posts:
- DDA Line generation Algorithm in Computer Graphics
- Creating a Rainbow using Graphics Programming in C
- Point Clipping Algorithm in Computer Graphics
- How to add "graphics.h" C/C++ library to gcc compiler in Linux
- 2D Transformation in Computer Graphics | Set 1 (Scaling of Objects)
- Translation of objects in computer graphics
- Sierpinski Triangle using Graphics
- Vector vs Raster Graphics
- Draw ellipse in C graphics
- Draw a line in C++ graphics
- Draw Rectangle in C graphics
- Draw circle in C graphics
- How to include graphics.h in CodeBlocks?
- bar() function in C graphics
- bar3d() function in C graphics
- Segments in Computer Graphics
- Flood fill algorithm using C graphics
- Computer Graphics | Cathode ray tube (video display device)
- Computer Graphics | Antialiasing
- Draw a moving car using computer graphics programming in C
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

