<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.2//EN" "http://www.web3d.org/specifications/x3d-3.2.dtd">
<X3D profile='Immersive' version='3.2 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation =' http://www.web3d.org/specifications/x3d-3.2.xsd '>
<head>
<meta name='titlecontent='WaypointInterpolatorExample.x3d'/>
<meta name='descriptioncontent='Example set of waypoints, plus either leg durations or speed(s), which demonstrates resulting position/orientation interpolation. Motion can be stopped/started by placing mouse over orange TouchSensor Box. A HiddenViewpoint also exists under the coordinate axes. Trace values are printed in the browser console.'/>
<meta name='creatorcontent='Don Brutzman, Curtis Blais, Jeff Weekley, Jane Wu'/>
<meta name='createdcontent='6 April 2001'/>
<meta name='modifiedcontent='21 October 2018'/>
<meta name='Imagecontent='WaypointInterpolatorExample.png'/>
<meta name=' warning content=' Cortona bug: TimeSensor set_cycleInterval has no effect, effectively ignoring routed totalDuration. Workaround: view calculated value for totalDuration, then set it in TimeSensor manually. '/>
<meta name='identifiercontent=' https://savage.nps.edu/Savage/Tools/Animation/WaypointInterpolatorExample.x3d '/>
<meta name='referencecontent=' https://savage.nps.edu/Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../../license.html'/>
</head>
<!-- -->
<Scene>
<!-- ====================================== -->
<!-- To use WaypointInterpolator in your scene, copy/paste this definition verbatim first. -->
<ExternProtoDeclare name='WaypointInterpolatorappinfo='Reads waypoints and legSpeeds/legDurations/defaultSpeed to provide a customizable position/orientation interpolator.'
  url=' "../../../Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d#WaypointInterpolator" "https://savage.nps.edu/Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d#WaypointInterpolator" "../../../Savage/Tools/Animation/WaypointInterpolatorPrototype.wrl#WaypointInterpolator" "https://savage.nps.edu/Savage/Tools/Animation/WaypointInterpolatorPrototype.wrl#WaypointInterpolator" '>
<!-- Priority of use: legSpeeds (m/sec), legDurations (seconds), defaultSpeed (m/sec) -->
<field name='descriptiontype='SFStringaccessType='initializeOnly'
 appinfo='Short description of what is animated by this WaypointInterpolator.'/>

<field name='waypointstype='MFVec3faccessType='initializeOnly'
 appinfo='Waypoints being traversed with interpolation of intermediate positions and orientations.'/>

<field name='add_waypointtype='SFVec3faccessType='inputOnly'
 appinfo='Add another single waypoint to array of waypoints recalculate interpolator values.'/>

<field name='set_waypointstype='MFVec3faccessType='inputOnly'
 appinfo='Replace all waypoints recalculate interpolator values.'/>

<field name='pitchUpDownForVerticalWaypointstype='SFBoolaccessType='initializeOnly'
 appinfo='Whether to pitch child geometry (such as a vehicle) up or down to match vertical slope'/>

<field name='legSpeedstype='MFFloataccessType='initializeOnly'
 appinfo='Units m/sec. If used, array lengths for legSpeeds and legDurations must be one less than number of waypoints.'/>

<field name='legDurationstype='MFFloataccessType='initializeOnly'
 appinfo='Units in seconds. If used, array lengths for legSpeeds and legDurations must be one less than number of waypoints.'/>

<field name='defaultSpeedtype='SFFloataccessType='initializeOnly'
 appinfo='Units m/sec.'/>

<field name='turningRatetype='SFFloataccessType='initializeOnly'
 appinfo='turningRate (degrees/second) also determines standoff distance prior to waypoint where turn commences. If 0 turns are instantaneous.'/>

<field name='totalDurationtype='SFTimeaccessType='outputOnly'
 appinfo='Output calculation summing all leg durations, useful for setting TimeSensor cycleInterval. Units in seconds.'/>

<!-- interpolation fields -->
<field name='set_fractiontype='SFFloataccessType='inputOnly'
 appinfo='exposed PositionInterpolator and OrientationInterpolator setting'/>

<field name='position_changedtype='SFVec3faccessType='outputOnly'
 appinfo='exposed PositionInterpolator setting'/>

<field name='orientation_changedtype='SFRotationaccessType='outputOnly'
 appinfo='exposed OrientationInterpolator setting'/>

<!-- display-related fields -->
<field name='lineColortype='SFColoraccessType='inputOutput'
 appinfo='default color for non-active line segments'/>

<field name='highlightSegmentColortype='SFColoraccessType='inputOutput'
 appinfo='active segment highlight color'/>

<field name='transparencytype='SFFloataccessType='inputOutput'
 appinfo='1.0 is completely transparent, 0.0 is completely opaque.'/>

<field name='labelDisplayModetype='SFStringaccessType='initializeOnly'
 appinfo='allowed values: none; waypoints (produce labels at each waypoint); or interpolation (produce single moving label at interpolator time course speed location)'/>

<field name='heightLabeltype='SFStringaccessType='initializeOnly'
 appinfo='allowed values: altitude depth (negate Y value) none'/>

