#VRML V2.0 utf8 #Extend VRML PROTO HalfCylinder [ field SFBool top TRUE field SFBool bottom TRUE field SFFloat height 1 field SFFloat radius 1 ] { DEF Ext Extrusion { crossSection [ 1 0,0.92 0.38,0.71 0.71,0.38 0.92,0 1, -0.38 0.92,-0.71 0.71,-0.92 0.38,-1 0,1 0 ] ccw FALSE spine [ 0 0 0,0 1 0 ] endCap IS top beginCap IS bottom solid TRUE creaseAngle 0.9 } DEF Size Script { eventOut MFVec3f sp eventOut MFVec2f sc field SFFloat h IS height field SFFloat r IS radius field MFVec3f spinetemp [ 0 -0.5 0,0 0.5 0 ] field MFVec2f scaletemp [ 1 1 ] url [ "javascript: function initialize(){ spinetemp[0][1]=-h/2; spinetemp[1][1]=h/2; sp=spinetemp; scaletemp[0][0]=r; scaletemp[0][1]=r; sc=scaletemp; } " ] } ROUTE Size.sp TO Ext.set_spine ROUTE Size.sc TO Ext.set_scale } PROTO HalfSphere [ field SFBool bottom TRUE field SFFloat radius 1 ] { DEF Ext Extrusion { crossSection [ 1 0,0.92 0.38,0.71 0.71,0.38 0.92,0 1, -0.38 0.92,-0.71 0.71,-0.92 0.38,-1 0, -0.92 -0.38,-0.71 -0.71,-0.38 -0.92,0 -1, 0.38 -0.92,0.71 -0.71,0.92 -0.38,1 0 ] ccw FALSE spine [ 0 0 0,0 0.2 0,0 0.4 0,0 0.6 0,0 0.8 0,0 0.96 0 ] scale [ 1 1,0.97 0.97,0.91 0.91,0.8 0.8,0.6 0.6,0.26 0.26 ] endCap TRUE beginCap IS bottom solid TRUE creaseAngle 0.9 } DEF Size Script { eventOut MFVec3f sp eventOut MFVec2f sc field MFVec3f spinetemp [ 0 0 0,0 0.2 0,0 0.4 0,0 0.6 0,0 0.8 0,0 0.96 0 ] field MFVec2f scaletemp [ 1 1,0.97 0.97,0.91 0.91,0.8 0.8,0.6 0.6,0.26 0.26 ] field SFFloat r IS radius url [ "javascript: function initialize(){ for (var i=0;i<6;i++){ scaletemp[i][0]=scaletemp[i][0]*r; scaletemp[i][1]=scaletemp[i][1]*r; spinetemp[i][0]=spinetemp[i][0]*r; spinetemp[i][1]=spinetemp[i][1]*r; spinetemp[i][2]=spinetemp[i][2]*r; } sc=scaletemp; sp=spinetemp; } " ] } ROUTE Size.sp TO Ext.set_spine ROUTE Size.sc TO Ext.set_scale } PROTO HalfCone [ field SFBool bottom TRUE field SFFloat height 1 field SFFloat bottomRadius 1 ] { DEF Ext Extrusion { crossSection [ 1 0,0.92 0.38,0.71 0.71,0.38 0.92,0 1, -0.38 0.92,-0.71 0.71,-0.92 0.38,-1 0,1 0 ] ccw FALSE spine [ 0 -0.5 0,0 0.5 0 ] scale [ 1 1 1,0 0 0 ] endCap TRUE beginCap IS bottom solid TRUE creaseAngle 0.9 } DEF Size Script { eventOut MFVec3f sp eventOut MFVec2f sc field SFFloat h IS height field SFFloat r IS bottomRadius field MFVec3f spinetemp [ 0 0 0,0 1 0 ] field MFVec2f scaletemp [ 1 1,0 0 ] url [ "javascript: function initialize(){ scaletemp[0][0]=scaletemp[0][0]*r; scaletemp[0][1]=scaletemp[0][1]*r; sc=scaletemp; spinetemp[0][1]=-h/2; spinetemp[1][1]=h/2; sp=spinetemp; } " ] } ROUTE Size.sp TO Ext.set_spine ROUTE Size.sc TO Ext.set_scale } PROTO Torus [ field SFFloat smallRadius 0.1 field SFFloat largeRadius 1 ] { DEF Ext Extrusion { crossSection [ 0.1 0,0.092 0.038,0.071 0.071,0.038 0.092,0 0.1, -0.038 0.092,-0.071 0.071,-0.092 0.038,-0.1 0, -0.092 -0.038,-0.071 -0.071,-0.038 -0.092,0 -0.1, 0.038 -0.092,0.071 -0.071,0.092 -0.038,0.1 0 ] ccw FALSE spine [ 1 0 0,0.98 0.19 0,0.92 0.38 0,0.83 0.54 0,0.71 0.71 0,0.54 0.83 0,0.38 0.92 0,0.19 0.98 0,0 1 0, -0.19 0.98 0,-0.38 0.92 0,-0.54 0.83 0,-0.71 0.71 0,-0.83 0.54 0,-0.92 0.38 0,-0.98 0.19 0,-1 0 0, -0.98 -0.19 0,-0.92 -0.38 0,-0.83 -0.54 0,-0.71 -0.71 0,-0.54 -0.83 0,-0.38 -0.92 0,-0.19 -0.98 0,0 -1 0, 0.19 -0.98 0,0.38 -0.92 0,0.54 -0.83 0,0.71 -0.71 0,0.83 -0.54 0,0.92 -0.38 0,0.98 -0.19 0,1 0 0 ] endCap FALSE beginCap FALSE solid TRUE creaseAngle 0.9 } DEF Size Script { eventOut MFVec3f sp eventOut MFVec2f sc field MFVec3f spinetemp [ 1 0 0,0.98 0.19 0,0.92 0.38 0,0.83 0.54 0,0.71 0.71 0,0.54 0.83 0,0.38 0.92 0,0.19 0.98 0,0 1 0, -0.19 0.98 0,-0.38 0.92 0,-0.54 0.83 0,-0.71 0.71 0,-0.83 0.54 0,-0.92 0.38 0,-0.98 0.19 0,-1 0 0, -0.98 -0.19 0,-0.92 -0.38 0,-0.83 -0.54 0,-0.71 -0.71 0,-0.54 -0.83 0,-0.38 -0.92 0,-0.19 -0.98 0,0 -1 0, 0.19 -0.98 0,0.38 -0.92 0,0.54 -0.83 0,0.71 -0.71 0,0.83 -0.54 0,0.92 -0.38 0,0.98 -0.19 0,1 0 0 ] field MFVec2f scaletemp [ 1 1,1 1,1 1,1 1,1 1,1 1,1 1,1 1,1 1 1 1,1 1,1 1,1 1,1 1,1 1,1 1,1 1, 1 1,1 1,1 1,1 1,1 1,1 1,1 1,1 1, 1 1,1 1,1 1,1 1,1 1,1 1,1 1,1 1,1 1 ] field SFFloat sr IS smallRadius field SFFloat lr IS largeRadius url [ "javascript: function initialize(){ sr=sr*10; for (var i=0;i<33;i++){ spinetemp[i][0]=spinetemp[i][0]*lr; spinetemp[i][1]=spinetemp[i][1]*lr; spinetemp[i][2]=0; scaletemp[i][0]=sr; scaletemp[i][1]=sr; } sc=scaletemp; sp=spinetemp; } " ] } ROUTE Size.sp TO Ext.set_spine ROUTE Size.sc TO Ext.set_scale } #utiliser les formes Transform { translation -3.2 0 0 children [ Shape { appearance Appearance { material Material { diffuseColor 1 0 0 } } geometry Torus { #le Tore smallRadius 0.4 largeRadius 0.85 } } ] } Transform { translation -1 0 0 children [ Shape { appearance Appearance { material Material { diffuseColor 0 1 0 } } geometry HalfSphere { radius 1 } } ] } Transform { translation 1 0 0 rotation 0 1 0 2.5 children [ Shape { appearance Appearance { material Material { diffuseColor 0 0 1 } } geometry HalfCone { #le demi cone bottomRadius 1 } } ] } Transform { translation 3 0 0 rotation 0 1 0 2.5 children [ Shape { appearance Appearance { material Material { diffuseColor 1 1 0 } } geometry HalfCylinder { #le demi cylindre radius 1 } } ] }