lookirex.blogg.se

Koch snowflake actionscript vector code
Koch snowflake actionscript vector code




koch snowflake actionscript vector code
  1. #Koch snowflake actionscript vector code how to
  2. #Koch snowflake actionscript vector code code

I'm not super familiar with SVG, so I don't know what the preferred method is for viewing those files (especially when they're really big). IrfanView seems to work decently if you have the right plugins. some number n that's 2 or greater, then it is expanded on the stack to n-1, -1, n-1, 0, n-1, -1, n-1.įor n = 10, this process takes a very long time (a couple of minutes on my system), and the resulting SVG is ~10MB in size and invisible when viewed in the browser because you can't adjust the size of the brush using TURT.1, it moves forward (by 15 pixels here, but you can change it by modifying the f on the last line).-1, the turtle turns counterclockwise 60 degrees.On each pass, if the top number on the stack is: I know, right?īasically, this works by using the stack as a sort of makeshift L-system and expanding it on the fly. There has to be a newline at the end for CCBI to run it without hanging (this is included with the character count).Maybe someday there will be a better interpreter out there that has a graphical display for the turtle, but for now. This is the closest I could come to "print a graphical representation of the snowflake to the screen" with available Funge interpreters I could find. If you run this in CCBI without the command-argument -turt-line=PATH, it will come out as a file named CCBI_TURT.svg by default. I tested this using CCBI 2.1, whose implementation of TURT (the turtle graphics fingerprint) makes I "print" the image to a SVG file.

#Koch snowflake actionscript vector code code

>j$ space makes me get some implementation details out of the way first: Code Issues Pull requests Computer Graphics Project 1 opengl graphics koch-snowflake Updated on C++ grypesc / KochFractals Star 1 Code Issues Pull requests Low level combination of C and x86/圆4 assembly code that turns a curve entered by the user into a Kochs fractal. Now, only recently, I figured out a way to do it without using self-modification! And so.

#Koch snowflake actionscript vector code how to

I knew I'd want to try implementing this in Befunge-98 using TURT, but I couldn't figure out how to go about it and I sat on it for several months. Take a triangle (magenta in this case) and overplot with 6 triangles 1/3 of the base. The colours are just for fun and to show the way it is constructed. This answer was inspired by xnor's comment. IFa FORj=-1TO1 FORi=-1TO1:z=FNt(x+24*a*i,y+j*14*a*(i*i*3-2),i,j,-j*a/3):NEXT:NEXTĪccording to the OP's answer to filled in snowflakes are OK. REM i loops through the three triangles of each orientation, from left to right. REM j determines if the triangle will be upright, inverted or (if j=0) infinitely small. REM if the absolute magnitude of a is sufficient to be truthy, recurse to the next level. REM using the specified point (top of the triangle) and the last two points visited (those used to draw the line.) REM first draw a line at the bottom of the triangle. You must print a graphical representation of the snowflake to the screen. REM loop variables i,j are only passed in order to make them local, not global. REM call function and throw return value away to z

koch snowflake actionscript vector code

Not a winner, despite the fact that doing it ths way avoids the need for a special treament for n=1. Gone for the approach of starting with the three initial edges, then recursing through each edge and replacing them with 4 edges for each level. If (!gl) else if (script.Even though this will never be a contender, I had to see if I could get it done in T-SQL. I have the following WebGL code which draws a triangle: "use strict" Ĭanvas = document.getElementById("gl-canvas")






Koch snowflake actionscript vector code