1. Simple turtle graphics
- Posted by petelomax Aug 08, 2021
- 997 views
- Last edited Aug 23, 2021
I put another demo online: http://phix.x10.mx/p2js/simpleturtlegraphics.htm
(corresponding to https://rosettacode.org/wiki/Simple_turtle_graphics#Phix)
If anyone has any ideas about how to resize the canvas like it does on the desktop, let me know. (solved 23/8/21)
2. Re: Simple turtle graphics
- Posted by Icy_Viking Aug 08, 2021
- 997 views
I put another demo online: http://phix.x10.mx/p2js/simpleturtlegraphics.htm
(corresponding to https://rosettacode.org/wiki/Simple_turtle_graphics#Phix)
If anyone has any ideas about how to resize the canvas like it does on the desktop, let me know.
That's pretty neat. I thought about writing an updated Tutle wrapper for Euphoria.
3. Re: Simple turtle graphics
- Posted by Spock Aug 09, 2021
- 950 views
I put another demo online: http://phix.x10.mx/p2js/simpleturtlegraphics.htm
(corresponding to https://rosettacode.org/wiki/Simple_turtle_graphics#Phix)
If anyone has any ideas about how to resize the canvas like it does on the desktop, let me know.
That's pretty neat. I thought about writing an updated Turtle wrapper for Euphoria.
I think turtle graphics are a vastly under-utilised concept. I wrote my own turtle-like language which I use to generate the text labels on 'HotButtons' for my ORAC programs.
The basic vector commands are scaled by a user-controlled factor. Also, the drawing point (normally a 1x1 pixel block) can be changed to better suit any large scaling factors.
I had plans to develop a pixel-perfect integer-scaled font system but just never got around to finishing it [as suggested by the mildly imperfect example]. If your main goal in a text label is functionality why bother with umpteen different font styles and having to drag along a whole bunch of complicated bezier curves and spline rendering code to make it all happen? Here are some sample definitions [they use shortcuts added to the original turtle commands]:
new( "A : s03 r24 s02 s11 s22 s31 s45") new( "B : r22 s03 r22 s03 s22 s31 s41 s51 s31 s41 s51 j21" ) new( "C : j24 j01 s51 s62 s71 s04 s11 s22 s31 j45" ) ..
Each leading 'word' could be considered the label of a subroutine. They may be interspersed with native commands to leverage existing primitive shapes. Eg, "m : n n" would [more-or-less] render m and "theta : O j65 -" would render ÆŸ whereever 'theta' was invoked etc. There are some conventions to follow and a few limitations but the result is highly functional for my purposes.
Spock