home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / windows / x / 15165 < prev    next >
Encoding:
Text File  |  1992-08-12  |  2.1 KB  |  51 lines

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!mnemosyne.cs.du.edu!nyx!rheithof
  3. From: rheithof@nyx.cs.du.edu (Russell Heithoff)
  4. Subject: drawarc algorithm
  5. Message-ID: <1992Aug12.202515.17072@mnemosyne.cs.du.edu>
  6. Sender: usenet@mnemosyne.cs.du.edu (netnews admin account)
  7. Organization: Nyx, Public Access Unix (sponsored by U. of Denver Math/CS dept.)
  8. Disclaimer1: Nyx is a public access Unix system run by the University of
  9. Disclaimer2: Denver for the Denver community.  The University has neither
  10. Disclaimer3: control over nor responsibility for the opinions of users.
  11. Date: Wed, 12 Aug 92 20:25:15 GMT
  12. Lines: 37
  13.  
  14. In the Xlib Reference Manual, the description for XDrawArc states:
  15.  
  16.  
  17.     "Angles are computed based solely on the coordinte
  18.      system and ignore the aspect ratio.  In other words,
  19.      if the bounding rectangle of the arc is not square
  20.      and angle1 is zero and angle2 is (45x64) (i.e. 45
  21.      degrees), a line drawn from the center of the bounding
  22.      box through the endpoint of the arc will not pass
  23.      through the corner of the rectangle".
  24.  
  25. This statement might address my problem, but if so, I'm not sure how.  The
  26. problem becomes evident in the following sequence of events:
  27.  
  28.     1 - Calculate the angle from the horizontal to a line defined
  29.         by the center of the bounding box to some arbitrary point.
  30.         The angle is measured in a counter clockwise direction.
  31.         Call this a2.
  32.  
  33.     2 - Draw the line described in step one.  The length of the line
  34.         is should be very long.
  35.  
  36.     3 - Use XDrawArc to draw an arc using the same bounding box 
  37.         mentioned in step one, zero as angle1 and the angle
  38.         calculated in step one (i.e. a2) as angle 2.
  39.  
  40. The problem now becomes evident.  The end of the arc does not meet the
  41. line.  (Its not due to the line length).
  42.  
  43. I would like to know what angle should be specified to get the arc to 
  44. meet the line.  The problem disipates as the arc approaches multiples of
  45. 90 degrees and is at its worst at (multiples of 90) - 45 degrees.
  46.  
  47. I am developing a graphical editor and determining the end points of
  48. arcs is an absolute necessity.  Any help would be greatly appreciated.
  49.  
  50. 270 
  51.