home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / video / 7 / 7_5.c < prev   
Encoding:
Text File  |  1988-08-11  |  526 b   |  22 lines

  1. /* Listing 7-5 */
  2.  
  3. Circle10( xc, yc, xr, yr, n)        /* circles in 640x350 16-color mode */
  4. int    xc,yc;        /* center of circle */
  5. int    xr,yr;        /* point on circumference */
  6. int    n;        /* pixel value */
  7. {
  8.     double    x,y;
  9.     double    sqrt();
  10.     double    Scale10 = 1.37;        /* pixel scaling factor */
  11.     int    a,b;
  12.  
  13.     x = xr - xc;            /* translate center of ellipse */
  14.     y = (yr - yc) * Scale10;    /*  to origin */
  15.  
  16.     
  17.     a = sqrt( x*x + y*y );        /* compute major and minor axes */
  18.     b = a / Scale10;
  19.  
  20.     Ellipse10( xc, yc, a, b, n);    /* draw it */
  21. }
  22.