media @ VU
[] readme course(s) preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthought(s) appendix reference(s) example(s) resource(s) _

talk show tell print

vrml-math-StarIntII.vr

vrml-math-StarIntII.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]


  
  
  NavigationInfo{ type "EXAMINE" }
  Viewpoint{ description "start"}
  Background{ skyColor .75 0 0}
  
  DEF ROOT Transform{ rotation .5 1 0 .35 scale 3 3 3
   children[ DEF Touch TouchSensor{}]}
  
  DEF Polyhedron Script {
    eventIn SFBool iterate
    eventOut MFNode new_f
    field SFNode ROOT USE ROOT
    directOutput TRUE
  url ["javascript:
  function initialize(){ 
    iter = 0;
    str_f =
  'DEF Top Transform{ children[ '+
  'DEF t0 Shape{ appearance Appearance{ material Material{ diffuseColor 1 1 0}} '+
  'geometry IndexedFaceSet{ coord Coordinate{ point[ '+
  '0 1.12 0,0 .5 .382,.363 .5 .118,.224 .5 -.309,-.224 .5 -.309,-.363 .5 .118]} '+
  'coordIndex[0 1 2 -1 0 2 3 -1 0 3 4 -1 0 4 5 -1 0 5 1]}} '+
  'DEF t1 Transform{ rotation 0 .8506 -.526 3.1416 children USE t0} '+
  'Transform{ rotation 0 1 0 1.257 children USE t1} '+
  'Transform{ rotation 0 1 0 2.51 children USE t1} '+
  'Transform{ rotation 0 1 0 -1.257 children USE t1} '+
  'Transform{ rotation 0 1 0 -2.51 children USE t1} ]} '+
  'Transform{ rotation 1 0 0 3.1416 children USE Top}';
    new_f = Browser.createVrmlFromString( str_f );
    ROOT.addChildren = new_f;
  }
  
  function iterate(value){
    if (value) {
  //    ROOT.removeChildren = new_f;
      iter++;
      str_f =
  'Transform{ translation 0 .692 0 children '+
  'DEF s'+iter+' Transform{ scale .382 .382 .382 children[ '+
  str_f +
  ']}} Transform{ translation 0 -.692 0 children USE s'+iter+'} '+
  'Transform{ translation 0 .309 -.618 children USE s'+iter+'} '+
  'Transform{ translation 0 -.309 .618 children USE s'+iter+'} '+
  'Transform{ translation .588 .309 -.191 children USE s'+iter+'} '+
  'Transform{ translation .588 -.309 .191 children USE s'+iter+'} '+
  'Transform{ translation -.588 .309 -.191 children USE s'+iter+'} '+
  'Transform{ translation -.588 -.309 .191 children USE s'+iter+'} '+
  'Transform{ translation .363 .309 .5 children USE s'+iter+'} '+
  'Transform{ translation .363 -.309 -.5 children USE s'+iter+'} '+
  'Transform{ translation -.363 .309 .5 children USE s'+iter+'} '+
  'Transform{ translation -.363 -.309 -.5 children USE s'+iter+'} ';
      new_f = Browser.createVrmlFromString( str_f );
      ROOT.addChildren = new_f;
     }
  }
  "]}
  
  ROUTE Touch.isActive TO Polyhedron.iterate
  


(C) A. Eliëns 2/9/2007

You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.