Bryan, As Andy pointed out, Bresenham's may be a good solution if what you want to do is plot points on a grid. If, on the other hand, you want to create a vector which is rotating at a constant velocity (think of a point moving in a circle around the circle's center), a "sum of angles" approach may be helpful. The general idea is to decide what size you want your angular steps to be. Precalculate the sin and cos of that angle, call them sin(b) and cos(b). Note that this only needs to be done once. Define the radius of your circle, call that R*cos(a),in this case it's easiest to let 'a' equal zero so cos(a) equals 1. Since 'a' equals zero, R*sin(a) also equals zero. Iteratively apply the sin and cos rules for sum of angles. sin(x+y) = sin(x)*cos(y) + cos(x)*sin(y) cos(x+y) = cos(x)*cos(y) - sin(x)*sin(y) or in our case, R*sin(a2) = R*sin(a1+b) = [R*sin(a1)]*cos(b) + [R*cos(a1)]*sin(b) R*cos(a2) = R*cos(a1+b) = [R*cos(a1)]*cos(b) - [R*sin(a1)]*sin(b) Notice that after the initial determination of sin(b) and cos(b) where 'b' is the angle of rotation, no further determination of sines or cosines need take place. Additionally, no square roots and, no divisions, just four 'simple' 24 bit by 24 bit signed multiplies and, a pair of 24 bit adds per iteration. Of course you will have to translate the circle center point to its intended location but that's just another pair of additions. I hope this helps. Regards, Dave Bryan Mumford wrote: > Dave- > > I wanted to perform trig functions on integers in the range of +/- > 1,000,000. I figured I would represent these numbers with three > bytes. But what I really want is to plot circles, and I'm now > thinking that x^2 + y^2 = r^2 will be much faster. I'd like to get > each answer in less than 100 microseconds, and the CCS C compiler is > much too slow. > > I'm on the trail of square root functions in the piclist archives, > but they use non-standard mnemonics and my initial conversions don't > give me correct answers. > > Seems like there's always one more obstacle.... -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body