Koch curve: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/prototype.js"></script> | <script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/prototype.js"></script> | ||
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script> | <script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script> | ||
<form><textarea id="inputtext" rows= | <form><textarea id="inputtext" rows=10 cols=35 wrap="off" style="width:600px;"> | ||
function koch(x,level) { | function koch(x,level) { | ||
if (level<1) { | if (level<1) { |
Revision as of 12:13, 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);