Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!eos!shelby!polya!rokicki From: rokicki@polya.Stanford.EDU (Tomas G. Rokicki) Newsgroups: comp.sys.amiga Subject: Re: Dmouse 1.20 and DLineArt Keywords: neat stuff! Message-ID: <11542@polya.Stanford.EDU> Date: 25 Aug 89 23:31:17 GMT References: <1451@esunix.UUCP> <123627@sun.Eng.Sun.COM> Sender: Tomas G. Rokicki Organization: Stanford University Lines: 33 raz%kilowatt@Sun.COM (Steve -Raz- Berry) writes: > >Steve, you really ought to see your lineart run on a 68020, it goes nuts! > >The Elipse moves along at a moderate pace, but the others are hyperactive. > If I can figure out how to generate ellipses with splines, they will cruise > along nicely too. Two ways to do ellipses with splines, the first is faster but less accurate, the second is slower but more accurate. In both, the spline is centered at (x,y) with x-axis a and y-axis b. First method: two splines, they are [(x-a, y), (x-a, y-4b/3), (x+a, y-4b/3), (x+a, y)] [(x-a, y), (x-a, y+4b/3), (x+a, y+4b/3), (x+a, y)] This isn't exactly an ellipse, but is probably close enough for most people. Please, round the 4b/3 terms *towards* the center of the screen, or the extrema may go off the screen. Also, reverse the second so that it gets drawn clockwise instead of in halves from left to right. Second method, four splines, they are: [(x-a, y), (x-a, y+cb), (x-ca, y+b), (x, y+b)] [(x, y+b), (x+ca, y+b), (x+a, y+cb), (x+a, y)] [(x+a, y), (x+a, y-cb), (x+ca, y-b), (x, y-b)] [(x, y-b), (x-ca, y-b), (x-a, y-cb), (x-a, y)] in all of these, c=4(sqrt(2)-1)/3 or something like 0.55. This is highly accurate, off less than r/3600 at the worst point. You should check out the latest mackie (Radical Eye Radio, (415) 32-RADIO) and see how it generates a random set of patterns . . . also make *sure* that the spline code is the version in the latest mackie; the old version would hang if the four points happened to be coincident . . . -tom