Path: utzoo!attcan!uunet!dg!mpogue From: mpogue@dg.dg.com (Mike Pogue) Newsgroups: comp.graphics Subject: Re: How does pr_vector() work ? Message-ID: <343@dg.dg.com> Date: 13 Mar 90 15:13:51 GMT References: <1990Feb25.222157.26389@allgfx.agi.oz> <38280@cornell.UUCP> Reply-To: uunet!dg!mpogue (Mike Pogue) Organization: Data General, Westboro, MA. Lines: 22 In article <38280@cornell.UUCP> klassen@gvax.cs.cornell.edu (R. Victor Klassen) writes: >In article <1990Feb25.222157.26389@allgfx.agi.oz> shn@allgfx.agi.oz (Si-Hanh NGUYEN) writes: >> >>Does anybody know the detailed algorithm used in pr_vector() of Sun Pixrect ? >>The manual says that "pr_vector draws balanced vectors. (The technique used >>is to balance the Breshenham error term)". >> > Note that a very simple way to "balance" the error term involves reversing the end points before feeding them to Bresenham's algorithm, when the vector is in one of 4 octants (it doesn't matter which 4). This will guarantee that (A,B) = (B,A), and avoids writing code for 8 octants (and the associated balancing required). The disadvantage is that the line is drawn "backwards" in those 4 octants. Is this a problem? In my experience, since only one line is drawn at a time, no. Mike Pogue Data General Speaking for myself, not my company....