🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #24273

Re: Help! My arc has fallen, and it can't get up!

#24273
From: Joshua Osborne
Date: Mon, 01 Jul 1991 01:25
77 lines
3783 bytes
In article <1991Jun30.214203.5882@thunder.mcrcim.mcgill.edu> mouse@thunder.mcrcim.mcgill.edu (der Mouse) writes:

Since the (only) answer I got was posted to the net, and correct there will
be no summary.  If the question intrested you read 
<1991Jun30.214203.5882@thunder.mcrcim.mcgill.edu>.

>In article <1991Jun28.062319.11565@eng.umd.edu>, stripes@eng.umd.edu (Joshua Osborne) writes:
>
>> I am trying to draw the outline of a pie wedge.  I (think I) am using
>> the formula from the Digital Press "X Windows System, C Library and
>> protocall reference" by Scheifler, Gettys & Newman.
>
>I assume this is the same one that appears in the online Xlib
>documentation:

Yes.

[...]
>There is one other thing wrong: you forgot that you need to write
>
>	pts[0].y = pts[1].y - xa->height/2 * s;
>
>and similarly for pts[2].y, because the angles are measured in a
>mathematician's coordinate system on the screen, but the y coordinate
>to XDrawLines is measured in a graphics coordinate system - and the y
>axes go in opposite directions.

Ahh!  That was my problem all along (before I even tried the skew-angle
thing...).

>Note that you really should be dividing width and height by 2.0,
>because you could lose a pixel in integer division roundoff with what
>you have.

Mmmm, taken under advisement.  What order does ANSI say promotion is done
for INT/INT*FLOAT?  (INT/INT) to FLOAT, or INT/INT*FLOAT to INT/FLOAT*FLOAT
to FLOAT/FLOAT*FLOAT?  Who cares, I changed 'em all to 2.0.

>> I compiled the program, ran it, and it failed.  Miserably.  It's
>> output was hideous.  Women fainted.  Small children ran away.
>
>:-)

Oh, you laugh!  I bet you wouldn't if you had seen it!

>> Worst of all, the lines that should have connected the arc endpoints
>> had very little to do with the arc endpoints.

>I suspect you may have forgotten to #include something crucial.  My
>first attempt had similar problems, but once I remembered to #include
><math.h> they went away, and I had only the above two problems.

My trig is rusty, not my C.  I had #inc'ed math.h.  I guess I should have
included that in my example 'tho.

>(Eliminating the tan and atan calls in ella removes the need for
>math.h, except that I changed the #defines to use M_PI instead of
>3.14159.)

Hmmm, M_PI.  This is what I get for assuming hand-me-down code does things
right...

Thanks for the help.  The code works now, and as a direct result I've been
promoted, have won the lottery, am constantly hounded by fabulous babes,
and my shirts come back from the laundry whiter than ever.  You win my
infinate gratitude, half the lotto money, second pick of the babes, and
all the cold pizza left in my fridge by the time you come to get your lotto
money (you remember how to get here, right?).

(P.S. the previous paragraph was partly ripped off from Don Hosek, from a
comp.text.tex post)
-- 
           stripes@eng.umd.edu          "Security for Unix is like
      Josh_Osborne@Real_World,The          Multitasking for MS-DOS"
      "The dyslexic porgramer"                  - Kevin Lockwood
"CNN is the only nuclear capable news network..."
    - lbruck@eng.umd.edu (Lewis Bruck)
Technical Details
Message-ID: <1991Jul01.012523.26664@eng.umd.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!ucsd!pacbell.com!ames!haven.umd.edu!mimsy!mojo.eng.umd.edu!stripes
References: <1991Jun28.062319.11565@eng.umd.edu> <1991Jun30.214203.5882@thunder.mcrcim.mcgill.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!ucsd!pacbell.com!ames!haven.umd.edu!mimsy!mojo.eng.umd.edu!stripes
From: stripes@eng.umd.edu (Joshua Osborne)
Newsgroups: comp.windows.x
Subject: Re: Help!  My arc has fallen, and it can't get up!
Summary: Ignore the skewed-angle
Message-ID: <1991Jul01.012523.26664@eng.umd.edu>
Date: 1 Jul 91 01:25:23 GMT
References: <1991Jun28.062319.11565@eng.umd.edu> <1991Jun30.214203.5882@thunder.mcrcim.mcgill.edu>
Organization: College of Engineering, Maryversity of Uniland, College Park
Lines: 77