diff options
Diffstat (limited to 'primitives.cc')
-rw-r--r-- | primitives.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/primitives.cc b/primitives.cc index a2ca971..c08e0a1 100644 --- a/primitives.cc +++ b/primitives.cc @@ -286,10 +286,20 @@ sphere_next_r2: for (int i=0; i<fragments; i++) { double phi = (M_PI*2*i) / fragments; - circle1[i].x = r1*cos(phi); - circle1[i].y = r1*sin(phi); - circle2[i].x = r2*cos(phi); - circle2[i].y = r2*sin(phi); + if (r1 > 0) { + circle1[i].x = r1*cos(phi); + circle1[i].y = r1*sin(phi); + } else { + circle1[i].x = 0; + circle1[i].y = 0; + } + if (r2 > 0) { + circle2[i].x = r2*cos(phi); + circle2[i].y = r2*sin(phi); + } else { + circle2[i].x = 0; + circle2[i].y = 0; + } } for (int i=0; i<fragments; i++) { |