X3D Model Documentation: TwoBladeTailRotorPrototype.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2 
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
  3  <X3D profile='Immersive' version='3.0'  xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'>
  4       <head>
  5            <meta name='title' content='TwoBladeTailRotorPrototype.x3d'/>
  6            <meta name='description' content='Prototypes a two-blade tail rotor and its shaft for a helicopter.'/>
  7            <meta name='creator' content='Jane Wu'/>
  8            <meta name='created' content='21 March 2001'/>
  9            <meta name='modified' content='20 October 2019'/>
 10            <meta name='identifier' content='https://savage.nps.edu/Savage/AircraftHelicopters/AH1SuperCobraUnitedStates/TwoBladeTailRotorPrototype.x3d'/>
 11            <meta name='generator' content='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit'/>
 12            <meta name='license' content='../../license.html'/>
 13       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top Index for DEF nodes: BladeRotationOnOffScript, BottomTailRotor, DarkGray, ExampleBladeRotationToggle, ExampleSelection, ExampleTailRotor, Gray, RotationSwitch, TailRotor, TailRotorClock, TailRotorPath, ToggleStatusColor, TopTailRotor, TwoBlades

Index for Viewpoint nodes: Viewpoint_1, Viewpoint_2

Index for ProtoDeclare definition: TwoBladeTailRotor
-->
 14       <Scene>
 15            <ProtoDeclare name='TwoBladeTailRotor'>
 16                 <ProtoInterface>
 17                      <field name='rotationOn' type='SFBool' accessType='inputOnly'
                     appinfo='enable or disable rotor rotation'/>
 18                 </ProtoInterface>
 19                 <ProtoBody>
 20 
                    <!-- ROUTE information for TailRotor node:  [from TailRotorPath.value_changed to set_rotation ] -->
                    <Transform DEF='TailRotor'>
 21                           <!-- Tail Rotor Shaft -->
 22                           <Transform rotation='1.0 0.0 0.0 1.57' translation='0.0 0.0 -0.1'>
 23                                <Shape>
 24                                     <Appearance DEF='Gray'>
 25                                          <Material diffuseColor='0.75 0.75 0.75'/>
 26                                     </Appearance>
 27                                     <Cylinder height='0.2' radius='0.02'/>
 28                                </Shape>
 29                           </Transform>
 30 
                         <!-- ROUTE information for RotationSwitch node:  [from BladeRotationOnOffScript.switchChoice to whichChoice ] -->
                         <Switch DEF='RotationSwitch' whichChoice='0'>
 31 
                              <!-- Group TwoBlades is a DEF node that has 1 USE node: USE_1 -->
                              <Group DEF='TwoBlades'>
 32                                     <!-- put top blade on -->
 33                                     <!-- Rotate 15 degree along y -->
 34                                     <Transform rotation='0 1 0 0.26' translation='-0.05 0.0 0.0'>
 35                                          <Shape>
 36 
                                             <!-- Appearance DarkGray is a DEF node that has 1 USE node: USE_1 -->
                                             <Appearance DEF='DarkGray'>
 37                                                    <Material diffuseColor='0.2 0.2 0.2'/>
 38                                               </Appearance>
 39                                               <Extrusion DEF='TopTailRotor' convex='false' creaseAngle='0.8' crossSection='0.00 0.00 0.03 -0.005 0.05 -0.007 0.07 -0.009 0.09 -0.01 0.11 -0.009 0.12 -0.007 0.13 -0.005 0.135 0.0 0.13 0.005 0.12 0.007 0.11 0.009 0.09 0.01 0.07 0.009 0.05 0.007 0.03 0.005' solid='false' spine='-0.015 0.02 0.0 -0.015 0.82 0.0'/>
 40                                          </Shape>
 41                                     </Transform>
 42                                     <!-- put bottom blade on -->
 43                                     <!-- Rotate -15 degree along y -->
 44                                     <Transform rotation='0 1 0 -0.26'>
 45                                          <Shape>
 46                                               <Appearance USE='DarkGray'/>
 47                                               <Extrusion DEF='BottomTailRotor' convex='false' creaseAngle='0.8' crossSection='0.00 0.00 0.03 -0.005 0.05 -0.007 0.07 -0.009 0.09 -0.01 0.11 -0.009 0.12 -0.007 0.13 -0.005 0.135 0.0 0.13 0.005 0.12 0.007 0.11 0.009 0.09 0.01 0.07 0.009 0.05 0.007 0.03 0.005' solid='false' spine='0.065 -0.02 0.0 0.065 -0.82 0.0'/>
 48                                          </Shape>
 49                                     </Transform>
 50                                </Group>
 51                                <LOD range='50 200'>
 52                                     <Group USE='TwoBlades'/>
 53                                     <Group>
 54                                          <Transform rotation='1 0 0 1.57'>
 55                                               <Shape>
 56                                                    <Appearance>
 57                                                         <Material diffuseColor='0.2 0.2 0.2' transparency='0.75'/>
 58                                                    </Appearance>
 59                                                    <Cylinder height='0.1' radius='0.82'/>
 60                                               </Shape>
 61                                          </Transform>
 62                                     </Group>
 63                                     <WorldInfo title='null'/>
 64                                </LOD>
 65                           </Switch>
 66 
                         <!-- ROUTE information for BladeRotationOnOffScript node:  [from clockEnabled to TailRotorClock.set_enabled ] [from switchChoice to RotationSwitch.whichChoice ] -->
                         <Script DEF='BladeRotationOnOffScript'>
 67                                <field name='rotationOn' type='SFBool' accessType='inputOnly'/>
 68                                <field name='clockEnabled' type='SFBool' accessType='outputOnly'/>
 69                                <field name='switchChoice' type='SFInt32' accessType='outputOnly'/>
 70                                <IS>
 71                                     <connect nodeField='rotationOn' protoField='rotationOn'/>
 72                                </IS>
  <![CDATA[
            
ecmascript:

function rotationOn(value, timeStamp) {
   if (value == true)
   {
      clockEnabled = true;
      switchChoice = 1;
   }
   else
   {
      clockEnabled = false;
      switchChoice = 0;
   }
}

          
]]>
 74                           </Script>
 75                           <!-- Animation Clock -->
 76 
                         <!-- ROUTE information for TailRotorClock node:  [from BladeRotationOnOffScript.clockEnabled to set_enabled ] [from fraction_changed to TailRotorPath.set_fraction ] -->
                         <TimeSensor DEF='TailRotorClock' cycleInterval='0.5' enabled='false' loop='true'/>
 77                           <!-- Animation Path -->
 78 
                         <!-- ROUTE information for TailRotorPath node:  [from TailRotorClock.fraction_changed to set_fraction ] [from value_changed to TailRotor.set_rotation ] -->
                         <OrientationInterpolator DEF='TailRotorPath' key='0.0 0.25 0.5 0.75 1.0' keyValue='0.00 0.00 1.00 0.00 0.00 0.00 1.00 1.57 0.00 0.00 1.00 3.14 0.00 0.00 1.00 4.712 0.00 0.00 1.00 6.284'/>
 79                      </Transform>
 80                      < ROUTE  fromNode='BladeRotationOnOffScript' fromField='clockEnabled' toNode='TailRotorClock' toField='set_enabled'/>
 81                      < ROUTE  fromNode='BladeRotationOnOffScript' fromField='switchChoice' toNode='RotationSwitch' toField='whichChoice'/>
 82                      < ROUTE  fromNode='TailRotorClock' fromField='fraction_changed' toNode='TailRotorPath' toField='set_fraction'/>
 83                      < ROUTE  fromNode='TailRotorPath' fromField='value_changed' toNode='TailRotor' toField='set_rotation'/>
 84                 </ProtoBody>
 85            </ProtoDeclare>
 86            <!-- ============================================================ -->
 87            <WorldInfo title='TwoBladeTailRotor Prototype'/>
 88            <Background skyColor='.4 .4 .6'/>
 89            <Viewpoint description='Toggle Blade Status' position='0 0 12'/>
 90            <Viewpoint description='At a distance' position='0 0 50'/>
 91 
          <!-- ROUTE information for ExampleTailRotor node:  [from ExampleSelection.status to rotationOn ] -->
          <ProtoInstance name='TwoBladeTailRotor' DEF='ExampleTailRotor'/>
 92            <Transform translation='0 2.5 0'>
 93 
               <!-- ROUTE information for ExampleBladeRotationToggle node:  [from isActive to ExampleSelection.toggleEnabled ] -->
               <TouchSensor DEF='ExampleBladeRotationToggle' description='Toggle blade rotation on/off'/>
 94                 <Shape>
 95                      <Appearance>
 96 
                         <!-- ROUTE information for ToggleStatusColor node:  [from ExampleSelection.statusColor to diffuseColor ] -->
                         <Material DEF='ToggleStatusColor' diffuseColor='0.8 0.8 0'/>
 97                      </Appearance>
 98                      <Text string=' "Select Text to Toggle" "Blade Rotation On/Off" '>
 99                           <FontStyle justify='"MIDDLE" "MIDDLE"'/>
