#VRML V2.0 utf8 NavigationInfo{ type "EXAMINE" } Viewpoint{ position 0 0 40 description "[110]"} Viewpoint{ position 40 0 0 orientation 0 1 0 1.57 description "[-110]"} Viewpoint{ position 0 40 0 orientation 1 0 0 -1.57 description "Top"} DEF XForm Transform{ children[] } Script{ field SFNode XForm USE XForm directOutput TRUE url ["javascript: function initialize() { var i,j,is=1, n=6, c=1.414, Str = ''; for ( i= -n; i<= n; i+=4) { sj = ''; for ( j= -n; j<= n; j+=4){ sj +=' P1{ trans '+(c*i)+' 1 '+(c*j)+'}'; if (is > 0) sj +=' P2{ trans '+(c*(i+3))+' 5 '+(c*(j+2))+'}';} Str += sj; is = -is;} XForm.addChildren = Browser.createVrmlFromString( 'PROTO P1[ field SFVec3f trans 0 0 0]{'+ 'Transform{ translation IS trans children['+ 'Shape{ appearance Appearance{ material Material{ emissiveColor 1 1 1}}'+ 'geometry IndexedLineSet{ coord Coordinate{'+ 'point[0 0 0,0 -2 2.828,0 -1 -1.414,2.828 2 0,-1.414 1 0,'+ '0 -2 2.828,-1.414 -3 2.828,1.414 -3 2.828,0 -1 4.242,'+ '2.828 2 0,4.242 1 0]}'+ 'coordIndex[ 1 0 2 -1 3 0 4 -1 6 5 7 -1 5 8 -1 9 10]}}'+ 'Transform{ translation 0 -2 2.828 children['+ 'DEF Sp Shape{ appearance Appearance{ material Material{ diffuseColor .8 .8 1}}'+ 'geometry Sphere{ radius 0.5 }}]}'+ 'Transform{ translation 2.828 2 0 children[ USE Sp ]}'+ 'Shape{ appearance Appearance{ material Material{ diffuseColor 1 1 1}}'+ 'geometry Sphere{ radius 0.5 }}]}}'+ 'PROTO P2[ field SFVec3f trans 0 0 0]{'+ 'Transform{ translation IS trans children[ '+ 'Shape{ appearance Appearance{ material Material{ emissiveColor 1 1 1}}'+ 'geometry IndexedLineSet{ coord Coordinate{'+ 'point[0 0 0,1.414 0 1.414,1.414 0 -1.414,2.828 0 0,'+ '-.707 -1 1.414,-1.414 -2 -2.828, -.707 -1 -4.242, 3.535 -1 1.414,'+ '4.242 -2 -2.828, 3.535 -1 -4.242]}'+ 'coordIndex[1 0 2 3 1 -1 6 5 0 4 -1 7 3 8 9]}}'+ 'DEF Sp Shape{ appearance Appearance{ material Material{ diffuseColor 1 1 1}}'+ 'geometry Sphere{ radius 0.5 }}'+ 'Transform{ translation 2.828 0 0 children[ USE Sp ]}'+ ']}}'+ Str ); }"] }