🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #556

Re: Drawing circles with MSC 5.00

#556
From: Everett Kaser
Date: Wed, 30 May 1990 16:07
23 lines
2105 bytes
The problem with the _ellipse function in Microsoft C giving you an ellipse
that is actually one dot too wide (or high) is this:  the function was written
to accept the corners of the bounding rectangle as the arguments, or ellipse
specifying parameters.  However, the actual code (or algorithm) used is based
on knowing the "center" of the ellipse and the lengths of the two axis.  Hence,
the _ellipse function must first find the "center" of the rectangle and the
distance from the "center" to the two sides, before beginning the actual
drawing.  This works fine if the "ellipse" (or the bounding rectangle) is an
odd number of dots wide (and high), because then you can find the EXACT center
of the figure.  But when the ellipse is an even number of dots wide (or high),
the center is at a half dot position, and you can't plot "half-dots" on a CRT,
so the center has to be adjusted a half-dot one way or the other.  The
algorithm for drawing the ellipse assumes that the "quarters" of the ellipse
are symetrical about the center, so this forces the ellipse to be drawn one
dot larger (or smaller) than the user actually requested.  Yes, you could come
up with an algorithm that would do a best fit to the bounding rectangle that
the user requested, but the REAL problem here is that Microsoft chose to have
the user specify the parameters from a different frame (or point of view) than
that which the algorithm actually uses, and accuracy is lost in the conversion.

Everett Kaser                   Hewlett-Packard Company
...hplabs!hp-pcd!everett        work: (503) 750-3569   Corvallis, Oregon
everett%hpcvlx@hplabs.hp.com    home: (503) 928-5259   Albany, Oregon
Technical Details
Message-ID: <102220005@hpcvlx.cv.hp.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!sdd.hp.com!hp-pcd!hpcvlx!everett
References: <1738@krafla.rhi.hi.is>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!sdd.hp.com!hp-pcd!hpcvlx!everett
From: everett@hpcvlx.cv.hp.com (Everett Kaser)
Newsgroups: comp.sys.ibm.pc.programmer
Subject: Re: Drawing circles with MSC 5.00
Message-ID: <102220005@hpcvlx.cv.hp.com>
Date: 30 May 90 16:07:10 GMT
References: <1738@krafla.rhi.hi.is>
Organization: Hewlett-Packard Co., Corvallis, OR, USA
Lines: 23