C++ Programming Blog

 
 
 
/*
Reflection in x Axis
*/

# include <iostream.h>
# include <conio.h>
# include <graphics.h>
# include <math.h>

char IncFlag;
int PolygonPoints[3][2] =
    {{10,100},{110,100},{110,200}};

void PolyLine()
{
    int iCnt;
    cleardevice();
    line(0,240,640,240);
    line(320,0,320,480);
    for (iCnt=0; iCnt<3; iCnt++)
    {
        line(PolygonPoints[iCnt][0],PolygonPoints[iCnt][1],
          PolygonPoints[(iCnt+1)%3][0],PolygonPoints[(iCnt+1)%3][1]);
    }
}
void Reflect()
{
    float Angle;
    int iCnt;
    int Tx,Ty;
    cout<<endl;
    for (iCnt=0; iCnt<3; iCnt++)
        PolygonPoints[iCnt][1] = (480 - PolygonPoints[iCnt][1]);
}

void main()
{
    int gDriver = DETECT, gMode;
    int iCnt;
    initgraph(&gDriver, &gMode, \"C:\\\\TC\\\\BGI\");
    for (iCnt=0; iCnt<3; iCnt++)
    {
        PolygonPoints[iCnt][0] += 320;
        PolygonPoints[iCnt][1] = 240 - PolygonPoints[iCnt][1];
    }
    PolyLine();
    getch();
    Reflect();
    PolyLine();
    getch();
}

    Related Post:
  1. Program to illustrate the role of constructor in classes

  2. Program to copy n number of characters from one string to another at position p

  3. Program to illustrate an example of structures

  4. Program to display bill receipt based on customer information and create telephone directory

  5. Program to print some text

  6. Program to read a Non-Linear equation in one variable, then evaluate it using Simple Itrative Method and display its kD accurate root

  7. Program for displaying data in tabular format

  8. Program to search an element in an array using Binary search

  9. PROGRAM TO IMPLEMENT RECURSIVE DESCENT PARSER

  10. Program to draw a 3D Cubic Bezier Curve

  11. Program that defines template of vector class that provides modify and multiplication facility

  12. Program that provides an example of function returning object

  13. Program to illustrate the implementation of Double Ended linked list as a Stack

  14. Program to find the day of a week of a given date from 15 october 1582 to end of universe using arrays

  15. Program to perform selection sort

  16. Program to illustrate the difference among public, protected and private inheritance

  17. Program to estimate the Integral value of a given function using Gussian Quadrature Rule

  18. Write a program to read value from console and perform arithmetic operation

  19. Program to estimate the value of Second Derivative of the function at the given points from the given data using Central Difference Formula of order 2

  20. Program to illusrate data conversion b/w built-in data types and user defined data types (int & float)

 
 
Didn't find what you were looking for? Find more on Program of reflection in x axis