<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
<X3D profile='Immersive' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.3.xsd'>
  <head>
    <meta content='BeamConeExample.x3d' name='title'/>
    <meta content='Don Brutzman' name='creator'/>
    <meta content='11 December 2000' name='created'/>
    <meta content='15 January 2020' name='modified'/>
    <meta content='Produce wireframe or transparent beam cones.' name='description'/>
    <meta content='https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/Beam/BeamConeExample.x3d' name='identifier'/>
    <meta content='https://www.web3d.org/WorkingGroups/vrtp/demo/auv/BeamConeExample.x3d' name='reference'/>
    <meta content='http://faculty.nps.edu/brutzman/vrtp/demo/auv/BeamConeExample.x3d' name='reference'/>
    <meta content='X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit' name='generator'/>
    <meta content='../../license.html' name='license'/>
  </head>
  <Scene>
    <Background skyColor='0 0.3 0.5'/>
    <WorldInfo info='"Produce wireframe or transparent beam cones"' title='BeamConeExample'/>
    <Viewpoint description='BeamCone example' position='5 0 10'/>
    <ExternProtoDeclare appinfo='Produce wireframe or transparent beam cones. Typical uses include propeller/thruster water flow or line-of-sight sonar/radar/light beams. Negative range values invert base and apex at same relative location. Default: beam with apex at (0 0 0) and base of radius 1 in x-z plane at (1 0 0).' name='BeamCone' url='"BeamConePrototype.x3d#BeamCone" "https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/Beam/BeamConePrototype.x3d#BeamCone" "BeamConePrototype.wrl#BeamCone" "https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/Beam/BeamConePrototype.wrl#BeamCone"'>
      <field accessType='initializeOnly' appinfo='BeamCone name aids in node identification and tracing' name='name' type='SFString'/>
      <field accessType='inputOnly' appinfo='(communications) is transmitted signal in contact with receiver or (sensor) is a target return detected?' name='contact' type='SFBool'/>
      <field accessType='inputOnly' appinfo='distance in meters along x axis' name='range' type='SFFloat'/>
      <field accessType='initializeOnly' appinfo='distance in meters used until eventIn range sent' name='defaultRange' type='SFFloat'/>
      <field accessType='initializeOnly' appinfo='whether wireframe beam is drawn' name='wireframe' type='SFBool'/>
      <field accessType='initializeOnly' appinfo='whether solid beam is drawn' name='solid' type='SFBool'/>
      <field accessType='initializeOnly' appinfo='degrees across vertical y axis' name='beamHeightDegrees' type='SFFloat'/>
      <field accessType='initializeOnly' appinfo='degrees across horizontal z axis' name='beamWidthDegrees' type='SFFloat'/>
      <field accessType='initializeOnly' appinfo='rendering color when contact=true' name='contactColor' type='SFColor'/>
      <field accessType='initializeOnly' appinfo='rendering color when contact=false' name='noContactColor' type='SFColor'/>
      <field accessType='inputOutput' appinfo='1 = fully transparent wireframe only' name='transparency' type='SFFloat'/>
      <field accessType='initializeOnly' appinfo='flag to turn on Script tracing' name='traceEnabled' type='SFBool'/>
    </ExternProtoDeclare>
    <!-- Viewable geometry for this scene -->
    <Group>
      <ProtoInstance DEF='BeamConeInstance' name='BeamCone'>
        <fieldValue name='name' value='BeamConeInstance'/>
        <fieldValue name='defaultRange' value='5'/>
        <fieldValue name='beamHeightDegrees' value='24'/>
        <fieldValue name='beamWidthDegrees' value='5'/>
        <fieldValue name='transparency' value='0.2'/>
        <fieldValue name='wireframe' value='true'/>
        <fieldValue name='solid' value='true'/>
        <fieldValue name='traceEnabled' value='true'/>
        <!-- default contactColor, noContactColor -->
      </ProtoInstance>
      <Transform translation='5 -3 0'>
        <Billboard>
          <Shape>
            <Appearance>
              <Material diffuseColor='.8 .8 0'/>
            </Appearance>
            <Text string='"touch text to toggle contact-mode rendering"'>
              <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.6'/>
            </Text>
          </Shape>
          <Shape>
            <!-- transparent Box as text-selection assist -->
            <Box size='10 1 .001'/>
            <Appearance>
              <Material transparency='1'/>
            </Appearance>
          </Shape>
        </Billboard>
        <TouchSensor DEF='TextTouch' description='touch text to toggle contactColor noContactColor'/>
        <ROUTE fromField='isOver' fromNode='TextTouch' toField='contact' toNode='BeamConeInstance'/>
      </Transform>
    </Group>
    <Group DEF='AnimationGroup'>
      <TimeSensor DEF='Clock' cycleInterval='10' loop='true'/>
      <ScalarInterpolator DEF='RangeInterpolator' key='0 .4 .4 .5 .5 .9 .9 1' keyValue='0.01 10 0 0 -0.01 -10 0 0'/>
      <ROUTE fromField='fraction_changed' fromNode='Clock' toField='set_fraction' toNode='RangeInterpolator'/>
      <ROUTE fromField='value_changed' fromNode='RangeInterpolator' toField='range' toNode='BeamConeInstance'/>
      <!-- ========== -->
      <ScalarInterpolator DEF='TransparencyInterpolator' key='0 .4 .4 .5 .5 .9 .9 1' keyValue='0 1 1 1 0 1 1 1'/>
      <ROUTE fromField='fraction_changed' fromNode='Clock' toField='set_fraction' toNode='TransparencyInterpolator'/>
      <ROUTE fromField='value_changed' fromNode='TransparencyInterpolator' toField='transparency' toNode='BeamConeInstance'/>
    </Group>
  </Scene>
</X3D>