Koch curve: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 75: Line 75:
[[Category:Turtle Graphics]]
[[Category:Turtle Graphics]]
[[Category:Fractals]]
[[Category:Fractals]]
[[Category:Curves]]

Revision as of 12:03, 10 February 2009


References

Source code

function koch(x,level) {
    if (level<1) {
        t.fd(x);
    } else {
        koch(x/3,level-1);
        t.lt(60);
        koch(x/3,level-1);
        t.rt(120);
        koch(x/3,level-1);
        t.lt(60);
        koch(x/3,level-1);
    }
}

t.cs();
t.hideTurtle();
t.setPos(-250,0);
t.rt(90);
koch(400,7);