X3D Model Documentation: FourBladeMainRotorPrototype.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='FourBladeMainRotorPrototype.x3d'/>
  6            <meta name='description' content='Prototypes a 4 blade main rotor and its shaft for a helicopter, rotating clockwise as seen from above.'/>
  7            <meta name='creator' content='Jane Wu, Etsuko Lippi'/>
  8            <meta name='created' content='21 March 2001'/>
  9            <meta name='modified' content='20 October 2019'/>
 10            <meta name='reference' content='SuperCobraPrototype.x3d'/>
 11            <meta name='identifier' content='https://savage.nps.edu/Savage/AircraftHelicopters/AH1SuperCobraUnitedStates/FourBladeMainRotorPrototype.x3d'/>
 12            <meta name='generator' content='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit'/>
 13            <meta name='license' content='../../license.html'/>
 14       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top Index for DEF nodes: Arm, Blade, BladeColor, BladeRotationOnOffScript, Clock, ExampleBladeRotationToggle, ExampleMainRotor, ExampleSelection, FourBlades, MainRotor, MainRotorPath, RotationSwitch, ShaftColor, ToggleStatusColor, Tube

Index for Viewpoint nodes: Viewpoint_1, Viewpoint_2

Index for ProtoDeclare definition: FourBladeMainRotor
-->
 15       <Scene>
 16            <ProtoDeclare name='FourBladeMainRotor'>
 17                 <ProtoInterface>
 18                      <field name='rotationOn' type='SFBool' accessType='inputOnly'
                     appinfo='enable or disable rotor rotation'/>
 19                 </ProtoInterface>
 20                 <ProtoBody>
 21 
                    <!-- ROUTE information for MainRotor node:  [from MainRotorPath.value_changed to set_rotation ] -->
                    <Transform DEF='MainRotor'>
 22                           <!-- Rotor Shaft -->
 23                           <Transform scale='0.6 0.6 0.6'>
 24                                <Shape>
 25 
                                   <!-- Appearance ShaftColor is a DEF node that has 4 USE nodes: USE_1, USE_2, USE_3, USE_4 -->
                                   <Appearance DEF='ShaftColor'>
 26                                          <Material diffuseColor='0.5 0.5 0.5'/>
 27                                     </Appearance>
 28                                     <Cylinder bottom='false' height='1.5' radius='0.1' top='false'/>
 29                                </Shape>
 30                                <Transform translation='0 0.75 0'>
 31                                     <Shape>
 32                                          <Appearance USE='ShaftColor'/>
 33                                          <Cylinder height='0.1' radius='0.4'/>
 34                                     </Shape>
 35                                </Transform>
 36                                <Transform rotation='1 0 0 1.57' translation='0 0.75 0'>
 37 
                                   <!-- Shape Arm is a DEF node that has 1 USE node: USE_1 -->
                                   <Shape DEF='Arm'>
 38                                          <Appearance USE='ShaftColor'/>
 39                                          <Cylinder height='1.75' radius='0.05'/>
 40                                     </Shape>
 41                                </Transform>
 42                                <Transform rotation='0 0 1 1.57' translation='0 0.75 0'>
 43                                     <Shape USE='Arm'/>
 44                                </Transform>
 45                                <Transform translation='0 -0.4 0'>
 46                                     <Shape>
 47                                          <Appearance USE='ShaftColor'/>
 48                                          <Cylinder height='0.1' radius='0.3'/>
 49                                     </Shape>
 50                                </Transform>
 51                                <Transform rotation='0.71 0.02 -0.71 0.10' translation='0.23 0.15 0.23'>
 52 
                                   <!-- Shape Tube is a DEF node that has 3 USE nodes: USE_1, USE_2, USE_3 -->
                                   <Shape DEF='Tube'>
 53                                          <Appearance USE='ShaftColor'/>
 54                                          <Cylinder height='1.1' radius='0.05'/>
 55                                     </Shape>
 56                                </Transform>
 57                                <Transform rotation='-0.71 0.02 0.71 0.10' translation='-0.23 0.15 -0.23'>
 58                                     <Shape USE='Tube'/>
 59                                </Transform>
 60                                <Transform rotation='0.71 -0.02 0.71 0.10' translation='-0.23 0.15 0.23'>
 61                                     <Shape USE='Tube'/>
 62                                </Transform>
 63                                <Transform rotation='-0.71 -0.02 -0.71 0.10' translation='0.23 0.15 -0.23'>
 64                                     <Shape USE='Tube'/>
 65                                </Transform>
 66                           </Transform>
 67 
                         <!-- ROUTE information for RotationSwitch node:  [from BladeRotationOnOffScript.switchChoice to whichChoice ] -->
                         <Switch DEF='RotationSwitch' whichChoice='0'>
 68 
                              <!-- Group FourBlades is a DEF node that has 1 USE node: USE_1 -->
                              <Group DEF='FourBlades'>
 69                                     <!-- Blade in x direction -->
 70                                     <!-- Rotate 90 + 15 degree along x -->
 71                                     <Transform rotation='1 0 0 1.83' translation='0.45 0.375 0.25'>
 72                                          <Shape DEF='Blade'>
 73 
                                             <!-- Appearance BladeColor is a DEF node that has 3 USE nodes: USE_1, USE_2, USE_3 -->
                                             <Appearance DEF='BladeColor'>
 74                                                    <Material diffuseColor='0.2 0.2 0.2'/>
 75                                               </Appearance>
 76                                               <Extrusion ccw='false' creaseAngle='0.8' crossSection='-0.10 0.00 0.06 -0.01 0.10 -0.02 0.16 -0.03 0.22 -0.035 0.28 -0.03 0.30 -0.025 0.32 -0.02 0.331 0.00 0.32 0.016 0.30 0.018 0.28 0.02 0.22 0.02 0.16 0.02 0.10 0.018 0.06 0.01 -0.10 0.00' spine='0.08 0.0 0.0 5.3 0.0 0.0'/>
 77                                          </Shape>
 78                                     </Transform>
 79                                     <!-- Blade in -z direction -->
 80                                     <!-- Rotate 180 - 15 degree along z -->
 81                                     <Transform rotation='0 0 1 2.88' translation='0.25 0.375 -0.45'>
 82                                          <Shape>
 83                                               <Appearance USE='BladeColor'/>
 84                                               <Extrusion ccw='false' creaseAngle='0.8' crossSection='-0.10 0.00 0.06 -0.01 0.10 -0.02 0.16 -0.03 0.22 -0.035 0.28 -0.03 0.30 -0.025 0.32 -0.02 0.331 0.00 0.32 0.016 0.30 0.018 0.28 0.02 0.22 0.02 0.16 0.02 0.10 0.018 0.06 0.01 -0.10 0.00' spine='0.00 0.0 -0.08 0.0 0.0 -5.3'/>
 85                                          </Shape>
 86                                     </Transform>
 87                                     <!-- Blade in -x direction -->
 88                                     <!-- Rotate 90 - 15 on x -->
 89                                     <Transform rotation='1 0 0 1.31' translation='-0.45 0.375 -0.25'>
 90                                          <Shape>
 91                                               <Appearance USE='BladeColor'/>
 92                                               <Extrusion ccw='false' creaseAngle='0.8' crossSection='-0.10 0.00 0.06 -0.01 0.10 -0.02 0.16 -0.03 0.22 -0.035 0.28 -0.03 0.30 -0.025 0.32 -0.02 0.331 0.00 0.32 0.016 0.30 0.018 0.28 0.02 0.22 0.02 0.16 0.02 0.10 0.018 0.06 0.01 -0.10 0.00' spine='-0.08 0.0 0.0 -5.3 0.0 0.0'/>
 93                                          </Shape>
 94                                     </Transform>
 95                                     <!-- Blade in z direction -->
 96                                     <!-- Rotate 15 degreen on z -->
 97                                     <Transform rotation='0 0 1 0.26' translation='-0.25 0.375 0.45'>
 98                                          <Shape>
 99                                               <Appearance USE='BladeColor'/>
