plot for fractal source which uses plot(3) instead of core

Jim Hutchison hutch at sdcsvax.UUCP
Thu Jul 11 10:17:12 AEST 1985


*** REPLACE THIS LINE WITH YOUR MESSAGE ***

Due to a number of flames and or requests I am posting this
copy of the routine plot() which does not use core.
It uses plot(3) line() instead.  The initial openpl() and
closepl() are left to the reader to use in conjunction.

/*
 * Plot_line()
 *
 * Draw a line by length and angle relative to current x,y
 *
 * Author: Jim Hutchison (hutch at sdcsvax)
 * (this is free, but credit me)
 */

#include <math.h>
#include "g.h"

static double crntx = 0.0, crnty = 0.0;

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( crntx, crnty, crntx + dx, crnty + dy);
    crntx += dx;
    crnty += dy;	/* don't forget openpl() and closepl() */
}
-- 
/*
	Jim Hutchison	UUCP:	{dcdwest,ucbvax}!sdcsvax!hutch
			ARPA:	hutch at sdcsvax

    < Ofcourse these statements are only mine, not my employers. >
*/



More information about the Comp.sources.unix mailing list