#VRML V1.0 ascii Separator { # Options: ON OFF AUTO renderCulling AUTO OUTPUT_TO Lattice.wrl DEF BackgroundColor Info { string ".1 .2 .5" } DEF local PARAMETERS { fields [ SFLong xNumber, SFLong yNumber, SFLong zNumber] xNumber 4 yNumber 3 zNumber 3 } Material { diffuseColor =Color("red") } # Define the nodes of a lattice DEF xLoop LOOP { fields [ SFLong start, SFLong end, SFLong step, SFLong position ] start 1 end local:xNumber step 1 DEF zLoop LOOP { fields [ SFLong start, SFLong end, SFLong step, SFLong position ] start 1 end local:zNumber step 1 DEF yLoop LOOP { fields [ SFLong start, SFLong end, SFLong step, SFLong position ] start 1 end local:yNumber step 1 VARNAME ball~`xLoop:position`~`yLoop:position`~`zLoop:position` Ball { fields [ SFVec3f center, SFFloat radius ] center xLoop:position yLoop:position zLoop:position radius .1 } } } } Material { diffuseColor =Color("green") } # Define connections parallel to the x, y and z axis DEF xLoop2 LOOP { fields [ SFLong start, SFLong end, SFLong step, SFLong position ] start 1 end local:xNumber step 1 DEF zLoop2 LOOP { fields [ SFLong start, SFLong end, SFLong step, SFLong position ] start 1 end local:zNumber step 1 DEF yLoop2 LOOP { fields [ SFLong start, SFLong end, SFLong step, SFLong position ] start 1 end local:yNumber step 1 # X direction SELECT { fields [ SFLong whichChild ] whichChild if(xLoop2:position+1