0% found this document useful (0 votes)
25 views1 page

Program 10

The document describes a program to reflect a polygon by drawing it, reflecting it across the x and y axes, and outputting the original and reflected polygons. The program uses graphics functions like line, getmaxx, getmaxy to draw the original triangle in the second quadrant and its reflections.

Uploaded by

Aashish Pandey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

Program 10

The document describes a program to reflect a polygon by drawing it, reflecting it across the x and y axes, and outputting the original and reflected polygons. The program uses graphics functions like line, getmaxx, getmaxy to draw the original triangle in the second quadrant and its reflections.

Uploaded by

Aashish Pandey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Practical 10 : Design a program to reflect a polygon.

Name : Aashish Pandey


Date : 03-04-2024
Program : line(x2, getmaxy() - y2, x3,
#include <conio.h> getmaxy() - y3);
#include <graphics.h> line(x3, getmaxy() - y3, x1,
#include <stdio.h> getmaxy() - y1);
getch();
void main()
{ closegraph();
int gm, gd = DETECT, ax, x1 = 100; }
int x2 = 100, x3 = 200, y1 = 100;
int y2 = 200, y3 = 100; Output :

initgraph(&gd, &gm, "");


cleardevice();
line(getmaxx() / 2, 0,
getmaxx() / 2,
getmaxy());
line(0, getmaxy() / 2, getmaxx(),
getmaxy() / 2);
printf("Before Reflection Object"
" in 2nd Quadrant");
setcolor(14);
line(x1, y1, x2, y2);
line(x2, y2, x3, y3);
line(x3, y3, x1, y1);
getch();
printf("\nAfter Reflection");
setcolor(4);
line(getmaxx() - x1, getmaxy() - y1,
getmaxx() - x2, getmaxy() - y2);

line(getmaxx() - x2, getmaxy() - y2,


getmaxx() - x3, getmaxy() - y3);

line(getmaxx() - x3, getmaxy() - y3,


getmaxx() - x1, getmaxy() - y1);
setcolor(3);
line(getmaxx() - x1, y1,
getmaxx() - x2, y2);
line(getmaxx() - x2, y2,
getmaxx() - x3, y3);
line(getmaxx() - x3, y3,
getmaxx() - x1, y1);

setcolor(2);
line(x1, getmaxy() - y1, x2,
getmaxy() - y2);

You might also like