home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / programm / 2517 < prev    next >
Encoding:
Internet Message Format  |  1992-08-27  |  1.7 KB

  1. Path: sparky!uunet!bcstec!aw108!gcr8829
  2. From: gcr8829@aw2.fsl.ca.boeing.com (Gustav C. Rettke)
  3. Newsgroups: comp.programming
  4. Subject: Re: Help - Contour drawing algorithm needed
  5. Message-ID: <1992Aug27.210308.9621@aw2.fsl.ca.boeing.com>
  6. Date: 27 Aug 92 21:03:08 GMT
  7. References: <1992Aug25.165307.21995@tamsun.tamu.edu>
  8. Organization: fsl
  9. Lines: 69
  10.  
  11. From article <1992Aug25.165307.21995@tamsun.tamu.edu>, by tpradeep@cs.tamu.edu (Pradeep K Tapadiya):
  12. > Howdy netters,
  13. > Given a set of (x,y,t) points where (x,y) represent the cooridinate and
  14. > (t) represents the associated temperature, I need to draw temperature
  15. > contours over a specified region. Can someone suggest me an algorithm
  16. > to do this, or refer me to the right book(s).
  17. > Thank you for your help.
  18. > Pradeep
  19. > tpradeep@cs.tamu.edu
  20.  
  21. Here's a simple alogrithm:
  22.  
  23.     For y = y1 to y2
  24.  
  25.       For x = x1 to x2
  26.  
  27.         Calculate t
  28.  
  29.         Set xplot = x
  30.  
  31.         Set yplot = t + k * y
  32.  
  33.         Plot xplot, yplot
  34.  
  35.           Next x
  36.  
  37.         Next y
  38.  
  39. Where k is an obliqueness factor.
  40.  
  41. This will produce a view as if you were standing above the x,y-plane.  The
  42. factor k affects the degree of above (or below) the plane.  Play with k to get
  43. a good perspective.
  44.  
  45. Another enhancement might be to connect line segments to produce 'lines of
  46. constant x'.  Here's the algorithm with the slight modifications.
  47.  
  48.     For y = y1 to y2
  49.  
  50.       For x = x1 to x2-1
  51.  
  52.         Calculate t1 @ x
  53.  
  54.             Calculate t2 @ x+1
  55.  
  56.         Set xp1 = x
  57.  
  58.         Set xp2 = x+1
  59.  
  60.         Set yp1 = t1 + k * y
  61.  
  62.             Set yp2 = t2 + k * y
  63.  
  64.         Line   xp1, yp1   to   xp2, yp2
  65.  
  66.           Next x
  67.  
  68.         Next y
  69.  
  70. Of course you will have to massage the scaling and resolution.
  71.  
  72. Hope this helps.
  73.  
  74.  
  75. G Rettke
  76.