[comp.windows.x] My own bug in miFillSppPoly

doyle@b11.ingr.com (Doyle Davidson) (06/23/89)

I am having a problem in the server with polygon fills for lines.
Basically endpoints are being plotted when they shouldn't and
should when they shouldn't.  It is simply a case of floating
point arithmetic is not perfect! 

Basically, to determine a span for two FP 'x' values say,
  14.7 to 19.3 one takes the 'ceil' of each and that gives the span.
  (15 to 20) with the last point not being plotted: span y=15 width=5 (15-19)
Great.
But sometimes ceil(xx.000000) returns xx+1!!  I think this is because
deep down xx.00000 is something like xx.0000000000000001
Subtracting EPSILON (=0.000001) before doing the ceil solves my problem.

What I want to know is if anyone else has noticed this problem or is
it just own own math library.

It does not occur most of the time!  One line segment that this does 
show up in for me is    width=10  (226,85) to (150,150)  cap=CapButt:
	XDrawLine(display, window, gc, 226, 85, 150, 150);
Width=0 for this line works fine!!

A quick way to tell.  For any line in X, the pixel for the left endpoint
should always be plotted and the pixel for the right endpoint should
never be plotted (vertical lines are the exception) for single segment lines
the are CapButt.

Preferably email a response directly to me.

Thanks in advance.

Doyle
------------------------------------------------------------------
Doyle C. Davidson              |
Intergraph Corp.               |  These comments are...
Workstation Graphics Standards |
1 Madison Industrial Park      |     \\  /
Huntsville, AL 35806           |      \\/
(205) 772-2000                 |      /\\  clusively my own.
                               |     /  \\
..!uunet!ingr!b11!doyled!doyle |
------------------------------------------------------------------