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

[ColorForth] Circle Primitive, happy for response


Nice algorithm. Ok, here is the updated source. Achieved a %10 improvement
in speed, and is much simpler overall. I was also able to use '-if' and
'-', words I probably underuse. Got rid of the 'c' variable, didn't know
that was kernel word (it clears the stack).

Mark

( Circle ) empt macro
: 2! [a!] 28966 3, [drop] ; forth variable b variable p variable d
: 2over over over ;
: point4 4096 * swap 4 * 2over + 2/ negate b @ + p @ over 2! over push + p
@ over 2! + p @ over 2! pop negate + p @ swap 2! ;
: points 2over point4 2over swap point4 ;
: d? d @ -1 ? drop -if ; then dup - d +! -1 + ;
: circle p ! 1024 * + 2* 1e80000 + b ! 0 swap dup negate d !
: n less if points 1 u+ over d +! d? n ; then points 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