Advertisement
Guest User

Untitled

a guest
Nov 13th, 2014
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. /* Draw circular arc in one degree increments. Center is (xc,yc)
  2. with radius r, beginning at starting angle, startang
  3. through angle ang. If ang < 0 arc is draw clockwise. */
  4. void drawarc(xc, yc, r, startang, ang)
  5. float xc, yc, r, startang, ang;
  6. {
  7. #define
  8. #define
  9. float
  10. int
  11. sindt 0.017452406
  12. cosdt 0.999847695
  13. a, x, y, sr;
  14. k;
  15. a= (float) startang*radian;
  16. x= (float) r*cos(a);
  17. y= (float) r*sin(a);
  18. moveto(xc+x, yc+y, 3);
  19. if (ang >= (float) 0.0)
  20. sr= (float) sindt;
  21. else
  22. sr= (float) -sindt;
  23. for (k= 1; k <= (int) floor(fabs(ang)); k++)
  24. { x= x*cosdt-y*sr;
  25. y= x*sr+y*cosdt;
  26. lineto(xc+x,yc+y);
  27. }
  28. return;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement