Hexagonal Gosper curve: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
No edit summary |
||
(4 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
For an explanation see [[L-systems]]. | For an explanation see [[L-systems]]. | ||
<html> | <html> | ||
<form><textarea id="inputtext0" rows=15 cols=35 wrap="off" style="width:600px;"> | <form><textarea id="inputtext0" rows=15 cols=35 wrap="off" style="width:600px;"> | ||
var level = 3; | var level = 3; | ||
Line 30: | Line 27: | ||
<input type="button" value="clear" onClick="clearturtle(0)"> | <input type="button" value="clear" onClick="clearturtle(0)"> | ||
</form> | </form> | ||
< | </html> | ||
<jsxgraph width="600" height="600" box="box0"> | |||
var t; | var t; | ||
var turtle = []; | var turtle = []; | ||
var brd = []; | var brd = []; | ||
brd[0] = JXG.JSXGraph.initBoard('box0', { | brd[0] = JXG.JSXGraph.initBoard('box0', {boundingbox: [-300, 300, 300, -300]}); | ||
turtle[0] = brd[0]. | turtle[0] = brd[0].create('turtle'); | ||
function expander(level,axiom,rules) { | function expander(level,axiom,rules) { | ||
Line 99: | Line 96: | ||
function run(nr) { | function run(nr) { | ||
brd[nr].suspendUpdate(); | brd[nr].suspendUpdate(); | ||
var code = | var code = document.getElementById('inputtext'+nr).value; | ||
if (code=='') { return; } | if (code=='') { return; } | ||
t = turtle[nr]; | t = turtle[nr]; | ||
Line 113: | Line 110: | ||
turtle[nr].cs(); | turtle[nr].cs(); | ||
} | } | ||
</ | </jsxgraph> | ||
* Przemyslaw Prusinkiewicz, James Hanan: Lindenmayer Systems, Fractals, and Plants (Lecture Notes in Biomathematics). Springer-Verlag 1989, ISBN 0-387-97092-4 | * Przemyslaw Prusinkiewicz, James Hanan: Lindenmayer Systems, Fractals, and Plants (Lecture Notes in Biomathematics). Springer-Verlag 1989, ISBN 0-387-97092-4 |
Latest revision as of 07:12, 8 June 2011
For an explanation see L-systems.
- Przemyslaw Prusinkiewicz, James Hanan: Lindenmayer Systems, Fractals, and Plants (Lecture Notes in Biomathematics). Springer-Verlag 1989, ISBN 0-387-97092-4
- http://en.wikipedia.org/wiki/L-system