<field name='labelOffsettype='SFVec3faccessType='initializeOnly'
 appinfo='heightLabel relative location'/>

<field name='labelFontSizetype='SFFloataccessType='initializeOnly'
 appinfo='heightLabel text size'/>

<field name='labelColortype='SFColoraccessType='initializeOnly'
 appinfo='heightLabel text color'/>

<field name='traceEnabledtype='SFBoolaccessType='initializeOnly'
 appinfo='enable console output to trace script computations and prototype progress'/>

<field name='outputInitializationComputationstype='SFBoolaccessType='initializeOnly'
 appinfo='Output the number of waypoints totalDistance and totalDuration to console upon initialization'/>

<field name='verticalDropLineColortype='SFColoraccessType='inputOutput'
 appinfo='default color for vertical drop-line segments'/>

<field name='verticalDropLineTransparencytype='SFFloataccessType='inputOutput'
 appinfo='1.0 is completely transparent, 0.0 is completely opaque.'/>
</ExternProtoDeclare>
<!-- ====================================== -->
<!-- Here is another interesting prototype authoring tool. -->
<ExternProtoDeclare name='HiddenViewpointappinfo='Hidden viewpoint becomes active (binds) upon pointer selection to reveal an interesting view with an optionally label'
  url=' "../../../Savage/Tools/Animation/HiddenViewpointPrototype.x3d#HiddenViewpoint" "https://savage.nps.edu/Savage/Tools/Animation/HiddenViewpointPrototype.x3d#HiddenViewpoint" "../../../Savage/Tools/Animation/HiddenViewpointPrototype.wrl#HiddenViewpoint" "https://savage.nps.edu/Savage/Tools/Animation/HiddenViewpointPrototype.wrl#HiddenViewpoint" '>
<field name='positiontype='SFVec3faccessType='inputOutput'/>
<field name='rotationtype='SFRotationaccessType='inputOutput'/>
<field name='sensorRadiustype='SFFloataccessType='initializeOnly'/>
<field name='activatetype='SFBoolaccessType='inputOnly'/>
<field name='labeltype='MFStringaccessType='inputOutput'/>
<field name='labelOffsettype='SFVec3faccessType='inputOutput'/>
<field name='labelFontSizetype='SFFloataccessType='initializeOnly'/>
<field name='labelColortype='SFColoraccessType='inputOutput'/>
</ExternProtoDeclare>
<!-- ====================================== -->
<!-- Example instance follows prototype declaration -->
<Viewpoint description='WaypointInterpolator exampleorientation='1 0 0 -0.3position='-1 5 13'/>
<Viewpoint description='Above, looking downorientation='1 0 0 -1.57position='0 15 -5'/>
<Inline DEF='CoordinateAxes'
  url=' "../../../Savage/Tools/Authoring/CoordinateAxes.x3d" "http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter03Grouping/CoordinateAxes.x3d" "https://savage.nps.edu/Savage/Tools/Authoring/CoordinateAxes.x3d" "../../../Savage/Tools/Authoring/CoordinateAxes.wrl" "http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter03Grouping/CoordinateAxes.wrl" "https://savage.nps.edu/Savage/Tools/Authoring/CoordinateAxes.wrl" '/>

