Skip to content

Commit

Permalink
Pre-calculate multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
tcanabrava committed Jul 23, 2019
1 parent 7a91a2f commit 6479c0a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/waterfall/polarplot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ void PolarPlot::draw(const QVector<double>& points, float angle, float initPoint
}

step = ceil(i * degreeToRadianTimesAngleGradTimes2);
float halfstep = step / 2;
float deltaDrgree_A = (resultionTimesAngleGradTimes2 / (float) step);
// The math and logic behind this loop is done in a way that the interaction is done with ints
for(int currentStep = 0; currentStep < step; currentStep++) {
float deltaDegree = (resultionTimesAngleGradTimes2 / (float) step) * (currentStep - step/2);
float deltaDegree = deltaDrgree_A * (currentStep - halfstep);
angleStep = deltaDegree * degreeToRadian + actualAngle - M_PI_2;
_image.setPixelColor(center.x() + i * cos(angleStep), center.y() + i * sin(angleStep), pointColor);
}
Expand Down

0 comments on commit 6479c0a

Please sign in to comment.