[comp.graphics] Problems with General Conic Algorithm

chris@flood.com (Chris Newton) (11/17/90)

Greetings!

This is directed at anyone out there who's implemented the "General Conic"
algorithm from "Computer Graphics", 2nd Ed. (Figure 19.34)....

I've obtained an electronic copy from the mail server at cs.brown.edu,
converted it from Pascal to C, and fleshed out the "last quadrant" drawing
logic which isn't supplied.  Also, added a front-end routine to interface
between my application and Congugate().  (Only a few lines of code.)
So far so good.

At first, it appeared to work correctly.  Most ellipses are drawn correctly,
at all orientations.  The algorithm begins to behave strangely when the
minor-axis drops below about 20% of the major-axis - that is, with
increasingly "thin" ellipses.  Two things seem to happen:
	1) One end of the ellipse grows longer - that is, the figure is
	   no longer centered around the specified center.
	2) The second half of the ellipse (in drawing order) ends up
	   being longer than the first half, so that by the time the
	   "last octant" code is called, the endpoint has been overshot,
	   causing a strange "tail" to be drawn.

To me, it looks almost like an accumulated error in the calculations is
showing up in these extreme cases.  The algorithm seems to have no problem with
just about any other ellipse I've tried - The circle case (major == minor)
looks like circles drawn with X-Window circle commands.

I've triple checked my algorithm with the Pascal source and the text in the
book - they look identical.  Since I've found other typos and errors in what's
been published, I was wondering if there's an error here that someone else
has run into and solved.

If anyone is interested, I can E-mail them the relevant code.

NOTE: This is *NOT* the "skipping-octants" problem mentioned in the text!  This
behavior appears long before the ellipse gets *that* narrow.

Please E-mail responses.  I'll summarize any results and re-post.
Thanks in advance for your help!


-- 
Chris B. Newton			The Flood Group, Inc.	Lawndale, Ca.
Internet: chris@flood.com	(213) 219-1155
UUCP: ...!uunet!flood!chris