avoid division by zero in imaging code

This commit is contained in:
Axel Kohlmeyer 2020-08-22 15:32:04 -04:00
parent 2fd654f4fd
commit 9152a8e98f
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
1 changed files with 1 additions and 1 deletions

View File

@ -651,7 +651,7 @@ void Image::draw_cylinder(double *x, double *y,
double c = surface[0] * surface[0] + surface[1] * surface[1] - radsq;
double partial = b*b - 4*a*c;
if (partial < 0) continue;
if ((partial < 0.0) || (a == 0.0)) continue;
partial = sqrt (partial);
double t = (-b + partial) / (2*a);