ellipse

Overview :

This function is used to draw an elliptical arc in the graphics mode.We can draw full ellipse also using this function.

Syntax :
void ellipse(int x,int y,int stangle,int endangle,int x_radius,int y_radius);
Description :

The "ellipse" function accepts 6 parameters

  • x -> The x co-ordinate of the screen where the center of elliptical arc has to be drawn

  • y -> The y co-ordinate of the screen where the center of elliptical arc has to be drawn

  • stangle -> This parameter is used for starting angle of the elliptical arc which ranges from 0-360 deg.

  • endangle -> This parameter is used for end angle of the elliptical arc which also ranges from 0-360 deg.

  • xradius -> This parameter is used for giving x axis radius of the elliptical arc

  • yradius -> This parameter is used for giving y axis radius of the elliptical arc


To draw a full ellipse from this function we need to set stangle = 0 and endangle = 360.



"ellipse" function does not return any value.
Example :
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main()
{
    
   int gm,gd=DETECT;
   int x,y,stangle,endangle,x_radius,y_radius;
   
   printf("\nEnter the (x,y) co-ordinate : ");
   scanf("%d%d",&x,&y);
   
   printf("\nEnter the starting and ending angle : ");
   scanf("%d%d",&stangle,&endangle);
   
   printf("\nEnter the x-radius and y-radius: ");
   scanf("%d%d",&x_radius,&y_radius);
   
   initgraph(&gd,&gm,"C:\\turboc3\\bgi");
   setcolor(10);
   
   ellipse(x,y,stangle,endangle,x_radius,y_radius);
   
   getch();
   closegraph();
   return 0;
}

Image Of Getting Co-ordinates



Final Output

Comments

comments powered by Disqus