Ellipse using OpenGl
#include<gl/glut.h> #include<gl/glu.h> #include<gl/gl.h> #include<iostream> using namespace std; int xc=0,yc=0,rx=40,ry=60; void display() { float rxsq=rx*rx; float rysq=ry*ry; float x=0,y=ry,p; float px=0,py=2*rxsq*y; glClear(GL_COLOR_BUFFER_BIT); glPointSize(1); glBegin(GL_POINTS); glVertex2i(xc+x,yc+y); glVertex2i(-(xc+x),-(yc+y)); cout<<xc+x<<" "<<yc+y<<endl; p=rysq-(rxsq-ry)+(0.25*rxsq); while(px<py) { x++; px=px+2*rysq; if(p<0) p=p+rysq+px; else { y--; py=py-2*rxsq; p=p+rysq+px-py; } glVertex2i(xc+x,yc+y); glVertex2i(xc+x,-(yc+y)); glVertex2i(-(xc+x),yc+y); glVertex2i(-(xc+x),-(yc+y)); cout<<xc+x<<" "<<yc+y<<endl; } p=rysq*(x+0.5)*(x+0.5) + rxsq*(y-1)*(y-1) -rxsq*rysq; while(y>0) { y--; py=py-2*rxsq; if(p>0) { p=p+rxsq-py; } else { x++; px=px+2*rysq...