|
|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 707 (0x2c3)
Types: TextFile
Notes: UNIX file
Names: »plot.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
└─⟦2d53db1df⟧ UNIX Filesystem
└─⟦this⟧ »frankh/gsrc/plot.c«
#include <stdio.h>
#include <math.h>
#include "graph.h"
main()
{
double x, xx, y,
theta, r;
xscale = XMAX / 2.0;
yscale = YMAX / 2.0;
xfudge = .25;
yfudge = .25;
xoff = XMAX / 2.0;
yoff = YMAX / 2.0;
clear();
axis();
for (theta = -PI; theta < PI; theta = theta + 0.01) {
/* r = (sin(theta*theta*theta) * sin(theta)*cos(theta)*cos(theta)); */
r = 1 - 2 * sin(theta);
polar(r, theta); /* plot polar */
}
}
double
plot(x,y)
double x, y;
{
x = x * xscale * xfudge + xoff;
y = y * yscale * yfudge + yoff;
point( (int)x, (int)y);
}
double
polar(r, theta)
double r, theta;
{
double x, y;
x = r * cos(theta); /* Generate rectangular co-ord */
y = r * sin(theta);
plot(x, y);
}