Programming Reference/Librarys
Question & Answer
Q&A is closed
getarccoords fills in the arccoordstype structure pointed to by arccoords with information about the last call to arc. The arccoordstype structure is defined in graphics.h as follows: struct arccoordstype { int x, y; int xstart, ystart, xend, yend; }; The members of this structure are used to specify the center point (x,y), the starting position (xstart, ystart), and the ending position (xend, yend) of the arc. These values are useful if you need to make a line meet at the end of an arc.
/* getarccoords example */ #include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> int main(void) { /* request autodetection */ int gdriver = DETECT, gmode, errorcode; struct arccoordstype arcinfo; int midx, midy; int stangle = 45, endangle = 270; char sstr[80], estr[80]; /* initialize graphics and local variables */ initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) { /* an error occurred */ printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ } midx = getmaxx() / 2; midy = getmaxy() / 2; /* draw arc and get coordinates */ setcolor(getmaxcolor()); arc(midx, midy, stangle, endangle, 100); getarccoords(&arcinfo); /* convert arc information into strings */ sprintf(sstr, "*- (%d, %d)", arcinfo.xstart, arcinfo.ystart); sprintf(estr, "*- (%d, %d)", arcinfo.xend, arcinfo.yend); /* output the arc information */ outtextxy(arcinfo.xstart, arcinfo.ystart, sstr); outtextxy(arcinfo.xend, arcinfo.yend, estr); /* clean up */ getch(); closegraph(); return 0; }
no output of example at the moment do not hesitate and add it...