3 ms·
The pair of equations can be expressed succinctly as y -= x >> 4; x += y >> 4; and is basically a very rough approximation of a step in the CORDIC[1]
by userbinator 9y ago
The pair of equations can be expressed succinctly as
y -= x >> 4;
x += y >> 4;
and is basically a very rough approximation of a step in the CORDIC[1] algorithm, which computes the sin and cos of an angle by rotating a vector; it's then quite natural that successive rotations would trace out an approximation to a circle.
As such, many of the first programs of the PDP-1 were “Display hacks”: Programs using only a few lines of code, but when run, create intricate patterns on the screen.
The demoscene has carried on that tradition, and in particular the sub-512b categories produce very interesting graphics from tiny programs.
[1] https://en.wikipedia.org/wiki/CORDIC https://en.wikipedia.org/wiki/CORDIC
- goialoq 9y agoand this formula is simply an expression of the fact that given a circle: x = sin t , y = cos t the derivative is d(sin t) = (cos t) dt , d(cos t) = -(sin t) st so it's interesting that it was "stumbled" upon.
- deleted 9y ago[deleted]