Skip to main content

Posts

Showing posts with the label Ellipse using mid point algorithm

Ellipse Using Mid Point Algorithm C++ Program

#include<conio.h> #include<stdio.h> #include<Graphics.h> void main ()  { int  gd = DETECT,gm; initgraph ( &gd,&gm, "C:\\TC\\BGI" ); int xc,yc,x,y; long rx,ry; float d; printf ( "Enter Coordinates of Centre of Ellipse: " ); scanf ( "%d%d" ,&xc,&yc ); printf ( "Enter Radius along X-AXIS: " ); scanf ( "%ld" ,&rx ); printf ( "Enter Radius along Y-AXIS: " ); scanf ( "%ld" ,&ry ); //Region 1 d=((ry*ry)-(rx*rx*ry)+(rx*rx))/4; x=0;        y=ry; while ( 2.0*ry*ry*x < = 2.0*rx*rx*y ) {        if ( d < 0 )        {              x++;              d = d+(2*ry*ry*x)+(ry*ry);        }        else   ...