[comp.windows.x] Simple speed ups

RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (07/11/88)

    Date: 10 Jul 88 07:14:26 GMT
    From: ubvax!vsi1!daver!athsys!stergios@AMES.ARC.NASA.GOV  (Stergios Marinopoulos)

    Now I'm usually not to picky, but after seeing this type of code in my
    first look into the mi section I  start to wonder just  how many other
    occurances of  special  "algorithms" there are  when a simple operator
    whould do (in this case modulus seems well suited).

Perhaps it's too early in the morning, but at least on my Sun 3/60, it
is faster to do the compare and branch (and do nothing) than it is to
take a modulus, when the magnitude of the angle is less than FULLCIRCLE
(which it almost always will be).  It is also faster to do the single
addition and compare and branch again than it is to take a modulus, when
the magnitude is less than 2*FULLCIRCLE.  So, the "optimization" you
suggest may not be an optimization on all hardware all of the time.

	  Any way, I thought I would mention that if any one is interested
    in this approach, they they should check out MetaFont which allows this
    type of pen, heck I think it even supports pens described by splines!

The problem with polygonal pens is not how to implement the algorithms,
but how to choose the pens.  Choosing the "best" polygon for a given
line width appears to still be a very active area of research.  In terms
of trying to define a deterministic standard for wide lines, doing so
with a polygonal pen specification still seems premature.