hutch@sdcsvax.UUCP (Jim Hutchison) (07/12/85)
*** These Bugs do seem to creep in... *** Plot.c had a small bug in it, i.e. it looked neat, but not right for most normal cases. For all those of you with headaches over it, pardon. in your main routine: openpl(); space(-500,-500,500,500); set_coord(D_X, D_Y); /* initial position */ monkey(10.0, 0.0, 1.0, 1.0, 1); /* for example */ closepl(); The earlier version ran fine in atleast one particular case, so if it works for you this fix is still a good idea. /* * Plot_line() * * Draw a line by length and angle relative to current x,y * * Author: Jim Hutchison (hutch@sdcsvax) * (this is free, but dis/credit me) */ #include <math.h> #include "g.h" static double crntx = 0.0, crnty = 0.0; /* or global for presetting */ set_coord(x,y) double x,y; { crntx = x; crnty = y; } /* * Plot a line by length and angle from current position */ plot_line(length,angle) double length,angle; { double dx,dy; MOD(angle,TWOPI); dx = length * cos(angle); dy = length * sin(angle); line((int)(crntx * 10.0), (int)(crnty * 10.0), (int)((crntx + dx) * 10.0), (int)((crnty + dy) * 10.0)); crntx += dx; crnty += dy; } -- /* Jim Hutchison UUCP: {dcdwest,ucbvax}!sdcsvax!hutch ARPA: hutch@sdcsvax < Ofcourse these statements are only mine, not my employers. > */