summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwl <wl>2009-09-01 05:26:30 +0000
committerwl <wl>2009-09-01 05:26:30 +0000
commit88563e645a8ab2d41b0b14fb4141d341f70eeb9a (patch)
treea24a9197074cbd1560951a2d2bc989b2584e0863 /src
parent41dbc33cb500b495ae5372c5a7797c5bc74a931a (diff)
downloadgroff-88563e645a8ab2d41b0b14fb4141d341f70eeb9a.tar.gz
[pic] Fix a border case for arc computation.
* src/preproc/pic/object.cpp (object_spec::make_arc): It can happen that test `radius < d' in the loop is satisfied, but the difference in the two values is on the order of 1e-10. If `radius' is small, doubling the value can lead to a fairly gross error. The original code appears to have been intended to deal with the situation when radius is orders of magnitude less than `d'. The replacement code simply assigns `radius' the smallest value that avoids problems with the floating point code further on in the routine.
Diffstat (limited to 'src')
-rw-r--r--src/preproc/pic/object.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/preproc/pic/object.cpp b/src/preproc/pic/object.cpp
index 62415793..a3146040 100644
--- a/src/preproc/pic/object.cpp
+++ b/src/preproc/pic/object.cpp
@@ -1830,8 +1830,8 @@ linear_object *object_spec::make_arc(position *curpos, direction *dirp)
if (radius <= 0)
radius = .25;
// make the radius big enough
- while (radius < d)
- radius *= 2.0;
+ if (radius < d)
+ radius = d;
double alpha = acos(d/radius);
double theta = atan2(h.y, h.x);
if (cw)