Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Draw circular arc in one degree increments. Center is (xc,yc)
- with radius r, beginning at starting angle, startang
- through angle ang. If ang < 0 arc is draw clockwise. */
- void drawarc(xc, yc, r, startang, ang)
- float xc, yc, r, startang, ang;
- {
- #define
- #define
- float
- int
- sindt 0.017452406
- cosdt 0.999847695
- a, x, y, sr;
- k;
- a= (float) startang*radian;
- x= (float) r*cos(a);
- y= (float) r*sin(a);
- moveto(xc+x, yc+y, 3);
- if (ang >= (float) 0.0)
- sr= (float) sindt;
- else
- sr= (float) -sindt;
- for (k= 1; k <= (int) floor(fabs(ang)); k++)
- { x= x*cosdt-y*sr;
- y= x*sr+y*cosdt;
- lineto(xc+x,yc+y);
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement