X3D Model Documentation: SideScanSonarPrototype.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2  <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
  3  <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'>
  4       <head>
  5            <meta name='titlecontent=' SideScanSonarPrototype.x3d '/>
  6            <meta name='descriptioncontent='Produce wireframe or transparent sidescan sonar beams.'/>
  7            <meta name='creatorcontent='Don Brutzman'/>
  8            <meta name='createdcontent='15 March 2001'/>
  9            <meta name='modifiedcontent='20 October 2019'/>
 10            <meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/Sonar/SideScanSonarPrototype.x3d '/>
 11            <meta name='generatorcontent='X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit'/>
 12            <meta name='licensecontent='../../license.html'/>
 13       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top DEF nodes index: BEAM_CALCULATE, BEAM_CONTROL, BeamPatternCoordinatePoints, DETECTION, FaceMaterial, IFS, ILS, LockedDownInterface2D, SOLID_SWITCH, WIREFRAME_SWITCH, WireMaterial

Index for Viewpoint node: Viewpoint_1

Index for ProtoDeclare definition: SideScanSonar
-->
 14       <Scene>
 15            <NavigationInfo DEF='LockedDownInterface2Dtype='"NONE"'/>
 16            <Background skyColor='0 0.3 0.5'/>
 17            <WorldInfo info='"Produce wireframe or transparent beam cones."title='BeamCone Prototyupe'/>
 18            <Viewpoint description='SideScanSonar Prototypeposition='0 0 15'/>
 19            <ProtoDeclare name='SideScanSonarappinfo='Produce wireframe or semi-transparent sonar sidescan beams'>
 20                 <ProtoInterface>
 21                      <field name='altitudetype='SFFloataccessType='inputOnly'
                     appinfo='vertical distance above bottom in meters along y axis'/>
 22                      <field name='defaultAltitudetype='SFFloatvalue='3accessType='initializeOnly'
                     appinfo='default vertical distance above bottom in meters along y axis'/>
 23                      <field name='maxAltitudetype='SFFloatvalue='3accessType='initializeOnly'
                     appinfo='maximum effective altitude of sidescan sonar above bottom'/>
 24                      <field name='defaultCrossTrackHalfRangetype='SFFloatvalue='30accessType='initializeOnly'
                     appinfo='distance in meters from nadir to rightmost/leftmost edge when operating at defaultAltitude above the bottom'/>
 25                      <field name='defaultTrackWidthMeterstype='SFFloatvalue='0.30accessType='initializeOnly'
                     appinfo='longitudinal width of a single return'/>
 26                      <field name='vehicleWidthMeterstype='SFFloatvalue='0.178accessType='initializeOnly'
                     appinfo='width (or diameter) of vehicle carrying port/starboard sidescan sonar transducers'/>
 27                      <field name='contacttype='SFBoolaccessType='inputOnly'
                     appinfo='(communications) whether transmitted signal is in contact with receiver or (sensor) is a target return detected?'/>
 28                      <field name='wireframetype='SFBoolvalue='trueaccessType='initializeOnly'
                     appinfo='draw lines for tracking shape?'/>
 29                      <field name='solidtype='SFBoolvalue='trueaccessType='initializeOnly'
                     appinfo='draw solid tracking shape?'/>
 30                      <field name='contactColortype='SFColorvalue='.8 .1 .1accessType='initializeOnly'
                     appinfo='rendering color when contact=true'/>
 31                      <field name='noContactColortype='SFColorvalue='.3 .5 .5accessType='initializeOnly'
                     appinfo='rendering color when contact=false'/>
 32                      <field name='transparencytype='SFFloatvalue='0accessType='inputOutput'
                     appinfo='1 = fully transparent wireframe only'/>
 33                 </ProtoInterface>
 34                 <ProtoBody>
 35                      <!-- BEAM_CONTROL beam scaling is controlled by range/beamHeightDegrees/beamWidthDegrees/direction inputs -->
 36 
                    <!-- ROUTE information for BEAM_CONTROL node:  [from BEAM_CALCULATE.beamScale to scale ] -->
                    <Transform DEF='BEAM_CONTROL'>
 37 
                         <!-- ROUTE information for WIREFRAME_SWITCH node:  [from DETECTION.wireframeChoice to whichChoice ] -->
                         <Switch DEF='WIREFRAME_SWITCHwhichChoice='1'>
 38                                <!-- TODO refactor index values starting from -1, remove WorldInfo -->
 39                                <WorldInfo info='"initial choice is null node (WorldInfo), meaning no wireframe beam"'/>
 40                                <Shape>
 41                                     <Appearance>
 42 
                                        <!-- ROUTE information for WireMaterial node:  [from DETECTION.beamColor to emissiveColor ] -->
                                        <Material DEF='WireMaterialdiffuseColor='.1 .1 .1emissiveColor='.1 .1 .1'>
 43                                               <IS>
 44                                                    <connect nodeField='transparencyprotoField='transparency'/>
 45                                               </IS>
 46                                          </Material>
 47                                     </Appearance>
 48                                     <IndexedLineSet DEF='ILScoordIndex='1 2 3 1 -1 5 3 4 5 -1 6 8 7 6 -1 10 9 8 10 -1 6 7 2 1 6 -1 10 5 4 9 10 -1'>
 49 
                                        <!-- Coordinate BeamPatternCoordinatePoints is a DEF node that has 1 USE node: USE_1
                                        <!-- ROUTE information for BeamPatternCoordinatePoints node:  [from BEAM_CALCULATE.coordinatePoints to point ] -->
                                        <Coordinate DEF='BeamPatternCoordinatePointspoint='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'/>
 50                                     </IndexedLineSet>
 51                                </Shape>
 52                           </Switch>
 53 
                         <!-- ROUTE information for SOLID_SWITCH node:  [from DETECTION.solidChoice to whichChoice ] -->
                         <Switch DEF='SOLID_SWITCHwhichChoice='0'>
 54                                <!-- TODO refactor index values starting from -1, remove WorldInfo -->
 55                                <WorldInfo info='"initial choice is null node (WorldInfo), meaning no solid beam"'/>
 56                                <Shape>
 57                                     <Appearance>
 58 
                                        <!-- Material FaceMaterial is a DEF node that has 1 USE node: USE_1
                                        <!-- ROUTE information for FaceMaterial node:  [from DETECTION.beamColor to emissiveColor ] -->
                                        <Material DEF='FaceMaterialdiffuseColor='.1 .1 .1'>
 59                                               <IS>
 60                                                    <connect nodeField='transparencyprotoField='transparency'/>
 61                                               </IS>
 62                                          </Material>
 63                                     </Appearance>
 64                                     <IndexedFaceSet DEF='IFSsolid='falsecoordIndex='1 2 3 1 -1 5 3 4 5 -1 6 8 7 6 -1 10 9 8 10 -1 6 7 2 1 6 -1 10 5 4 9 10 -1'>
 65                                          <Coordinate USE='BeamPatternCoordinatePoints'/>
 66                                     </IndexedFaceSet>
 67                                </Shape>
 68                           </Switch>
 69                      </Transform>
 70                      <!-- Non-renderable animation controls -->
 71 
                    <!-- ROUTE information for BEAM_CALCULATE node:  [from beamScale to BEAM_CONTROL.scale ] [from coordinatePoints to BeamPatternCoordinatePoints.point ] -->
                    <Script DEF='BEAM_CALCULATE'>
 72                           <field name='altitudetype='SFFloataccessType='inputOnly'/>
 73                           <field name='defaultAltitudetype='SFFloataccessType='initializeOnly'/>
 74                           <field name='maxAltitudetype='SFFloataccessType='initializeOnly'/>
 75                           <field name='defaultCrossTrackHalfRangetype='SFFloataccessType='initializeOnly'/>
 76                           <field name='defaultTrackWidthMeterstype='SFFloataccessType='initializeOnly'/>
 77                           <field name='vehicleWidthMeterstype='SFFloataccessType='initializeOnly'/>
 78                           <field name='beamScaletype='SFVec3faccessType='outputOnly'/>
 79                           <field name='coordinatePointstype='MFVec3faccessType='outputOnly'/>
 80                           <field name='traceEnabledtype='SFBoolvalue='falseaccessType='initializeOnly'
                          appinfo='internal flag to turn on Script tracing'/>
 81                           <IS>
 82                                <connect nodeField='altitudeprotoField='altitude'/>
 83                                <connect nodeField='defaultAltitudeprotoField='defaultAltitude'/>
 84                                <connect nodeField='maxAltitudeprotoField='maxAltitude'/>
 85                                <connect nodeField='defaultCrossTrackHalfRangeprotoField='defaultCrossTrackHalfRange'/>
 86                                <connect nodeField='defaultTrackWidthMetersprotoField='defaultTrackWidthMeters'/>
 87                                <connect nodeField='vehicleWidthMetersprotoField='vehicleWidthMeters'/>
 88                           </IS>
  <![CDATA[
          
ecmascript:

function tracePrint (value)
{
	if (traceEnabled) Browser.println ('[SideScanSonar BEAM_CALCULATE] ' + value);
}

function initialize () {
 beamScale = new SFVec3f (1, 1, 1);
 dt2 = defaultTrackWidthMeters/2;

 origin = new SFVec3f (0, 0, 0);
 a  = new SFVec3f (-dt2,  0,               -vehicleWidthMeters/2);
 b  = new SFVec3f (-dt2, -defaultAltitude, -defaultCrossTrackHalfRange);
 c  = new SFVec3f (-dt2, -defaultAltitude,  0);
 d  = new SFVec3f (-dt2, -defaultAltitude,  defaultCrossTrackHalfRange);
 e  = new SFVec3f (-dt2,  0,                vehicleWidthMeters/2);
 aa = new SFVec3f ( dt2,  0,               -vehicleWidthMeters/2);
 bb = new SFVec3f ( dt2, -defaultAltitude, -defaultCrossTrackHalfRange);
 cc = new SFVec3f ( dt2, -defaultAltitude,  0);
 dd = new SFVec3f ( dt2, -defaultAltitude,  defaultCrossTrackHalfRange);
 ee = new SFVec3f ( dt2,  0,                vehicleWidthMeters/2);

 coordinatePoints = new MFVec3f (origin, a, b, c, d, e, aa, bb, cc, dd, ee);

 tracePrint ('coordinatePoints =' + coordinatePoints);
}
function altitude (newAltitude, timeStamp) {
 if (newAltitude <= 0)
 {
   beamHeightFactor= 0.001;
   beamScale = new SFVec3f (1, beamHeightFactor, beamHeightFactor);
 }
 else if (newAltitude < maxAltitude)
 {
   beamHeightFactor= newAltitude / defaultAltitude;
   beamScale = new SFVec3f (1, beamHeightFactor, beamHeightFactor);
 }
 else
 {
   beamHeightFactor= maxAltitude / defaultAltitude;
   beamScale = new SFVec3f (1, beamHeightFactor, beamHeightFactor);
 }
 tracePrint ('newAltitude      =' + newAltitude);
 tracePrint ('beamHeightFactor =' + beamHeightFactor);
 tracePrint ('beamScale        =' + beamScale);
}

        
]]>
 90                      </Script>
 91 
                    <!-- ROUTE information for DETECTION node:  [from beamColor to WireMaterial.emissiveColor ] [from beamColor to FaceMaterial.emissiveColor ] [from wireframeChoice to WIREFRAME_SWITCH.whichChoice ] [from solidChoice to SOLID_SWITCH.whichChoice ] -->
                    <Script DEF='DETECTIONdirectOutput='true'>
 92                           <field name='contacttype='SFBoolaccessType='inputOnly'/>
 93                           <field name='wireframetype='SFBoolaccessType='initializeOnly'/>
 94                           <field name='solidtype='SFBoolaccessType='initializeOnly'/>
 95                           <field name='contactColortype='SFColoraccessType='initializeOnly'/>
 96                           <field name='noContactColortype='SFColoraccessType='initializeOnly'/>
 97                           <field name='beamColortype='SFColoraccessType='outputOnly'/>
 98                           <field name='wireframeChoicetype='SFInt32accessType='outputOnly'/>
 99                           <field name='solidChoicetype='SFInt32accessType='outputOnly'/>
100                           <field name='MaterialNodeHoldertype='SFNodeaccessType='initializeOnly'>
101                                <Material USE='FaceMaterial'/>
102                           </field>
103                           <field name='traceEnabledtype='SFBoolvalue='falseaccessType='initializeOnly'
                          appinfo='internal flag to turn on Script tracing'/>
104                           <IS>
105                                <connect nodeField='contactprotoField='contact'/>
106                                <connect nodeField='wireframeprotoField='wireframe'/>
107                                <connect nodeField='solidprotoField='solid'/>
108                                <connect nodeField='contactColorprotoField='contactColor'/>
109                                <connect nodeField='noContactColorprotoField='noContactColor'/>
110                           </IS>
  <![CDATA[
          
ecmascript:

function tracePrint (value)
{
	if (traceEnabled) Browser.println ('[SideScanSonar DETECTION] ' + value);
}

function initialize ()
{
	beamColor = noContactColor;
	if (wireframe == true) wireframeChoice = 1;
	if (solid     == true) solidChoice     = 1;

	// Debug  statements
	tracePrint ('  wireframe       =' + wireframe);
	tracePrint ('  solid           =' + solid);
	tracePrint ('  contactColor    =' + contactColor);
	tracePrint ('  noContactColor  =' + noContactColor);
	tracePrint ('  beamColor       =' + beamColor);
	tracePrint ('  wireframeChoice =' + wireframeChoice);
	tracePrint ('  solidChoice     =' + solidChoice);
	tracePrint ('  transparency    =' + MaterialNodeHolder.transparency);
}
function contact (newDetect, timeStamp)
{
	tracePrint ('  newDetect       =' + newDetect);
	if (newDetect) beamColor = contactColor;
	else           beamColor = noContactColor;
}

        
]]>
112                      </Script>
113                      < ROUTE  fromNode='BEAM_CALCULATE' fromField='beamScale' toNode='BEAM_CONTROL' toField='scale'/>
114                      < ROUTE  fromNode='BEAM_CALCULATE' fromField='coordinatePoints' toNode='BeamPatternCoordinatePoints' toField='point'/>
115                      < ROUTE  fromNode='DETECTION' fromField='beamColor' toNode='WireMaterial' toField='emissiveColor'/>
116                      < ROUTE  fromNode='DETECTION' fromField='beamColor' toNode='FaceMaterial' toField='emissiveColor'/>
117                      < ROUTE  fromNode='DETECTION' fromField='wireframeChoice' toNode='WIREFRAME_SWITCH' toField='whichChoice'/>
118                      < ROUTE  fromNode='DETECTION' fromField='solidChoice' toNode='SOLID_SWITCH' toField='whichChoice'/>
119                 </ProtoBody>
120            </ProtoDeclare>
121            <!-- Viewable geometry for this scene is anchored text that links to an example showing ExternProtoDeclare usage of BeamCone -->
122            <Anchor description='SideScanSonar Exampleparameter='"target=_blank"'   url=' "SideScanSonarExample.x3d" "https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/Sonar/SideScanSonarExample.x3d" "SideScanSonarExample.wrl" "https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/Sonar/SideScanSonarExample.wrl" '>
123                 <Shape>
124                      <Appearance>
125                           <Material diffuseColor='0 1 1emissiveColor='0 1 1'/>
126                      </Appearance>
127                      <Text string='"SideScanSonarPrototype" "is a Prototype definition file." "" "To see an example scene" "click this text and view" "SideScanSonarExample."'>
128                           <FontStyle justify='"MIDDLE" "MIDDLE"'/>
129                      </Text>
130                 </Shape>
131                 <Shape>
132                      <!-- transparent Box as text-selection assist -->
133                      <Box size='10.5 6 .001'/>
134                      <Appearance>
135                           <Material transparency='1'/>
136                      </Appearance>
137                 </Shape>
138            </Anchor>
139       </Scene>
140  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top DEF nodes index: BEAM_CALCULATE, BEAM_CONTROL, BeamPatternCoordinatePoints, DETECTION, FaceMaterial, IFS, ILS, LockedDownInterface2D, SOLID_SWITCH, WIREFRAME_SWITCH, WireMaterial

