🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #2212

Re: Bug in MSC 6.0 ?

#2212
From: Everett Kaser
Date: Thu, 13 Sep 1990 14:37
35 lines
2477 bytes
frisk@rhi.hi.is (Fridrik Skulason) writes...
>I have noticed what I believe is a minor error in the MSC 6.0 graphics
>The problem is that I cannot draw ellipses where the height is an even number.
>-frisk

This could be considered a bug, but is really a ramification of the decision
by Microsoft's engineers to have the parameters of the ellipse specified in a
fashion different from the actual parameters needed by the algorithm to draw
the ellipse.

The algorithm they use is the fairly standard one which requires that you know
the "center" of the ellipse (the point where the major and minor axis inter-
sect), and the lengths of the major and minor radii.  Based on this algorithm,
for any ellipse the center will take one pixel and then you'll have an equal
number (even OR odd) of pixels above and below the center.  This will cause you
to always have an ellipse that is an ODD number of pixels high, since
1+2*r is ALWAYS odd, regardless of the value of 'r'.  The same applies to the
x-axis, even though you didn't complain about that.

So, instead of having the user specify the (x,y) of the CENTER and the rx,ry
lengths of the two axis, the Microsoft engineers got cute and said, "Hey, I've
got a good idea! Let's specify the ellipse by the diagonal corners of the
bounding rectangle!"  Well, the problem with that is that it allows the user to
specify a height or width for the ellipse which is an EVEN number of pixels,
when the algorithm they use requires an ODD number of pixels.  So, what happens
is that during the conversion from bounding_rectangle_corners to center_axis-
_radii, there's a round-off error, you lose a 1/2 pixel off the length of the
radii, which is equal to a full pixel for the diameters.

I know this doesn't solve your problem, but hopefully it clarifies what causes
the problem.

Everett Kaser                   Hewlett-Packard Company
...hplabs!hp-pcd!everett        work: (503) 750-3569   Corvallis, Oregon
everett%hpcvra@hplabs.hp.com    home: (503) 928-5259   Albany, Oregon
Technical Details
Message-ID: <31600002@hpcvra.CV.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!sdd.hp.com!hp-pcd!hpcvra!everett
References: <2161@krafla.rhi.hi.is>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!sdd.hp.com!hp-pcd!hpcvra!everett
From: everett@hpcvra.CV.HP.COM (Everett Kaser)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Bug in MSC 6.0 ?
Message-ID: <31600002@hpcvra.CV.HP.COM>
Date: 13 Sep 90 14:37:03 GMT
References: <2161@krafla.rhi.hi.is>
Organization: Hewlett-Packard Co., Corvallis, OR, USA
Lines: 35