A shape that has an infinite perimeter but finite area
<?xml version="1.0" encoding="UTF-8"?>
<!--Sat Jan 21 2012 13:39:17 GMT-0500 (EST)-->
<XholonWorkbook>
<Notes>
Khan Academy
------------
Title: Koch Snowflake Fractal
Description: A shape that has an infinite perimeter but finite area
Url: http://www.khanacademy.org/video/koch-snowflake-fractal?playlist=Geometry
InternalName: koch-snowflake-fractal
YoutubeId: azBNsPa1WC4
Keywords: fractal, geometry, marquee
My Notes
--------
The challenge here is to draw the snowflake recursively.
use javascript and SVG ?
each iteration, the boundary of the shape gets longer
.33 bigger each pass
it has an infinite perimeter and a finite area
SVG alternatives
----------------
This workbook includes two versions of a wikipedia SVG image:
1. The first version is embedded inside the Xholon composite structure hierarchy,
and will be automatically downloaded from wikipedia and displayed if you follow
the steps to run the Xholon app.
2. The second version, at the end of the workbook, is just a portion of the
image at wikipedia. It can be manually inserted into the Xholon app,
or displayed in various other ways.
</Notes>
<script implName="lang:python:inline:"><![CDATA[
print "height = 12.34 m"
]]></script>
<script implName="lang:javascript:inline:"><![CDATA[
// note that length becomes increasingly bigger
var length = 3.0; // initial length with 3 sides, where each side has length of 3 m
for (var i = 0; i < 10; i++) {
length = length * 1.33;
println("length = " + length + " m");
}
]]></script>
<_-.XholonClass>
<!-- domain objects -->
<GeometrySystem/>
<KochSnowflake/>
</_-.XholonClass>
<xholonClassDetails>
<KochSnowflake>
<port name="length" connector="#xpointer(Length)"/>
</KochSnowflake>
</xholonClassDetails>
<GeometrySystem>
<KochSnowflake>
<Length>3.0 m</Length>
</KochSnowflake>
<SvgClient>
<Attribute_String roleName="setup">${MODELNAME_DEFAULT},http://upload.wikimedia.org/wikipedia/commons/d/d9/KochFlake.svg</Attribute_String>
</SvgClient>
</GeometrySystem>
<Blockbehavior implName="lang:python:inline:"><![CDATA[
# This works if pasted in as a last child of Block.
height.incVal(0.02)
print("Python wants something to do. Height:" + str(height))
]]></Blockbehavior>
<KochSnowflakeBehavior implName="org.primordion.script.Behavior" lang="javascript"><![CDATA[
length.setVal(length.val * 1.33);
]]></KochSnowflakeBehavior>
<Blockbehavior implName="lang:bsh:inline:"><![CDATA[
// This works if pasted in as a last child of Block.
height.incVal(0.02);
System.out.print("Java/Beanshell wants something to do. Height:" + height + "\n");
]]></Blockbehavior>
<Blockbehavior implName="lang:jruby:inline:"><![CDATA[
require 'java'
# This works if pasted in as a last child of Block.
$height.incVal(0.02)
puts "Ruby wants something to do. Height: #{$height}"
]]></Blockbehavior>
<Blockbehavior implName="lang:groovy:inline:"><![CDATA[
// This works if pasted in as a last child of Block.
height.incVal(0.02);
System.out.print("Groovy wants something to do. Height:" + height + "\n");
]]></Blockbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="120" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Layer 1</title>
<path id="path4399" d="m0.55809,89.76782l1.83064,-3.30362l-1.83064,-3.30362l3.66129,0l1.83064,-3.30365l-1.83064,-3.30363l-3.6613,0l1.83066,-3.30362l-1.83064,-3.30365l3.66129,0l1.83064,-3.30362l1.83066,3.30362l3.66129,0l1.83064,-3.30362l-1.83064,-3.30363l3.66129,0l1.83066,-3.30363l-1.83066,-3.30362l-3.66129,0l1.83064,-3.30363l-1.83064,-3.30362l-3.66129,0l-1.83066,3.30362l-1.83064,-3.30362l-3.66129,0l1.83064,-3.30363l-1.83066,-3.30362l3.6613,0l1.83064,-3.30362l-1.83064,-3.30365l-3.66129,0l1.83064,-3.30362l-1.83066,-3.30363l3.6613,0l1.83064,-3.30362l1.83066,3.30362l3.66129,0l1.83064,-3.30362l-1.83064,-3.30362l3.66129,0l1.83066,-3.30365l1.83064,3.30365l3.66129,0l-1.83063,3.30362l1.83063,3.30362l3.6613,0l1.83063,-3.30362l1.83069,3.30362l3.66127,0l1.83064,-3.30362l-1.83064,-3.30362l3.66129,0l1.83067,-3.30365l-1.83067,-3.30362l-3.66129,0l1.83064,-3.30363l-1.83064,-3.30363l3.66129,0l1.83066,-3.3036l1.83066,3.3036l3.66129,0l1.83063,-3.3036l-1.83063,-3.30363l3.6613,0l1.83064,-3.30362l1.83063,3.30362l3.6613,0l-1.83063,3.30363l1.83063,3.3036l3.66132,0l1.83063,-3.3036l1.83066,3.3036l3.66129,0l-1.83067,3.30363l1.83067,3.30363l-3.66129,0l-1.83066,3.30362l1.83066,3.30365l3.66129,0l-1.83067,3.30362l1.83067,3.30362l3.66129,0l1.83066,-3.30362l1.83064,3.30362l3.66132,0l1.83064,-3.30362l-1.83064,-3.30362l3.66129,0l1.83063,-3.30365l1.83069,3.30365l3.66129,0l-1.83066,3.30362l1.83066,3.30362l3.66129,0l1.83066,-3.30362l1.83063,3.30362l3.66129,0l-1.83063,3.30363l1.83063,3.30362l-3.66129,0l-1.83063,3.30365l1.83063,3.30362l3.66129,0l-1.83063,3.30362l1.83063,3.30363l-3.66129,0l-1.83063,3.30362l-1.83066,-3.30362l-3.66129,0l-1.83066,3.30362l1.83066,3.30363l-3.66129,0l-1.83069,3.30362l1.83069,3.30363l3.66129,0l-1.83066,3.30363l1.83066,3.30362l3.66129,0l1.83066,-3.30362l1.83063,3.30362l3.66129,0l-1.83063,3.30365l1.83063,3.30362l-3.66129,0l-1.83063,3.30363l1.83063,3.30365l3.66129,0l-1.83063,3.30362l1.83063,3.30362l-3.66129,0l-1.83063,3.30362l-1.83066,-3.30362l-3.66129,0l-1.83066,3.30362l1.83066,3.30362l-3.66129,0.00003l-1.83069,3.30362l-1.83063,-3.30365l-3.66129,0.00003l1.83064,-3.30365l-1.83064,-3.30362l-3.66132,0l-1.83064,3.30362l-1.83066,-3.30362l-3.66129,0l-1.83067,3.30362l1.83067,3.30365l-3.66129,-0.00003l-1.83066,3.30365l1.83066,3.30362l3.66129,0l-1.83067,3.30362l1.83067,3.30365l-3.66129,0l-1.83066,3.30359l-1.83063,-3.30359l-3.66132,0l-1.83063,3.30359l1.83063,3.30365l-3.6613,0l-1.83064,3.30362l-1.83063,-3.30362l-3.6613,0l1.83063,-3.30365l-1.83063,-3.30359l-3.66129,0l-1.83064,3.30359l-1.83067,-3.30359l-3.66129,0l1.83064,-3.30365l-1.83064,-3.30362l3.66129,0l1.83067,-3.30362l-1.83067,-3.30365l-3.66129,0l1.83064,-3.30362l-1.83064,-3.30362l-3.66129,0l-1.83067,3.30362l-1.83063,-3.30362l-3.6613,0l-1.83063,3.30362l1.83063,3.30365l-3.6613,-0.00003l-1.83063,3.30365l-1.83066,-3.30365l-3.66129,0.00003l1.83064,-3.30365l-1.83064,-3.30362l-3.66129,0l-1.83066,3.30362l-1.83064,-3.30362l-3.66129,0" stroke-miterlimit="4" stroke-width="1.03345" stroke="#000000" fill="none"/>
</g>
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>