Thread View: net.micro.cbm
1 messages
1 total messages
Started by prindle
Tue, 21 Oct 1986 03:21
C-Power graphics package part 5 of 6 (grafpak2.c)
Author: prindle
Date: Tue, 21 Oct 1986 03:21
Date: Tue, 21 Oct 1986 03:21
60 lines
2103 bytes
2103 bytes
From: prindle@NADC
/* Graphics Package - Part 2
** Filename: grafpak2.c
** Author: Mark R. Rinfret
** Date: 12/14/85
** Description:
**
** This is part 2 of a multi-part graphics package, written in C (C-Power)
** for the Commodore 64. The routines contained in this segment are:
**
** arc - draws arcs, line segments, circles, ellipses, polygons
** circle - simplified call to arc
**
**
*/
#include <stdio.h>
#include <strings.h>
#include <math.h>
#include "grafpak.h"
/* Plot an arc.
** Parameters:
** xorigin,yorigin - center point
** xrad,yrad - x and y radii
** start,end - starting, ending point for arc, in degrees
** angl - degrees of rotation (not used yet)
** incr - degrees between steps (FLOAT!); 120.0 yields a triangle
** pen - (0-3) pen number to draw with
*/
arc(xorigin,yorigin,xrad,yrad,
start,end,angl,incr,pen)
unsigned xorigin,yorigin,xrad,yrad,start,end,angl; float incr; unsigned pen;
{
register unsigned cnt,x,y,px,py;
float arad,fstart,fend,fincr,fxrad,fyrad,xo,yo;
cnt = 0;
fincr = incr; /* copy to local */
fyrad = yrad;
fxrad = xrad * aspect; /* adjust to aspect ratio */
xo = xorigin; yo = yorigin;
for (fstart=start,fend=end;fstart<=fend;fstart += fincr) {
arad = fstart/RADCON;
x = xo + fxrad * cos(arad);
y = yo + fyrad * sin(arad);
if (!cnt) pset(x,y,pen);
else line(px,py,x,y,pen);
px=x; py=y;
cnt++;
}
}
/* Plot a circle */
circle(xorigin,yorigin,radius,pen)
unsigned xorigin,yorigin,radius,pen;
{
arc(xorigin,yorigin,radius,radius,
0,360,0,1.0,1);
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads