From: rusin@vesuvius.math.niu.edu (Dave Rusin) Newsgroups: comp.graphics.algorithms Subject: Re: start/end-pixels of circle arcs without sin/cos? Date: 28 Aug 1996 21:45:40 GMT In article <5018ca$ak@fstgal00.tu-graz.ac.at>, Mark Piffer wrote: >A friend of mine needs to draw circle arcs at a given radius from >degree x to y. Problem is, that he can't use sin() and cos() You can parameterize a circle of radius 1 at the origin as the set of points of the form ( (2t)/(1+t^2), (1-t^2)/(1+t^2) ) where t ranges over all real numbers. Obviously this can be scaled and translated to parameterize other circles. One can restrict the ranges of t to obtain circular arcs. (Given the cartesian coordinates of the arc's endpoints, you can determine their corresponding parameters t by solving one of several quadratic equations.) This parameterization covers the region near (-1,0) very slowly (that is, one needs to take t --> oo or t --> -oo to approach (-1,0). ) If you prefer, you may compose this parameterization with one which traverses (most of) the whole real line in only a finite amount of time, such as taking t:= {u, if -1 < u < 1; 1/(2-u), if 1 < u < 2; 1/(2+u), if -2 < u < -1 }. (Another possibility in the preceding paragraph is to take t = tan(u/2), of course :-) ) It's computationally faster, I suppose, to use an iterative computation to march along a circle at constant speed: circular motion has acceleration parallel to displacement from the center, so one updates the position with a velocity vector, which in turn is updated proportional to the position. But of course such a recursive procedure allows for the potential of accumulation of errors. dave