home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!bcstec!aw108!gcr8829
- From: gcr8829@aw2.fsl.ca.boeing.com (Gustav C. Rettke)
- Newsgroups: comp.programming
- Subject: Re: Help - Contour drawing algorithm needed
- Message-ID: <1992Aug27.210308.9621@aw2.fsl.ca.boeing.com>
- Date: 27 Aug 92 21:03:08 GMT
- References: <1992Aug25.165307.21995@tamsun.tamu.edu>
- Organization: fsl
- Lines: 69
-
- From article <1992Aug25.165307.21995@tamsun.tamu.edu>, by tpradeep@cs.tamu.edu (Pradeep K Tapadiya):
- >
- > Howdy netters,
- >
- > Given a set of (x,y,t) points where (x,y) represent the cooridinate and
- > (t) represents the associated temperature, I need to draw temperature
- > contours over a specified region. Can someone suggest me an algorithm
- > to do this, or refer me to the right book(s).
- >
- > Thank you for your help.
- >
- > Pradeep
- > tpradeep@cs.tamu.edu
-
- Here's a simple alogrithm:
-
- For y = y1 to y2
-
- For x = x1 to x2
-
- Calculate t
-
- Set xplot = x
-
- Set yplot = t + k * y
-
- Plot xplot, yplot
-
- Next x
-
- Next y
-
- Where k is an obliqueness factor.
-
- This will produce a view as if you were standing above the x,y-plane. The
- factor k affects the degree of above (or below) the plane. Play with k to get
- a good perspective.
-
- Another enhancement might be to connect line segments to produce 'lines of
- constant x'. Here's the algorithm with the slight modifications.
-
- For y = y1 to y2
-
- For x = x1 to x2-1
-
- Calculate t1 @ x
-
- Calculate t2 @ x+1
-
- Set xp1 = x
-
- Set xp2 = x+1
-
- Set yp1 = t1 + k * y
-
- Set yp2 = t2 + k * y
-
- Line xp1, yp1 to xp2, yp2
-
- Next x
-
- Next y
-
- Of course you will have to massage the scaling and resolution.
-
- Hope this helps.
-
-
- G Rettke
-