#VRML V2.0 utf8 Group { children [ WorldInfo { title "DisCoordinateSystemGimbals.wrl" info [ "Computer Animation Project 1996, Eric Bachmann" "SGI CosmoPlayer 1.0 bugs removed by www.trapezium.com Chisel" "Restructuring and orientation outputs by Don Brutzman" "Updated: 19 April 99" "http://www.web3D.org/WorkingGroups/vrtp/dis-java-vrml/demo/gimbals/DisCoordinateSystemGimbals.wrl" ] } NavigationInfo { type [ "EXAMINE" "ANY" ] } Background { groundAngle [ 1.309, 1.571 ] groundColor [ 0 0.3 1, 0 0.3 1, 0 0.3 1 ] skyAngle [ 1.309, 1.571 ] skyColor [ 0 0.2 0.7, 0 0.5 1, 1 1 1 ] } DirectionalLight { color 0.5 0.4 0.0 direction 1 -.5 1 } Transform { translation -250 125 -250 children [ Shape { appearance Appearance { material Material { # DEF SUN_MATERIAL ambientIntensity 0 diffuseColor 1 0.871763 0 specularColor 1 1 1 emissiveColor 1 0.871763 0 shininess 0.5 } } geometry Sphere { radius 5.0 } } ] } # Transform { # translation -40 -20 -40 # children [ # Inline { # url "seamount.wrl" # } # ] # } Transform { translation 0 20 0 children [ Inline { url "globalCoordinateSystemAxes.wrl" } ] } Transform { translation 0 20 0 rotation 0 1 0 1.57 children [ DEF AZIMUTH_TRANSFORM Transform { children [ DEF AZIMUTH_SENSOR CylinderSensor { } Transform { children [ Inline { url "azimuthGimbal.wrl" } ] } Transform { rotation 0 0 1 1.57 children [ DEF ELEVATION_TRANSFORM Transform { children [ DEF ELEVATION_SENSOR CylinderSensor { } Inline { url "elevationGimbal.wrl" } Transform { rotation 1 0 0 -1.57 children [ DEF ROLL_TRANSFORM Transform { children [ DEF ROLL_SENSOR CylinderSensor { } Transform { children [ Inline { url "rollGimbal.wrl" } Transform { rotation 0 0 1 -1.57 children [ Inline { url "painted-jet.wrl" } Transform { scale 0.65 0.65 0.65 children Inline { url "localCoordinateSystemAxes.wrl" } } ] } ] } ] } ] } ] } ] } ] } ] } Viewpoint { position 0 15 100 # Z axis in VRML coordinates description "East to West" } Viewpoint { position 120 20 0 # X axis in VRML coordinates orientation 0 1 0 1.5708 description "North to South" } Viewpoint { position 0 20 -120 # Z axis in VRML coordinates orientation 0 1 0 -3.14159 description "West to East" } Viewpoint { position -120 20 0 # X axis in VRML coordinates orientation 0 1 0 -1.5708 description "South to North" } Viewpoint { position 0 30 50 orientation 1 0 0 -.20136 description "Close Up" } Transform { translation 30 40 30 rotation 0 1 0 0.785398 children [ Viewpoint { orientation 1 0 0 -0.45 description "Northeast to SW" } ] } Transform { translation -25 5 -25 rotation 0 1 0 -2.35619 children [ Viewpoint { orientation 1 0 0 0.35 description "Southwest to NE" } ] } Viewpoint { position 0 125 0 orientation -1 0 0 1.57 description "Top Down" } Transform { translation 0 -12 22 children [ Billboard { axisOfRotation 0 0 0 children [ Shape { appearance Appearance { material Material { diffuseColor 0 .8 .1 emissiveColor 0 .8 .1 } } geometry DEF TRACE_STRING Text { string [ "Text string for rotation values" ] fontStyle FontStyle { size 4 justify "MIDDLE" } } } ] } ] } DEF CONSTRUCT_TRACE_STRING Script { eventIn SFRotation set_roll eventIn SFRotation set_elevation eventIn SFRotation set_azimuth eventOut MFString rotationMessage_changed url "javascript: function initialize ( ) { roll = elevation = azimuth = azimuth2 = 0.0; rotationMessage_changed = new MFString ( 'VRML SFRotation = (1 0 0 0) axis-angle', 'DIS (roll, elevation, azimuth) = (0, 0, 0) degrees' ); } function set_roll ( value, ts ) { roll = (-value [3] * 180.0 / 3.141592653); // negate rotation to get DIS value while (roll < -180.0) roll += 360.0; while (roll >= 180.0) roll -= 360.0; calculateRotation (); roll = Math.round (roll * 10.0) / 10.0; // round to nearest tenth rotationMessage_changed = new MFString ( 'VRML SFRotation = (' + newRotation + ') axis-angle', 'DIS (roll, elevation, azimuth) = (' + roll + ', ' + elevation + ', ' + azimuth + ') degrees' ); } function set_elevation ( value, ts ) { elevation = value [3] * 180.0 / 3.141592653; while (elevation < -180.0) elevation += 360.0; while (elevation >= 180.0) elevation -= 360.0; calculateRotation (); elevation = Math.round (elevation * 10.0) / 10.0; // round to nearest tenth rotationMessage_changed = new MFString ( 'VRML SFRotation = (' + newRotation + ') axis-angle', 'DIS (roll, elevation, azimuth) = (' + roll + ', ' + elevation + ', ' + azimuth + ') degrees' ); } function set_azimuth ( value, ts ) { azimuth = (-value [3] * 180.0 / 3.141592653); // negate rotation to get DIS value while (azimuth < 0.0) azimuth += 360.0; while (azimuth >= 360.0) azimuth -= 360.0; azimuth2 = azimuth; while (azimuth2 < -180.0) azimuth2 += 360.0; while (azimuth2 >= 180.0) azimuth2 -= 360.0; calculateRotation (); azimuth = Math.round (azimuth * 10.0) / 10.0; // round to nearest tenth rotationMessage_changed = new MFString ( 'VRML SFRotation = (' + newRotation + ') axis-angle', 'DIS (roll, elevation, azimuth) = (' + roll + ', ' + elevation + ', ' + azimuth + ') degrees' ); } function calculateRotation () { newRotation = new SFRotation (1, 0, 0, 0); newRotation = newRotation.multiply (new SFRotation (1, 0, 0, roll * 3.141592653 / 180.0)); newRotation = newRotation.multiply (new SFRotation (0, 0, 1, elevation * 3.141592653 / 180.0)); newRotation = newRotation.multiply (new SFRotation (0, 1, 0, -azimuth2 * 3.141592653 / 180.0)); } " } ] } ROUTE ROLL_SENSOR.rotation_changed TO ROLL_TRANSFORM.set_rotation ROUTE ELEVATION_SENSOR.rotation_changed TO ELEVATION_TRANSFORM.set_rotation ROUTE AZIMUTH_SENSOR.rotation_changed TO AZIMUTH_TRANSFORM.set_rotation ROUTE ROLL_SENSOR.rotation_changed TO CONSTRUCT_TRACE_STRING.set_roll ROUTE ELEVATION_SENSOR.rotation_changed TO CONSTRUCT_TRACE_STRING.set_elevation ROUTE AZIMUTH_SENSOR.rotation_changed TO CONSTRUCT_TRACE_STRING.set_azimuth ROUTE CONSTRUCT_TRACE_STRING.rotationMessage_changed TO TRACE_STRING.set_string