home .. forth .. colorforth mail list archive ..

[ColorForth] Circle Primitive, happy for response


Hello,

Here is my take. It was easier to just write this since yours was
untested, and there were some misunderstandings of the colorForth
vocabulary. However it uses the ideas of your implementation, and the
bresenham algorithm from a book of mine.

circle takes (radius x y color), though it might be better though to use
the colorForth words 'at' and 'color', to define the position and color, 
to fit in with the other drawing functions. Just thought of this now.

Mark

( Circle ) empt macro
: 2! [a!] 28966 3, [drop] ; forth variable b variable c variable d 
variable de variable se 
: point2 1024 * over negate + 2* b @ + c @ over 2! swap 4 * + c @ swap 
2! ;
: 2over over over ;
: points 2over point2 2over negate point2 2over swap 2over negate point2
point2 ;
: d? d @ 0 less drop if de @ + d ! 2 de +! 2 se +! ; then se @ + d ! 2 de
+! 4 se +! -1 + ;
: circle c ! 1024 * + 2* 1e80000 + b ! 0 swap points dup - 2 + d ! dup -2
* 5 + se ! 3 de !
: n less if d? points 1 u+ n ; then drop drop ;
: ok show black screen 100 400 400 ffff circle keyboard ;
------------------------

To Unsubscribe from this list, send mail to Mdaemon@xxxxxxxxxxxxxxxxxx with:
unsubscribe ColorForth
as the first and only line within the message body
Problems   -   List-Admin@xxxxxxxxxxxxxxxxxx
Main ColorForth site   -   http://www.colorforth.com