Un pavage hexagonal - Jean-Baptiste Etienne
Based on Jean-Baptiste Etienne's : Un pavage hexagonal (Alhambra)
News Feed of this design.
Remark regarding the use of buttons (and memory usage).
You can't use the Delete and Setup buttons repeatedly.
It seems to me that GeoGebra crashes because the garbage collector
isn't working optimally. The memory usage increases after one delete
and re-create from 234 to 367 MB. The sheer amount of memory
required surprises me. To prevent Geogebra from crashing
I only allow you to delete and recreate once.
GGB scripting
#===================================================================================
# Button Setup : butSetup
#===================================================================================
RunClickScript( butDelete )
SetConditionToShowObject( butSetup, false )
s = sqrt(3)
U = ( 10s; 0° )
V = ( 10s; 120° )
LP = Flatten( Zip( Zip(m*U + n*V, m,-3..3), n,-3..3) )
LT = RemoveUndefined( zip( if( abs(P)<60, P), P,LP) )
L1 = { ( s,1),(2s,0),(3s,1),(2s,2),(2s,12),(s,11) }
L2 = { (2s,2),(3s,1),(6s,4),(5s,5),(3s,3),(3s,13),(2s,14),(-s,11),(0,10),(2s,12) }
LS = Flatten( Zip( Rotate( {(2s,0),(s,1)}, k* 60°), k,0..5) )
r1 = Flatten( Zip( Translate( Zip( Rotate( Polygon(L1), k* 60°), k,0..5), T), T,LT) )
r2 = Flatten( Zip( Translate( Zip( Rotate( Polygon(L2), k*120°), k,0..2), T), T,LT) )
rS = Flatten( Zip( Translate( Zip( Rotate( Polygon(LS), k*120°), k,0..2), T), T,LT) )
rL = Flatten( {r1,r2} )
#--- Object properties ---#
SetColor( r1, "#FFCC66" )
SetColor( r2, "#CC0000" )
SetColor( rS, Black )
SetColor( rL, Black )
Lobj = { "r1", "r2", "rS", "rL" }
Execute( Zip( "SetFilling("+obj+", 1)", obj, Lobj) )
Execute( Zip( "SetLineThickness("+obj+", 1)", obj, Lobj) )
SetFilling( rL, 0 )
SetLineThickness( rL, 3 )
Lobj = { "U", "V", "LP", "LT", "L1", "L2", "LS" }
Execute( Zip( "SetConditionToShowObject("+obj+", false)", obj, Lobj) )
Delete( Lobj )
SetCoords( butDelete, 10, 10 )
SetCoords( butSetup , 10, 10 )
SetCoords( butSettings,10, 50 )
RunClickScript( butSettings )
#===================================================================================
# Button Settings : butSettings
#===================================================================================
SetActiveView( 1 )
CenterView( (-1, 1.5) )
ZoomIn( y( Corner(3) - Corner(1) ) / 125 )
ShowAxes( false )
ShowGrid( false )
SetActiveView( -1 )
CenterView( (0, 0,-10) )
ZoomIn( y( Corner(-1,3) - Corner(-1,1) ) /60 )
ShowAxes( false )
ShowGrid( false )
SetViewDirection( Vector( (0,-1.2,-1) ) )
SetSpinSpeed( 1 )
#===================================================================================
# Button Delete : butDelete
#===================================================================================
Lobj = { "rL", "rS", "r2", "r1", "LS", "L2", "L1", "LT" ,"LP" ,"V" ,"U" ,"s" }
Execute( Zip( "Delete("+obj+")", obj, Lobj ) )
Delete( Lobj )
SetConditionToShowObject( butDelete, false )
SetConditionToShowObject( butSetup , true )
#===================================================================================
# Extra's (Can't be done in Setup script)
#===================================================================================
1) Global JavaScript to start spinning and set button visibility.
function ggbOnInit() {
ggbApplet.evalCommand("SetSpinSpeed(1)");
ggbApplet.evalCommand("SetConditionToShowObject(butSetup ,false)");
ggbApplet.evalCommand("SetConditionToShowObject(butDelete,true )");
}
2) Preferences - 3D Graphics
Miscellaneous - Use Lighting : off
Basic - Clipping box size : Large
Projection - Perspective Distance : 1200
3) Object properties
r1 : Advanced - Selection Allowed : off
r2 : Advanced - Selection Allowed : off
rS : Advanced - Selection Allowed : off
rL : Advanced - Selection Allowed : off