Skip to content

Commit

Permalink
Make 'alpha' more local.
Browse files Browse the repository at this point in the history
  • Loading branch information
anachrocomputer committed Aug 25, 2020
1 parent 37a27b2 commit e8a081d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions curve_stitching.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ void draw_quad(const double x1, const double y1, const double x2, const double y
void draw_curve(const double x1, const double y1, const double x2, const double y2, const double x3, const double y3)
{
int i;
double alpha;
double dx, dy;
double xpt1[NPTS];
double ypt1[NPTS];
Expand All @@ -128,7 +127,7 @@ void draw_curve(const double x1, const double y1, const double x2, const double
dy = y2 - y1;

for (i = 1; i < NPTS; i++) {
alpha = (1.0 / (double)NPTS) * (double)i;
const double alpha = (1.0 / (double)NPTS) * (double)i;

xpt1[i] = x1 + (dx * alpha);
ypt1[i] = y1 + (dy * alpha);
Expand All @@ -138,7 +137,7 @@ void draw_curve(const double x1, const double y1, const double x2, const double
dy = y3 - y2;

for (i = 1; i < NPTS; i++) {
alpha = (1.0 / (double)NPTS) * (double)i;
const double alpha = (1.0 / (double)NPTS) * (double)i;

xpt2[i] = x2 + (dx * alpha);
ypt2[i] = y2 + (dy * alpha);
Expand Down

0 comments on commit e8a081d

Please sign in to comment.