Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site sdcsvax.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!mtuxo!mtunh!mtung!mtunf!ariel!vax135!cornell!uw-beaver!tektronix!hplabs!sdcrdcf!sdcsvax!hutch
From: hutch@sdcsvax.UUCP (Jim Hutchison)
Newsgroups: net.graphics
Subject: Fractal Plot (BUG)
Message-ID: <980@sdcsvax.UUCP>
Date: Thu, 11-Jul-85 19:19:38 EDT
Article-I.D.: sdcsvax.980
Posted: Thu Jul 11 19:19:38 1985
Date-Received: Wed, 17-Jul-85 07:24:13 EDT
Organization: UCSD EMU Project (Educational Microcomputer Unix)
Lines: 65

*** 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 
#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. >
*/