100                      </Text>
101                 </Shape>
102                 <Shape>
103                      <Box size='8.5 2.0 0.01'/>
104                      <Appearance>
105                           <Material transparency='1'/>
106                      </Appearance>
107                 </Shape>
108            </Transform>
109 
110                 <field name='armed' type='SFInt32' value='-1' accessType='initializeOnly'/>
111                 <field name='toggleEnabled' type='SFBool' accessType='inputOnly'/>
112                 <field name='statusColor' type='SFColor' accessType='outputOnly'/>
113                 <field name='status' type='SFBool' accessType='outputOnly'/>
  <![CDATA[
      
ecmascript:

function toggleEnabled(value, ts) {
   if (armed == -1)
   {
      toggleEnabled = false;
      armed = 0;
   }

   if (armed == 0)
   {
      armed = 1;

      if (toggleEnabled == false)
      {
         status = true;
         statusColor = new SFColor(0, 0.8, 0);
         toggleEnabled = true;
      }
      else
      {
         status = false;
         statusColor = new SFColor(0.8, 0.8, 0);
         toggleEnabled = false;
      }
   }
   else
   {
      armed = 0;
      return;
   }
}

    
]]>
115            </Script>
116            < ROUTE  fromNode='ExampleBladeRotationToggle' fromField='isActive' toNode='ExampleSelection' toField='toggleEnabled'/>
117            < ROUTE  fromNode='ExampleSelection' fromField='statusColor' toNode='ToggleStatusColor' toField='diffuseColor'/>
118            < ROUTE  fromNode='ExampleSelection' fromField='status' toNode='ExampleTailRotor' toField='rotationOn'/>
119       </Scene>
120  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top Index for DEF nodes: BladeRotationOnOffScript, BottomTailRotor, DarkGray, ExampleBladeRotationToggle, ExampleSelection, ExampleTailRotor, Gray, RotationSwitch, TailRotor, TailRotorClock, TailRotorPath, ToggleStatusColor, TopTailRotor, TwoBlades

