Fractal Polygons: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 16: Line 16:
<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>
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxturtle.js"></script>
<form><textarea id="inputtext" rows=3 cols=35 wrap="off" style="width:600px;">
<form><textarea id="inputtext" rows=3 cols=35 wrap="off" style="width:600px;">
function fracPolygone(corner,len,shrink,recurs) {
function fracPolygone(corner,len,shrink,recurs) {
Line 48: Line 47:
<script language="JavaScript">
<script language="JavaScript">
var brd = JXG.JSXGraph.initBoard('box', {originX: 300, originY: 300, unitX: 1, unitY: 1});
var brd = JXG.JSXGraph.initBoard('box', {originX: 300, originY: 300, unitX: 1, unitY: 1});
var t = new JSXTurtleObj(brd);
var t = brd.createElement('turtle');
function run() {
function run() {
   brd.suspendUpdate();
   brd.suspendUpdate();

Revision as of 15:09, 21 January 2009

With turtle graphics it is quite easy to construct in a recursive manner regular polygones.

It is possible to play around with this example: In the last line of the input window there is the command

fracPolygone(5,100,0.4,5);

The meaning of the parameters is

  • 5: number of vertices of the regular polygone,
  • 100: length of a side of the initial polygone,
  • 0.4: shrink factor from one level to the next,
  • 5: number of recursion steps.


References

  • Peter Baptist, Wolfgang Neidhardt, Alfred Wassermann: Symmetry and Regular Polygons, Prispevki k poucevanju Matematike, The Improvement of Mathematics Education in Secondary Schools: A Tempus Project, Maribor 1996.