Index for Viewpoint node: Viewpoint_1

Index for ProtoDeclare definition: SideScanSonar
-->
X3D Tooltips element index: Anchor, Appearance, Background, Box, connect, Coordinate, field, FontStyle, head, IndexedFaceSet, IndexedLineSet, IS, Material, meta, NavigationInfo, ProtoBody, ProtoDeclare, ProtoInterface, ROUTE, Scene, Script, Shape, Switch, Text, Transform, Viewpoint, WorldInfo, X3D, plus documentation for accessType definitions, type definitions, XML data types, and field types

Event Graph ROUTE Table entries with 6 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.

BEAM_CALCULATE
Script
beamScale
SFVec3f

ROUTE
event to
(1)
BEAM_CONTROL
Transform
scale
SFVec3f
BEAM_CALCULATE
Script
coordinatePoints
MFVec3f

ROUTE
event to
(1)
BeamPatternCoordinatePoints
Coordinate
point
MFVec3f

DETECTION
Script
beamColor
SFColor

ROUTE
event to
(1)
WireMaterial
Material
emissiveColor
SFColor
DETECTION
Script
beamColor
SFColor

ROUTE
event to
(1)
FaceMaterial
Material
emissiveColor
SFColor
DETECTION
Script
wireframeChoice
SFInt32

ROUTE
event to
(1)
WIREFRAME_SWITCH
Switch
whichChoice
SFInt32
DETECTION
Script
solidChoice
SFInt32

ROUTE
event to
(1)
SOLID_SWITCH
Switch
whichChoice
SFInt32

line 122
Anchor
description='SideScanSonar Example' 
User-interaction hint for this node. 

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://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/Sonar/SideScanSonarPrototypeIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/Sonar/SideScanSonarPrototype.x3d -->

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

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