100                                               <Extrusion ccw='false' creaseAngle='0.8' crossSection='-0.10 0.00 0.06 -0.01 0.10 -0.02 0.16 -0.03 0.22 -0.035 0.28 -0.03 0.30 -0.025 0.32 -0.02 0.331 0.00 0.32 0.016 0.30 0.018 0.28 0.02 0.22 0.02 0.16 0.02 0.10 0.018 0.06 0.01 -0.10 0.00' spine='0.00 0.0 0.08 0.0 0.0 5.3'/>
101                                          </Shape>
102                                     </Transform>
103                                </Group>
104                                <LOD range='50 200'>
105                                     <Group USE='FourBlades'/>
106                                     <Group>
107                                          <Transform translation='0 0.45 0'>
108                                               <Shape>
109                                                    <Appearance>
110                                                         <Material diffuseColor='0.2 0.2 0.2' transparency='0.75'/>
111                                                    </Appearance>
112                                                    <Cylinder height='0.1' radius='6'/>
113                                               </Shape>
114                                          </Transform>
115                                     </Group>
116                                     <WorldInfo title='null'/>
117                                </LOD>
118                           </Switch>
119 
                         <!-- ROUTE information for BladeRotationOnOffScript node:  [from clockEnabled to Clock.set_enabled ] [from switchChoice to RotationSwitch.whichChoice ] -->
                         <Script DEF='BladeRotationOnOffScript'>
120                                <field name='rotationOn' type='SFBool' accessType='inputOnly'/>
121                                <field name='clockEnabled' type='SFBool' accessType='outputOnly'/>
122                                <field name='switchChoice' type='SFInt32' accessType='outputOnly'/>
123                                <IS>
124                                     <connect nodeField='rotationOn' protoField='rotationOn'/>
125                                </IS>
  <![CDATA[
            
ecmascript:

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

          
]]>
127                           </Script>
128                           <!-- Animation Clock -->
129 
                         <!-- ROUTE information for Clock node:  [from BladeRotationOnOffScript.clockEnabled to set_enabled ] [from fraction_changed to MainRotorPath.set_fraction ] -->
                         <TimeSensor DEF='Clock' enabled='false' loop='true'/>
