|
|
Orchid XP v8 <voi### [at] devnull> wrote:
> On 20/08/2011 11:30 AM, clipka wrote:
> > Am 20.08.2011 11:34, schrieb Orchid XP v8:
> >
> >> I can still remember everybody laughing when he said that our assignment
> >> was to write a program to draw a straight line. But *you* try doing that
> >> with only integer arithmetic. It's surprisingly nontrivial.
> >
> > ... but can be accomplished by surprisingly elegant and (comparatively)
> > fast code in Assembler. (What surprised me even more was to see how a
> > similarly elegant and efficient algorithm could draw a circle. No
> > trigonometrics, not even a radix, just plain Assembler commands you'd
> > find on a Z80 processor.)
> The circle is the locus of all points equidistant from the centre. It's
> not especially hard to do that with simple integer arithmetic.
Doing it *fast* is not all that trivial.
Also, don't confuse the length of the implementation with its complexity.
A fast circle drawing algorithm using integer math only (and only additions
and subtractions at that, no multiplications or divisions) is a relatively
short algorithm in terms of lines of code, but *understanding* it is a bit
more difficult. (Coming up with it on your own is even more difficult, but
not impossible, if you think about it long enough.)
--
- Warp
Post a reply to this message
|
|