Skip to content

Commit

Permalink
Fix a number of egregious conversions of angular measure.
Browse files Browse the repository at this point in the history
  • Loading branch information
anachrocomputer committed Jul 3, 2018
1 parent f64848d commit 39ac98f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion fraserspiral.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <unistd.h>
#include "hpgllib.h"

#define DEGREES (180.0 / M_PI)

void ringoshapes (double x0, double y0, double radius, int nshapes);

Expand Down Expand Up @@ -90,6 +91,6 @@ void ringoshapes (double x0, double y0, double radius, int nshapes)
xc = (d * cos (theta + (M_PI / 2.0))) + x0;
yc = (d * sin (theta + (M_PI / 2.0))) + y0;

arc (xc, yc, (delta * 1.2) * 57.295);
arc (xc, yc, (delta * 1.2) * DEGREES);
}
}
2 changes: 1 addition & 1 deletion hyp.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void pencolr (int c);
#define MAXY (7600.0)
#endif /* A3 */

#define DEG_TO_RAD (1.0 / 57.295)
#define DEG_TO_RAD (M_PI / 180.0)

double X0, Y0;
double Rad;
Expand Down
2 changes: 1 addition & 1 deletion lobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <stdio.h>
#include <math.h>

#define RADIANS (0.017453292)
#define RADIANS (M_PI / 180.0)

#define BLACK (1)
#define RED (2)
Expand Down
5 changes: 3 additions & 2 deletions spiralsq.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <unistd.h>
#include "hpgllib.h"

#define RADIANS (M_PI / 180.0)

void spiral (double cx, double cy, double radius, double ang, int n);
double diamondsquare (double x0, double y0, double side);
Expand Down Expand Up @@ -71,7 +72,7 @@ int main (int argc, char * const argv[])
slant = -20.0;

r = radius * (i + 1.5);
ringoboxes2 (xc, yc, r, 18 * (i + 1), 1, 0, slant / 57.295);
ringoboxes2 (xc, yc, r, 18 * (i + 1), 1, 0, slant * RADIANS);
}

pencolr (1);
Expand All @@ -84,7 +85,7 @@ int main (int argc, char * const argv[])
slant = -20.0;

r = radius * (i + 1.5);
ringoboxes2 (xc, yc, r, 18 * (i + 1), 1, 1, slant / 57.295);
ringoboxes2 (xc, yc, r, 18 * (i + 1), 1, 1, slant * RADIANS);
}

plotend ();
Expand Down
2 changes: 1 addition & 1 deletion turtle.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "turtle.h"
#include <math.h>

#define RADIANS (0.017453292)
#define RADIANS (M_PI / 180.0)
#define ETX (0x03)

static int Pltdev = DEV_NONE;
Expand Down

0 comments on commit 39ac98f

Please sign in to comment.