Live data from Hacker News

Drawing a circle, point-by-point, without floating point support

yurichev.com

1–10 of 42 posts

Re: Drawing a circle, point-by-point, without floating point support

#4
post #3

> It requires only additions, subtractions and bit shifts: 2x is the same as x Does any of this mean anything in JS, where AFAIK there are no real ints? 2x is an fpu operation under the hood, and not a bit shift.

I guess JS is only used as a tool to demonstrate the algorithm.

Re: Drawing a circle, point-by-point, without floating point support

#7
post #5

You can always try Bresenham’s circle drawing algorithm.

This is the era where prior art doesn't exist. Why read a book when you can blog about discovering "something new". I could probably make a killing blogging about my "discovery" of the algorithms in the book "Hacker's Delight".

Re: Drawing a circle, point-by-point, without floating point support

#8
post #5

You can always try Bresenham’s circle drawing algorithm.

Back in the '80s in Bulgaria, I was only able to find the Bresenham's algorithm for circles, but needed to draw an ellipse (in 6052 assembly, well, machine code), and was so proud that I manage to do it.

Re: Drawing a circle, point-by-point, without floating point support

#10
post #3

> It requires only additions, subtractions and bit shifts: 2x is the same as x Does any of this mean anything in JS, where AFAIK there are no real ints? 2x is an fpu operation under the hood, and not a bit shift.

I think, using the `(…) | 0` (expression binary ORed with zero) construct most JS engines will use true integers in optimized code.
Post reply on HN