130                           <!-- Animation Path -->
131 
                         <!-- ROUTE information for MainRotorPath node:  [from Clock.fraction_changed to set_fraction ] [from value_changed to MainRotor.set_rotation ] -->
                         <OrientationInterpolator DEF='MainRotorPath' key='0.0 0.25 0.5 0.75 1.0' keyValue='0.00 -1.00 0.0 0.0 0.00 -1.00 0.0 1.571 0.00 -1.00 0.0 3.142 0.00 -1.00 0.0 4.712 0.00 -1.00 0.0 6.284'/>
132                      </Transform>
133                      < ROUTE  fromNode='BladeRotationOnOffScript' fromField='clockEnabled' toNode='Clock' toField='set_enabled'/>
134                      < ROUTE  fromNode='BladeRotationOnOffScript' fromField='switchChoice' toNode='RotationSwitch' toField='whichChoice'/>
135                      < ROUTE  fromNode='Clock' fromField='fraction_changed' toNode='MainRotorPath' toField='set_fraction'/>
136                      < ROUTE  fromNode='MainRotorPath' fromField='value_changed' toNode='MainRotor' toField='set_rotation'/>
137                 </ProtoBody>
138            </ProtoDeclare>
139            <!-- ============================================================ -->
140            <WorldInfo title='FourBladeMainRotor Prototype'/>
141            <Background skyColor='0.9 0.9 0.9'/>
142            <Viewpoint description='Toggle Blade Status' position='0 1 12'/>
143            <Viewpoint description='At a distance' position='0 1 50'/>
144 
          <!-- ROUTE information for ExampleMainRotor node:  [from ExampleSelection.status to rotationOn ] -->
          <ProtoInstance name='FourBladeMainRotor' DEF='ExampleMainRotor'/>
145            <Transform translation='0 2.5 0'>
146 
               <!-- ROUTE information for ExampleBladeRotationToggle node:  [from isActive to ExampleSelection.toggleEnabled ] -->
               <TouchSensor DEF='ExampleBladeRotationToggle' description='Toggle blade rotation on/off'/>
147                 <Shape>
148                      <Appearance>
149 
                         <!-- ROUTE information for ToggleStatusColor node:  [from ExampleSelection.statusColor to diffuseColor ] -->
                         <Material DEF='ToggleStatusColor' diffuseColor='0.6 0.6 0'/>
150                      </Appearance>
151                      <Text string=' "Select Text to Toggle" "Blade Rotation On/Off" '>
152                           <FontStyle justify='"MIDDLE" "MIDDLE"'/>
153                      </Text>
154                 </Shape>
155                 <Shape>
156                      <Box size='10 2.0 0.01'/>
157                      <Appearance>
158                           <Material transparency='1'/>
159                      </Appearance>
160                 </Shape>
161            </Transform>
162 
163                 <field name='armed' type='SFInt32' value='-1' accessType='initializeOnly'/>
164                 <field name='toggleEnabled' type='SFBool' accessType='inputOnly'/>
165                 <field name='statusColor' type='SFColor' accessType='outputOnly'/>
166                 <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;
   }
}

    
]]>
168            </Script>
169            < ROUTE  fromNode='ExampleBladeRotationToggle' fromField='isActive' toNode='ExampleSelection' toField='toggleEnabled'/>
170            < ROUTE  fromNode='ExampleSelection' fromField='statusColor' toNode='ToggleStatusColor' toField='diffuseColor'/>
171            < ROUTE  fromNode='ExampleSelection' fromField='status' toNode='ExampleMainRotor' toField='rotationOn'/>
172       </Scene>
173  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top Index for DEF nodes: Arm, Blade, BladeColor, BladeRotationOnOffScript, Clock, ExampleBladeRotationToggle, ExampleMainRotor, ExampleSelection, FourBlades, MainRotor, MainRotorPath, RotationSwitch, ShaftColor, ToggleStatusColor, Tube

Index for Viewpoint nodes: Viewpoint_1, Viewpoint_2

Index for ProtoDeclare definition: FourBladeMainRotor
-->
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)
ExampleMainRotor
ProtoInstance
rotationOn
SFBool
  then
 
 
 
ExampleSelection
Script
statusColor
SFColor
→
ROUTE
event to
(2)
ToggleStatusColor
Material
diffuseColor
SFColor

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

      ExampleMainRotor
ProtoInstance
FourBladeMainRotor
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/FourBladeMainRotorPrototypeIndex.html -->
<!-- Version control at
https://gitlab.nps.edu/Savage/Savage/AircraftHelicopters/AH1SuperCobraUnitedStates/FourBladeMainRotorPrototype.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. -->