3D Snowflake
It is Christmas season, and it is deadly hot in Brisbane today (29 December 2023) at 39 degrees celsius in the southern hemisphere. I miss and wonder a snowy Christmas in norther hemisphere could be like. Perhaps making a snowflake could cool down my mind. It is also after about 2 years that I have not blogged in this VRMath2 website.
I borrowed some traditional 2D Logo code, with 4 iterations to collect points, then with VRMath2 editor's extrusion command, I could turn the 2D snowfalke fractal into a 3D version. See below the 3D snowflake.
The 3D Logo codes are provided below.
; Koch's Snowflake with Extrusion by Andy ; code modified from <a href="http://logo.twentygototen.org/_REo_2F2 cs" title="http://logo.twentygototen.org/_REo_2F2 cs">http://logo.twentygototen.org/_REo_2F2 cs</a> RESET MAKE "cs [ 0 0 ] TO side :count :length IFELSE :count = 1 [FD :length QUEUE "cs XCOR QUEUE "cs ZCOR] [ MAKE "count :count - 1 side :count :length LT 60 side :count :length RT 120 side :count :length LT 60 side :count :length ] END TO koch :count :length RT 30 side :count :length RT 120 side :count :length RT 120 side :count :length END ; 4 iterations ; you may change the 4 from 1 to 5, if more than 5, it will take a while to generate. CLEARTEXT PRINT [Start snowflaking ....] MAKE "t1 GETTIME ; change the depth of recursion to test koch 4 1 (PRINT [crossSection completed in:] GETTIME - :t1 "milliseconds.) EXTRUSION MAKE "obj WORD OBJECT "_extrusion MAKE "tl GETTIME SET :obj "spine [0 0 0 0 1 0] SET :obj "scale [1 1] SET :obj "crossSection :cs (PRINT [EXTRUSION completed in:] GETTIME - :t1 "milliseconds.) SHOWALL
Please leave a comment below about how you think.
Files: Kock_snowflake_extrusion.logo | 3D_snowflake.x3d
- Andy's blog
- Login or register to post comments
- 1887 reads