Your IP : 216.73.216.40


Current Path : /var/www/html/venkat/check3/file/cg2013/pawan/
Upload File :
Current File : /var/www/html/venkat/check3/file/cg2013/pawan/IIT2013107_2.cpp

//#include <GL/glut.h>
#include <iostream>
#include <cmath>

using namespace std;
int square[8];
int square2[8];
/*void init2D(float r, float g, float b)
{
	glClearColor(r,g,b,0.0);
	glMatrixMode (GL_PROJECTION);
	gluOrtho2D (-800.0, 800.0, -800.0, 800.0);
}*/
int n;
int x[1000];
int y[1000];
int axis;
void perProFormula(int x,int y)
{	int prp1 = 0, prp2 = -100,prp3 = 10;
	
	double a = (prp3 - 10) / (prp3 - 0);
	double b = (10 - 0) / (prp3 - 0);

	int perP1 = x * a + prp1 * b;
	int perP2 = y * a + prp2 * b;
	
	//cout << "old was "; showPoint(p);
	cout <<perP1<<" "<<perP2<<endl;
}
void display()
{
	/*glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(0.0, 1.0, 0.0);

    glPointSize(3.0f);
    glBegin(GL_LINES);
*/
        for( int i = 0; i < 8; i+=2)
        {
            cout<<square[i]<<","<< square2[i]<<","<<"0"<<endl;;
        }

       /* for( int i = 0; i < n; i++)
        {
            glVertex2f( x[i], y[i]);
        }*/
	for(int i = 0; i < n; i++) {
		cout<<x[i]<<","<<y[i]<<","<<"0"<<endl;
	}

   	for(int i = 0; i < n; i++) {
		if(axis == 0 && y[i] != 0) {
			y[i] = -y[i];
		}
		else if(axis == 1 && x[i] != 0) {
			x[i] = -x[i];
		} else if(axis == 2 && x[i] != 0 && y[i] != 0) {
			x[i] = -x[i];
			y[i] = -y[i];
		}
		cout<<x[i]<<","<<y[i]<<","<<"0"<<endl;
	}

    	/*for( int i = 0; i < n; i++)
        {
            glVertex2f( x[i], y[i]);
        }
	
	
    	glEnd();
	glFlush();*/
}

int main(int argc,char *argv[])
{	n=10;
	square[0] = -100;
	square2[0] = 700;
	square[1] = -100;
	square2[1] = 500;
	square[2] = -100;
	square2[2] = 500;
	square[3] = 100;
	square2[3] = 500;
	square[4] = 100;
	square2[4] = 500;
	square[5] = 100;
	square2[5] = 700;
	square[6] = 100;
	square2[6] = 700;
	square[7] = -100;
	square2[7] = 700;
	
	x[0] = -50; y[0] = 0;
	x[1] = -50; y[1] = 500;
	x[2] = -150; y[2] = 0;
	x[3] = -500; y[3] = 400;
	x[4] = -500; y[4] = 400;
	x[5] = -100; y[5] = 700;
	x[6] = -50; y[6] = 0;
	x[7] = -400; y[7] = 400;
	x[8] = -400; y[8] = 400;
	x[9] = -100; y[9] = 600;
 	
	display();
	
	axis = 1;
	/*for( int i = 0; i < n; i++)
        {
            perProFormula(x[i],y[i]);
        }*/
	/*glutInit(&argc,argv);
	glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
	glutInitWindowSize (500, 500);
	glutInitWindowPosition (100, 100);
	glutCreateWindow ("points and lines");
	init2D(0.0,0.0,0.0);
	glutDisplayFunc(display);
	glutMainLoop();*/
	return 0;
}