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-KOctaInt.vr

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


  
  
  NavigationInfo{ type "EXAMINE" }
  Viewpoint{ description "start"}
  Background{ skyColor 0 0 .75}
  
  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 s0 Shape{ appearance Appearance{ material Material{ diffuseColor 1 1 1}} '+
  'geometry IndexedFaceSet{ coord Coordinate{ '+
  'point[0 1.224 0,0 -.408 1.154,1. -.408 -.578,-1. -.408 -.578]} '+
  'coordIndex[1 2 0 -1 2 3 0 -1 3 1 0 -1 3 2 1]}} '+
  'Transform{ rotation 1 0 0 3.1416 children USE s0}';
    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 .612 0 children '+
  'DEF s'+iter+' Transform{ scale .5 .5 .5 children[ '+
  str_f +
  ']}} Transform{ translation 0 -.204 .577 children USE s'+iter+'} '+
  'Transform{ translation .5 -.204 -.289 children USE s'+iter+'} '+
  'Transform{ translation -.5 -.204 -.289 children USE s'+iter+'} '+
  'Transform{ translation 0 -.612 0 children USE s'+iter+'} '+
  'Transform{ translation 0 .204 -.577 children USE s'+iter+'} '+
  'Transform{ translation .5 .204 .289 children USE s'+iter+'} '+
  'Transform{ translation -.5 .204 .289 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.