<!-- 10 second default cycleInterval should get overridden by 25.3 second computed totalDuration. -->
<!-- ROUTE information for Clock node:  [from TrackBuilder.totalDuration to set_cycleInterval ] [from TouchBox.isOver to enabled ] [from fraction_changed to TrackBuilder.set_fraction ] -->
<TimeSensor DEF='ClockcycleInterval='10.0loop='true'/>
<!-- ROUTE information for TrackBuilder node:  [from Clock.fraction_changed to set_fraction ] [from totalDuration to Clock.set_cycleInterval ] [from position_changed to TrackingTransform.translation ] [from orientation_changed to TrackingTransform.rotation ] -->
<ProtoInstance name='WaypointInterpolatorDEF='TrackBuilder'>
<fieldValue name='descriptionvalue='TrackBuilder'/>
<!-- Priority of use: legSpeeds (m/sec), legDurations (seconds), defaultSpeed (m/sec) -->
<fieldValue name='waypointsvalue='-5 0 0 5 2 0 5 5 -10 4.9 2 -10 -5 0 -10 -5 0 0 -5.5 0 1.5 -7 0.5 2 -8 0 0 -5 0 0'/>
<fieldValue name='pitchUpDownForVerticalWaypointsvalue='false'/>
<fieldValue name='legDurationsvalue='1 2 3 1 2 3 1 2 3'/>
<fieldValue name='legSpeedsvalue='2 4 2 2 4 1 1 1 1'/>
<fieldValue name='defaultSpeedvalue='5'/>
<fieldValue name='turningRatevalue='90'/>
<fieldValue name='lineColorvalue='1 0 0'/>
<fieldValue name='highlightSegmentColorvalue='0.2 0.2 1'/>
<fieldValue name='transparencyvalue='0'/>
<fieldValue name='labelDisplayModevalue='interpolation'/>
<fieldValue name='heightLabelvalue='altitude'/>
<fieldValue name='labelOffsetvalue='0 1.2 0'/>
<fieldValue name='labelFontSizevalue='0.5'/>
<fieldValue name='labelColorvalue='0.3 0.9 0.3'/>
<fieldValue name='traceEnabledvalue='false'/>
<fieldValue name='outputInitializationComputationsvalue='true'/>
</ProtoInstance>
<ROUTE fromNode='ClockfromField='fraction_changedtoNode='TrackBuildertoField='set_fraction'/>
<ROUTE fromNode='TrackBuilderfromField='totalDurationtoNode='ClocktoField='set_cycleInterval'/>
<!-- ROUTE information for TrackingTransform node:  [from TrackBuilder.position_changed to translation ] [from TrackBuilder.orientation_changed to rotation ] -->
<Transform DEF='TrackingTransform'>
<!-- Always align initial geometry with X axis -->
<Group>
<!-- Point cone along X-axis -->
<Transform rotation='0 0 1 -1.57'>
<Shape>
<Cone bottomRadius='0.4'/>
<Appearance DEF='ConeAppearance'>
<Material diffuseColor='0.8 0.8 0.2'/>
</Appearance>
</Shape>
</Transform>
<Transform translation='0 0.1 0'>
<Shape>
<Cone bottomRadius='0.1height='0.8'/>
<Appearance USE='ConeAppearance'/>
</Shape>
</Transform>
<Viewpoint description='Ride onorientation='0 1 0 -1.57position='-4 1 0'/>
<Viewpoint description='Ride alongsideposition='0 0 5'/>
<Viewpoint description='Ride in frontorientation='0 1 0 1.57position='4 1 0'/>
</Group>
</Transform>
<ROUTE fromNode='TrackBuilderfromField='position_changedtoNode='TrackingTransformtoField='translation'/>
<ROUTE fromNode='TrackBuilderfromField='orientation_changedtoNode='TrackingTransformtoField='rotation'/>
<!-- floor employs TouchSensor.isOver to stop/start animation -->
<Group DEF='FloorAndToggleMarker'>
<Transform translation='0 -0.1 -5'>
<Shape>
<Box size='10 0.1 10'/>
<Appearance DEF='FloorAppearance'>
<Material diffuseColor='0.1 0.8 0.9'/>
</Appearance>
</Shape>
</Transform>
<!-- starting point marker toggles playback -->
<Transform translation='-5 0 0'>
<!-- ROUTE information for TouchBox node:  [from isOver to Clock.enabled ] -->
<TouchSensor DEF='TouchBoxdescription='Touch box to toggle playback'/>
<ROUTE fromNode='TouchBoxfromField='isOvertoNode='ClocktoField='enabled'/>
<Shape>
<Box DEF='TogglePlaybacksize='0.1 0.8 0.1'/>
<Appearance DEF='OrangeAppearance'>
<Material diffuseColor='0.8 0.5 0.2'/>
</Appearance>
</Shape>
<Transform translation='0 1.4 0'>
<Billboard>
<Shape>
<Text string=' "isOver"
"toggles"
"motion"
"off/on"
'>
<FontStyle justify='"MIDDLE" "MIDDLE"size='0.3'/>
</Text>
<Appearance USE='OrangeAppearance'/>
</Shape>
</Billboard>
</Transform>
<!-- Illuminate bottom of floor for HiddenViewpoint clarity -->
<PointLight location='0 -6 0radius='10'/>
</Transform>
</Group>
<!-- Example instance of clickable viewpoint prototype -->
<ProtoInstance name='HiddenViewpointDEF='TestHiddenViewpointPrototype'>
<fieldValue name='positionvalue='0 -0.5 0'/>
<fieldValue name='rotationvalue='0 1 0 2.5'/>
<fieldValue name='sensorRadiusvalue='1'/>
<fieldValue name='labelvalue='"HiddenViewpoint" "test works!"'/>
<fieldValue name='labelOffsetvalue='1 -1.25 0'/>
<fieldValue name='labelFontSizevalue='0.4'/>
<fieldValue name='labelColorvalue='1 0 0'/>
</ProtoInstance>
</Scene>
</X3D>
<!--

Index for ExternProtoDeclare definitions : HiddenViewpoint, WaypointInterpolator

Index for DEF nodes : Clock, ConeAppearance, CoordinateAxes, FloorAndToggleMarker, FloorAppearance, OrangeAppearance, TestHiddenViewpointPrototype, TogglePlayback, TouchBox, TrackBuilder, TrackingTransform

Index for Viewpoint images : Viewpoint_1, Viewpoint_2, Viewpoint_3, Viewpoint_4, Viewpoint_5
-->

<!-- Color key: <X3dNode DEF='idName' field='value'/> matches <XmlElement DEF='idName' attribute='value'/>
(Light blue background: behavior node) (Grey background: inserted documentation) (Magenta background: X3D Extensibility)
    <Prototype name='ProtoName'> <field name='fieldName'/> </Prototype> -->

<!-- Additional help information about X3D scenes: X3D Resources, X3D Scene Authoring Hints and X3D Tooltips -->