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

geom-shark.vr

geom-shark.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]


  
  
  NavigationInfo {type [ "EXAMINE" "ANY" ]}
  #DirectionalLight {direction 0 1 0}
  Background {skyColor 0.5 0.5 0.5}
  Viewpoint {position 0 -2 4 orientation 1 0 0 .6 description "Start"}
  Viewpoint {position 0 6 0 orientation 1 0 0 -1.57 description "Top"}
  Viewpoint {position 0 0 4 description "Horizontal"}
  Background {skyColor 0 0 1}
  
  EXTERNPROTO IFSModel[ exposedField MFVec3f Mpoints ] "SharkIFS.wrl#Model"
  
  DEF Rotate Transform{ children[
   Transform{scale 2 2 2 translation -.5 0 -2 children[ DEF IFSmod IFSModel{} ]}
  ]}
  DEF CI CoordinateInterpolator{ key [ 0 .25 .5 .75 1 ] keyValue [] }
  DEF TS TimeSensor{ cycleInterval 3 loop TRUE}
  DEF OI OrientationInterpolator{ key [ 0 .25 .5 .75 1 ]
   keyValue[ 0 1 0 0 0 1 0 1.57 0 1 0 3.14 0 1 0 4.71 0 1 0 0] }
  DEF TS2 TimeSensor{ cycleInterval 30 loop TRUE }
  
  DEF SCR Script{
   field SFNode IFSmod USE IFSmod
   field SFNode CI USE CI
  url ["javascript:
  function initialize(){
   len =  IFSmod.Mpoints.length;
   len2 = len + len; len3 = len2 + len; len4 = len3 + len;
   key = new MFVec3f();  key.length = 5*len;
   cp = new MFVec3f( new SFVec3f(0,0,.06),
    new SFVec3f(.32,0,-.035),
    new SFVec3f(.67,0,-.04),
    new SFVec3f(1.15,0,.19) );
   cp1 = new MFVec3f( new SFVec3f(0,0,.13),
    new SFVec3f(.35,0,-.09),
    new SFVec3f(.67,0,-.027),
    new SFVec3f(1,0,.39) );
   for (i= 0; i< len; i++){
    key[i] = IFSmod.Mpoints[i];
    key[i+len4] = IFSmod.Mpoints[i];
    u = IFSmod.Mpoints[i].x;
    u1 = 1-u; u12 = u1*u1; u2 = u*u;
    b0 = u1*u12; b1 = 3*u*u12; b2 = 3*u2*u1; b3 = u*u2;
    t = cp[0].multiply(b0).add(cp[1].multiply(b1))
     .add(cp[2].multiply(b2)).add(cp[3].multiply(b3));
    t.x -= u;
    key[i+len] = IFSmod.Mpoints[i].add(t);
    key[i+len3] = IFSmod.Mpoints[i].add(t);
    t = cp1[0].multiply(b0).add(cp1[1].multiply(b1))
     .add(cp1[2].multiply(b2)).add(cp1[3].multiply(b3));
    t.x -= u;
    key[i+len2] = IFSmod.Mpoints[i].add(t);
   }
   CI.set_keyValue = key;
  }
  "]
  }
  
  ROUTE TS.fraction_changed TO CI.set_fraction
  ROUTE CI.value_changed TO IFSmod.set_Mpoints
  ROUTE TS2.fraction_changed TO OI.set_fraction
  ROUTE OI.value_changed TO Rotate.set_rotation
    
  
    
  

(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.
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-2780434-1"; urchinTracker(); </script>