ZX Pilot #34
20 июля 1999

Coding - Super-puper-fast algorithm for constructing circles and circles, the rapid division of 16/16, the square root of the register pair, the square root of three-byte number; protsedurka calculate addresses attribute to the coordinates of familiarity.

<b>Coding</b> - Super-puper-fast algorithm for constructing
circles and circles, the rapid division of 16/16, the square root of the register pair, the square root of three-byte number; protsedurka calculate addresses attribute to the coordinates of familiarity.
                C O D I N G



(C) VIRTUAL



   Super-puper-fast algorithm for constructing
circles and circles by Virtual / BrainWave
of X-Project Association.

   Circle can be constructed using the sinuses. However, it 
will either create huge tables of sines of different 
amplitudes, or enjoy the strong brakes, multiplying every step 
of the construction the sine in the radius of the circle. But

is the opposite of what will inevitably be
appearing intervals between points. Especially it will be 
evident in circles with large radii. In constructing the same 
small circles, some points will be displayed several times in 
the same a place that is not very convenient when building

circles of xor.

   Another way - use the equation
the circle x ^ 2 + y ^ 2 = r ^ 2. However, the calculation
at every step of the squares and roots - pretty thankless job.

   Now it's time for my superpuper method. It's time to unveil
This algorithm, which I so much cherished
I invented it in 11th grade (I am now
finished 1 course). It is based also on the equation of a 
circle, but it requires a 3d-accelerator Blizzard on Power PC 
(Joke). In my method, not used fractional numbers, or squaring 
or extraction of square roots.


   So, here we go:

   Circle, as it were divided into 8 sectors of 45 degrees, ie 
for each pass is put on the screen for 8 points. Here he 
algorithm for calculation: 


    1. Put 4 points - lower, upper,
left and right at a distance radius from the
center.

    2. y = radius

    3. x = 1

    4. counter = radius-1. I have used as a counter hl.

    5. subber = 1. I've used as a
subber register-pair de.

    6. adder = radius * 2. As I adder
yuzal bc.

    7. loop:

    8. subber = subber-2

    9. counter = counter + subber

   10. if carry then goto 14

       else

       {

   11. adder = adder-2

   12. counter = counter + adder

   13. y = y-1

       }

   14. Type 8 points with coordinates relative to the center of 
a circle: 

       (+ X, + y)

       (+ X,-y)

       (-X, + y)

       (-X,-y)

       (+ Y, + x)

       (+ Y,-x)

       (-Y, + x)

       (-Y,-x)

   15. x = x +1

   16. if x +1 




Other articles:

News - News from the spektrumistov of Kovrov.

Demopati - Photo CHAOS CONSTRUCTIONS'99 demo party.

Amiga - Answers to frequently asked questions about the Amiga soft'e.

Coding - Super-puper-fast algorithm for constructing circles and circles, the rapid division of 16/16, the square root of the register pair, the square root of three-byte number; protsedurka calculate addresses attribute to the coordinates of familiarity.

Census action - A new version of the list of nicknames Spectrum, numbering about five and a half hundreds of items.

Hints - a few cheats. How to work with the shadow on the monitor Scorpion 256.

about different - Destiny ZX-SPECTRUM, or notes of the old lamer. How not to die Spectrum.

DIY - panels of various UDG characters.

Form - subscribe to the newspaper ZX-Pilot.

Advertising - advertising and announcements.

Credits - the creators of the newspaper.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Graphics - Image ANSI graphics.

В этот день...   21 November