Index for Viewpoint nodes: Viewpoint_1, Viewpoint_2

Index for ProtoDeclare definition: TwoBladeTailRotor
-->
X3D Tooltips element index: Appearance, Background, Box, connect, Cylinder, Extrusion, field, FontStyle, Group, head, IS, LOD, Material, meta, OrientationInterpolator, ProtoBody, ProtoDeclare, ProtoInstance, ProtoInterface, ROUTE, Scene, Script, Shape, Switch, Text, TimeSensor, TouchSensor, Transform, Viewpoint, WorldInfo, X3D, plus documentation for accessType definitions, type definitions, XML data types, and field types

Event Graph ROUTE Table entries with 7 ROUTE connections total, showing X3D event-model relationships for this scene.

Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.

ExampleBladeRotationToggle
TouchSensor
isActive
SFBool
→
ROUTE
event to
(1)
ExampleSelection
Script
toggleEnabled
SFBool
then
 
 
 
ExampleSelection
Script
status
SFBool
→
ROUTE
event to
(2)
ExampleTailRotor
ProtoInstance
rotationOn
SFBool
  then
 
 
 
ExampleSelection
Script
statusColor
SFColor
→
ROUTE
event to
(2)
ToggleStatusColor
Material
diffuseColor
SFColor

BladeRotationOnOffScript
Script
clockEnabled
SFBool
→
ROUTE
event to
(1)
TailRotorClock
TimeSensor
set_enabled
SFBool
then
 
 
 
TailRotorClock
TimeSensor
fraction_changed
SFFloat
→
ROUTE
event to
(2)
TailRotorPath
OrientationInterpolator
set_fraction
SFFloat
then
 
 
 
TailRotorPath
OrientationInterpolator
value_changed
SFRotation
→
ROUTE
event to
(3)
TailRotor
Transform
set_rotation
SFRotation
BladeRotationOnOffScript
Script
switchChoice
SFInt32
→
ROUTE
event to
(1)
RotationSwitch
Switch
whichChoice
SFInt32

      ExampleTailRotor
ProtoInstance
TwoBladeTailRotor
No ROUTE connection found for output events from this node.
This ProtoInstance contains SFNode/MFNode fieldValue declarations with
direct access to other nodes, and thus has potential to produce run-time animation. 

Additional guidance on X3D animation can be found in the 10-Step Animation Design Process and Event Tracing hint sheets. Have fun with X3D! 😀

-->
<!-- Online at
https://savage.nps.edu/Savage/AircraftHelicopters/AH1SuperCobraUnitedStates/TwoBladeTailRotorPrototypeIndex.html -->
<!-- Version control at
https://gitlab.nps.edu/Savage/Savage/AircraftHelicopters/AH1SuperCobraUnitedStates/TwoBladeTailRotorPrototype.x3d -->

<!-- Color-coding legend: X3D terminology <X3dNode  DEF='idName' field='value'/> matches XML terminology <XmlElement  DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement) (Grey background inside box: inserted documentation) (Magenta background: X3D Extensibility)
    <ProtoInstance name='ProtoName'> <field name='fieldName'/> </ProtoInstance> -->

to top <!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->