Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!ames!haven!decuac!shlump.nac.dec.com!epik.enet.dec.com!p_davis From: p_davis@epik.enet.dec.com (Peter Davis) Newsgroups: comp.windows.x Subject: Re: HELP: need to draw curve through points Message-ID: <18695@shlump.nac.dec.com> Date: 4 Jan 91 17:10:38 GMT Sender: newsdaemon@shlump.nac.dec.com Organization: Digital Equipment Corporation Lines: 25 In article <340@coatimundi.cs.arizona.edu>, slm@cs.arizona.edu (Sandy Miller) writes... >I'm looking for an algorithm that will allow me to draw a smooth >curve through a set of points input by a user. The points may be >anywhere within a window (i.e. not limited to increasing x values). >Has anybody seen/done something like this? I would appreciate any >and all help. > You'll have to solve this in two parts. First, you have to find a smooth curve through (or near) the input points. There are a number of published algorithms for doing this. One is Philip Schneider's, as published in _Graphics Gems_, (ed. by Andrew Glassner, Academic Press, 1990). The second step is to figure out how to draw curves in X, since X doesn't have curve drawing operations. You basically have to approximate the curve by a polygon, and draw the individual line segments. Again, there are a number of published techniques for doing this. You could check "the Bible": _Computer Graphics: Principles and Practice_ by Foley, van Dam, Feiner, and Hughes (Addison Wesley, 1990). There's also a book around called something like _Constructing Computer Graphics Software_ which has a pretty good, simple algorithm. I forget the author and publisher, but you should be able to find it. -pd