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/tes.cpp

#include <bits/stdc++.h>
//#include <GL/gl.h>
//#include <GL/glu.h>
//#include <GL/glut.h>

using namespace std;

double pa, pb, qa, qb, ra, rb, sa, sb;

/*void dda(double x1, double x2, double x3, double x4)
{
    float xIncrement, yIncrement, x, y, dx, dy;
	int i;

	dx = x3-x1;
	dy = x4-x2;
	x = x1;
	y = x2;
	xIncrement = dx / 10000.0;
	yIncrement = dy / 10000.0;

	for (i = 0; i < 10000; i++) {
		x += xIncrement;
		y += yIncrement;
		glVertex3f(x, y, 0.1);
	}

}
*/
double rotatey(double y, double phi){
    return y*cos(phi);
}

double rotatez(double z, double phi){
	return z*sin(phi);
}

double getVal(double z){
	return z + sqrt(10100);
}

void project(double xa, double ya, double xb, double yb)
{
	double za, zb;
	double x1, y1, z1, x2, y2, z2, phi;
	phi =  M_PI/2 - atan(0.1);
	x1 = xa;
	//y1 = ya * cos(phi);
	y1 = rotatey(ya, phi);
	z1 = rotatez(ya, phi);
	//z1 = ya * sin(phi);
	x2 = xb;
	//y2 = yb * cos(phi);
	y2 = rotatey(yb, phi);
	z2 = rotatez(yb, phi);
	//z2 = yb * sin(phi);

	//za = z1 + sqrt(10100);
	//zb = z2 + sqrt(10100);
	xa = (x1 / getVal(z1)) * 10;
	ya = (y1 / getVal(z1)) * 10;
	xb = (x2 / getVal(z2)) * 10;
	yb = (y2 / getVal(z2)) * 10;

	cout << xa << " " << ya  << endl;
	//dda(xa, ya, xb, yb);
}

void doWork() {
	//glClearColor(0, 0, 0, 0);
	//glClear(GL_COLOR_BUFFER_BIT);
	//glColor3f(1, 1, 1);
	//glBegin(GL_POINTS);
	//glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
	project(pa, pb, qa, qb);
	project(qa, qb, sa, sb);
	project(sa, sb, ra, rb);
	project(ra, rb, pa, pb);
	project(-50, 0, -50,500);
	project(-150,0, -500,400);
	project(-500,400, -100,700);
	project(-50, 0, -400,400);
	project(-400, 400 ,-100,600);
	project(50, 0, 50,500);
	project(150,0, 500,400);
	project(500,400, 100,700);
	project(50, 0, 400,400);
	project(400, 400 ,100,600);
	//glEnd();
	//glFlush();
}

int main(int argc, char ** argv)
{
	pa =  -100; pb = 700;
	qa = -100; qb =500;
	ra = 100; rb = 700;
	sa = 100; sb =500;
	//glutInit(&argc, argv);
	//glutInitDisplayMode(GLUT_SINGLE);
	//glutInitWindowSize(2000, 2000);
	//glutInitWindowPosition(50, 50);
	//glutCreateWindow("LabTest1");
	//glutDisplayFunc(doWork);
	//glutMainLoop();
	doWork();
	return 0;
}