Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site well.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!qantel!lll-crg!well!perry From: perry@well.UUCP (Perry S. Kivolowitz) Newsgroups: net.micro.amiga Subject: balls (2 of 2) Message-ID: <302@well.UUCP> Date: Wed, 27-Nov-85 08:01:11 EST Article-I.D.: well.302 Posted: Wed Nov 27 08:01:11 1985 Date-Received: Fri, 29-Nov-85 21:27:19 EST Organization: Whole Earth Lectronic Link, Sausalito, CA Lines: 42 Keywords: source code, bresenham's circle algorithm This is file two of two. To be loaded with balls.c Thanks to Captain Crunch for getting this off my amiga and onto a VAX. Perry S. Kivolowitz ----------------------------------------------------- /* ** b r e s . c ** ** perry s. kivolowitz - ihnp4!ptsfa!well!perry ** ** not to be distritbuted for commercial use. any distribution ** must included this notice, please. ** ** generate radial displacements according to bresenham's circle ** algorithm. suitable for running twice, giving a fast spherical ** surface. ** */ bres(r , array) register short *array; register r; { register x , y , d; x = 0; y = r; d = 3 - 2 * r; while (x < y) { *(array + r - y) = x; *(array + r - x) = y; *(array + r + y - 1) = x; *(array + r + x - 1) = y; if (d < 0) d += 4 * x + 6; else d += 4 * (x - y--) + 10; x++; } if (x == y) { *(array + r - y) = x; *(array + r + y - 1) = x; } }