<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<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 ' >
<head>
<meta name='titlecontent=' ProjectileInterpolatorArena.x3d '/>
<meta name='descriptioncontent='A projectile motion application which displays range and max height values accoding to Vi and theta inputs. Calculations for drag force with air density are also taken into account.'/>
<meta name='creatorcontent='Ozan APAYDIN'/>
<meta name='createdcontent='10 December 2001'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/ProjectileInterpolatorArena.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!-- -->
<Scene>
<WorldInfo title='ProjectileInterpolatorArena.x3d'/>
<ExternProtoDeclare name='ProjectileSliderBar'
  url=' "ProjectileSliderBarPrototype.wrl#ProjectileSliderBar" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/ProjectileSliderBarPrototype.wrl#ProjectileSliderBar" "ProjectileSliderBarPrototype.x3d#ProjectileSliderBar" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/ProjectileSliderBarPrototype.x3d#ProjectileSliderBar" ' >
<field name='nametype='MFStringaccessType='initializeOnly'/>
<field name='lengthtype='SFFloataccessType='initializeOnly'/>
<field name='widthtype='SFFloataccessType='initializeOnly'/>
<field name='maxValuetype='SFFloataccessType='initializeOnly'/>
<field name='minValuetype='SFFloataccessType='initializeOnly'/>
<field name='barColortype='SFColoraccessType='initializeOnly'/>
<field name='pointerColortype='SFColoraccessType='initializeOnly'/>
<field name='nameColortype='SFColoraccessType='initializeOnly'/>
<field name='currentValueColortype='SFColoraccessType='initializeOnly'/>
<field name='currentValueInttype='SFInt32accessType='outputOnly'/>
<field name='currentValueFloattype='SFFloataccessType='outputOnly'/>
<field name='precisiontype='SFInt32accessType='initializeOnly'/>
<field name='translationtype='SFVec3faccessType='initializeOnly'/>
</ExternProtoDeclare>
<ExternProtoDeclare name='ProjectileInterpolator'
  url=' "ProjectileInterpolatorPrototype.wrl#ProjectileInterpolator" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/ProjectileInterpolatorPrototype.wrl#ProjectileInterpolator" "ProjectileInterpolatorPrototype.x3d#ProjectileInterpolator" "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/ProjectileInterpolatorPrototype.x3d#ProjectileInterpolator" ' >
<field name='Vitype='SFFloataccessType='initializeOnly'/>
<field name='thetatype='SFFloataccessType='initializeOnly'/>
<field name='B_mtype='SFFloataccessType='initializeOnly'/>
<field name='dttype='SFFloataccessType='initializeOnly'/>
<field name='fractiontype='SFFloataccessType='initializeOnly'/>
<field name='set_fractiontype='SFFloataccessType='inputOnly'/>
<field name='set_thetatype='SFFloataccessType='inputOnly'/>
<field name='set_Vitype='SFFloataccessType='inputOnly'/>
<field name='value_changedtype='SFVec3faccessType='outputOnly'/>
</ExternProtoDeclare>
<Viewpoint DEF='FirstViewdescription='First viewposition='60 15 150'/>
<Background groundAngle='1.309 1.570796groundColor='0 0 0skyAngle='1.309 1.571'
  backUrl=' "urn:web3d:media:textures/panoramas/space_1_back.jpg" "space_1_back.jpg " "https://www.web3d.org/WorkingGroups/media/textures/panoramas/space_1_back.jpg " "https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaPanoramas/space_1_back.jpg " "http://www.web3dmedia.com/UniversalMedia/textures/panoramas/space_1_back.jpg " "http://www.officetowers.com/UniversalMedia/textures/panoramas/space_1_back.jpg " "http://geometrek.com/UniversalMedia/textures/panoramas/space_1_back.jpg " "http://www.sc.ehu.es/ccwgamoa/UniversalMedia/textures/panoramas/space_1_back.jpg " '
  bottomUrl=' "urn:web3d:media:textures/panoramas/space_1_bottom.jpg" "space_1_bottom.jpg " "https://www.web3d.org/WorkingGroups/media/textures/panoramas/space_1_bottom.jpg " "https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaPanoramas/space_1_bottom.jpg " "http://www.web3dmedia.com/UniversalMedia/textures/panoramas/space_1_bottom.jpg " "http://www.officetowers.com/UniversalMedia/textures/panoramas/space_1_bottom.jpg " "http://geometrek.com/UniversalMedia/textures/panoramas/space_1_bottom.jpg " "http://www.sc.ehu.es/ccwgamoa/UniversalMedia/textures/panoramas/space_1_bottom.jpg " '
  frontUrl=' "urn:web3d:media:textures/panoramas/space_1_front.jpg" "space_1_front.jpg " "https://www.web3d.org/WorkingGroups/media/textures/panoramas/space_1_front.jpg " "https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaPanoramas/space_1_front.jpg " "http://www.web3dmedia.com/UniversalMedia/textures/panoramas/space_1_front.jpg " "http://www.officetowers.com/UniversalMedia/textures/panoramas/space_1_front.jpg " "http://geometrek.com/UniversalMedia/textures/panoramas/space_1_front.jpg " "http://www.sc.ehu.es/ccwgamoa/UniversalMedia/textures/panoramas/space_1_front.jpg " '
  leftUrl=' "urn:web3d:media:textures/panoramas/space_1_left.jpg" "space_1_left.jpg " "https://www.web3d.org/WorkingGroups/media/textures/panoramas/space_1_left.jpg " "https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaPanoramas/space_1_left.jpg " "http://www.web3dmedia.com/UniversalMedia/textures/panoramas/space_1_left.jpg " "http://www.officetowers.com/UniversalMedia/textures/panoramas/space_1_left.jpg " "http://geometrek.com/UniversalMedia/textures/panoramas/space_1_left.jpg " "http://www.sc.ehu.es/ccwgamoa/UniversalMedia/textures/panoramas/space_1_left.jpg " '
  rightUrl=' "urn:web3d:media:textures/panoramas/space_1_right.jpg" "space_1_right.jpg " "https://www.web3d.org/WorkingGroups/media/textures/panoramas/space_1_right.jpg " "https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaPanoramas/space_1_right.jpg " "http://www.web3dmedia.com/UniversalMedia/textures/panoramas/space_1_right.jpg " "http://www.officetowers.com/UniversalMedia/textures/panoramas/space_1_right.jpg " "http://geometrek.com/UniversalMedia/textures/panoramas/space_1_right.jpg " "http://www.sc.ehu.es/ccwgamoa/UniversalMedia/textures/panoramas/space_1_right.jpg " '
  topUrl=' "urn:web3d:media:textures/panoramas/space_1_top.jpg" "space_1_top.jpg " "https://www.web3d.org/WorkingGroups/media/textures/panoramas/space_1_top.jpg " "https://www.web3d.org/x3d/content/examples/Basic/UniversalMediaPanoramas/space_1_top.jpg " "http://www.web3dmedia.com/UniversalMedia/textures/panoramas/space_1_top.jpg " "http://www.officetowers.com/UniversalMedia/textures/panoramas/space_1_top.jpg " "http://geometrek.com/UniversalMedia/textures/panoramas/space_1_top.jpg " "http://www.sc.ehu.es/ccwgamoa/UniversalMedia/textures/panoramas/space_1_top.jpg " ' />

<DirectionalLight direction='0 -1 0intensity='0.5'/>
<!-- ROUTE information for SliderVelocity node:  [from currentValueFloat to ProjectileInterpolator.set_Vi ] -->
<ProtoInstance name='ProjectileSliderBarDEF='SliderVelocity'>
<fieldValue name='namevalue='"Vi"'/>
<fieldValue name='lengthvalue='1.5'/>
<fieldValue name='widthvalue='1'/>
<fieldValue name='maxValuevalue='30'/>
<fieldValue name='minValuevalue='0'/>
<fieldValue name='barColorvalue='0 0 1'/>
<fieldValue name='pointerColorvalue='1 1 0'/>
<fieldValue name='nameColorvalue='1 0 1'/>
<fieldValue name='precisionvalue='1'/>
<fieldValue name='translationvalue='-0.04 0.06 0.0'/>
</ProtoInstance>
<!-- ROUTE information for SliderAngle node:  [from currentValueFloat to ProjectileInterpolator.set_theta ] -->
<ProtoInstance name='ProjectileSliderBarDEF='SliderAngle'>
<fieldValue name='namevalue='"Theta"'/>
<fieldValue name='lengthvalue='1.5'/>
<fieldValue name='widthvalue='1'/>
<fieldValue name='maxValuevalue='90'/>
<fieldValue name='minValuevalue='0'/>
<fieldValue name='barColorvalue='1 0 0'/>
<fieldValue name='pointerColorvalue='1 1 0'/>
<fieldValue name='nameColorvalue='0 1 1'/>
<fieldValue name='precisionvalue='1'/>
<fieldValue name='translationvalue='-0.04 0.05 0.0'/>
</ProtoInstance>
<!-- ROUTE information for TimeCycle node:  [from currentValueFloat to TimeConverter.setTime ] -->
<ProtoInstance name='ProjectileSliderBarDEF='TimeCycle'>
<fieldValue name='namevalue='"CycleInterval"'/>
<fieldValue name='lengthvalue='1.5'/>
<fieldValue name='widthvalue='1'/>
<fieldValue name='maxValuevalue='5'/>
<fieldValue name='minValuevalue='1'/>
<fieldValue name='barColorvalue='0 1 0'/>
<fieldValue name='pointerColorvalue='1 1 0'/>
<fieldValue name='nameColorvalue='0 0.3 1'/>
<fieldValue name='precisionvalue='1'/>
<fieldValue name='translationvalue='-0.04 0.04 0.0'/>
</ProtoInstance>

< ROUTE  fromNode=' SliderVelocity' fromField='currentValueFloat' toNode=' ProjectileInterpolator' toField='set_Vi'/>
< ROUTE  fromNode=' SliderAngle' fromField='currentValueFloat' toNode=' ProjectileInterpolator' toField='set_theta'/>
<Transform>
<Group DEF='HUDGroup'>
<Collision enabled='false'>
<!-- ROUTE information for HudProx node:  [from position_changed to HudTransform.set_translation ] [from orientation_changed to HudTransform.set_rotation ] [self-route from position_changed to center ] -->
<ProximitySensor DEF='HudProxsize='1000000 1000000 1000000'/>

<!-- ROUTE information for HudTransform node:  [from HudProx.position_changed to set_translation ] [from HudProx.orientation_changed to set_rotation ] -->
<Transform DEF='HudTransform'>
<Transform translation='0.05 0.06 -0.2'>
<Transform DEF='TrajectoryTextTransform'>
<Shape>
<Text DEF='RangeTextstring='"Range 0.0"'>
<FontStyle size='0.01style='BOLD'/>
</Text>
<Appearance>
<Material diffuseColor='0.9 0.7 0.0'/>
</Appearance>
</Shape>
</Transform>
<Transform translation='0.0 -0.015 0.0'>
<Shape>
<Text DEF='HeightTextstring='"Max Height 0.0"'>
<FontStyle size='0.01style='BOLD'/>
</Text>
<Appearance>
<Material diffuseColor='0 1 0'/>
</Appearance>
</Shape>
</Transform>
</Transform>
</Transform>
</Collision>
</Group>
</Transform>
< ROUTE  fromNode=' HudProx' fromField='position_changed' toNode=' HudTransform' toField='set_translation'/>
< ROUTE  fromNode=' HudProx' fromField='position_changed' toNode=' HudProx' toField='center'/>
< ROUTE  fromNode=' HudProx' fromField='orientation_changed' toNode=' HudTransform' toField='set_rotation'/>
<!-- ROUTE information for ValueDisplayer node:  [from ProjectileInterpolator.value_changed to setTextValues ] [from HitSensor.isActive to reset ] -->
<Script DEF='ValueDisplayerdirectOutput='true'>
<field name='setTextValuestype='SFVec3faccessType='inputOnly'/>
<field name='resettype='SFBoolaccessType='inputOnly'/>
<field name='RangeTexttype='SFNodeaccessType='initializeOnly'>
<Text USE=' RangeText'/>
</field>
<field name='HeightTexttype='SFNodeaccessType='initializeOnly'>
<Text USE=' HeightText'/>
</field>
<![CDATA[
      
ecmascript:
var maxValue;

function initialize() {
   maxValue = 0;
}

function setTextValues(values, timeEvent) {
   var precision = 2;
   RangeText.string[0] ='Range            ' + roundOff(values[0], precision);
   if(values[1] > maxValue) {
      maxValue = roundOff(values[1], precision);
      Browser.println ('maximum' + maxValue);
   }

   Browser.println ('values' + values[1]);
   HeightText.string[0] ='Max Height   ' + maxValue;
}

function reset(bool, eventTime) {
   maxValue = 0;
}

//A function to round the values regarding to given precision.
function roundOff(value, precision) {

   var result;
   var isNegative = false;
   var wholeInt = Math.round(value * Math.pow(10, precision));
 
   //Negative numbers creates exceptional condition, therefor they are converted
   //to positive values.
   if(wholeInt < 0) {
      wholeInt = -wholeInt;
      isNegative = true;
   }

   var whole = wholeInt.toString();
   
   var decPoint = whole.length - precision;
   
   //Exception when precision is bigger than the string length   
   if(decPoint < 0) {
      i = -decPoint;
      for(i; i > 0; i--) {  
         whole ='0' + whole;
      }

      //Calculate decPoint according to new string expanded with 0s      
      decPoint = whole.length - precision;
   }

   if(whole !='0') {
      //Put the decimal point on the appropriate place
      result = whole.substring(0, decPoint);
      result +='.';
      result += whole.substring(decPoint, whole.length);
   }
   else { //If the string is'0', then result is'0'
      result = whole;
   }
   
   //Negative numbers are altered.
   if(isNegative) {
      result ='-' + result;
   }
   //Convert the String value to Float.
   resultFloat = parseFloat(result); 
  
  
   return resultFloat;
  
}

    
]]>
</Script>
< ROUTE  fromNode=' ProjectileInterpolator' fromField='value_changed' toNode=' ValueDisplayer' toField='setTextValues'/>
<Transform translation='0.0 -0.7 0.0'>
<Collision>
<Shape>
<Appearance> </Appearance>
<ElevationGrid xDimension='4xSpacing='40zSpacing='25height='-0.75 -0.75 -0.75 -0.75 -0.75 -0.75 -0.75 -0.75 -0.75 -0.75 -0.75 -0.75 -0.75 -0.75 -0.75 -0.75'/>
</Shape>
</Collision>
</Transform>
<Transform translation='0 0 12.5'>
<!-- ROUTE information for BallTransform node:  [from ProjectileInterpolator.value_changed to set_translation ] -->
<Transform DEF='BallTransform'>
<Shape>
<Appearance>
<Material diffuseColor='1 0 0'/>
</Appearance>
<Sphere radius='1.5'/>
</Shape>
<Viewpoint description='BallViewposition='0 10 70'/>
<!-- ROUTE information for HitSensor node:  [from touchTime to Timer.set_startTime ] [from isActive to ValueDisplayer.reset ] -->
<TouchSensor DEF='HitSensor'/>
</Transform>
</Transform>
<!-- ROUTE information for Timer node:  [from HitSensor.touchTime to set_startTime ] [from fraction_changed to ProjectileInterpolator.set_fraction ] -->
<TimeSensor DEF='TimercycleInterval='3.5'/>

< ROUTE  fromNode=' Timer' fromField='fraction_changed' toNode=' ProjectileInterpolator' toField='set_fraction'/>
< ROUTE  fromNode=' HitSensor' fromField='touchTime' toNode=' Timer' toField='set_startTime'/>
< ROUTE  fromNode=' HitSensor' fromField='isActive' toNode=' ValueDisplayer' toField='reset'/>
< ROUTE  fromNode=' ProjectileInterpolator' fromField='value_changed' toNode=' BallTransform' toField='set_translation'/>
<!-- ROUTE information for TimeConverter node:  [from TimeCycle.currentValueFloat to setTime ] -->
<Script DEF='TimeConverterdirectOutput='true'>
<field name='TimerNodetype='SFNodeaccessType='initializeOnly'>
<TimeSensor USE=' Timer'/>
</field>
<field name='setTimetype='SFFloataccessType='inputOnly'/>
<![CDATA[
      
ecmascript:
function initialize() {
}

function setTime(inputTime, timeEvent) {
   TimerNode.cycleInterval = inputTime;
}

    
]]>
</Script>
< ROUTE  fromNode=' TimeCycle' fromField='currentValueFloat' toNode=' TimeConverter' toField='setTime'/>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: BallTransform, FirstView, HeightText, HitSensor, HUDGroup, HudProx, HudTransform, ProjectileInterpolator, RangeText, SliderAngle, SliderVelocity, TimeConverter, TimeCycle, Timer, TrajectoryTextTransform, ValueDisplayer

Index for Viewpoint nodes: Viewpoint_1, FirstView Index for ExternProtoDeclare definitions: ProjectileInterpolator, ProjectileSliderBar
-->

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

HitSensor
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
Timer
TimeSensor
set_startTime
SFTime

 
 
then
Timer
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
ProjectileInterpolator
ProtoInstance
set_fraction
SFFloat

 
 
then
ProjectileInterpolator
ProtoInstance
value_changed
SFVec3f

ROUTE
event to
(3)
ValueDisplayer
Script
setTextValues
SFVec3f
 
 
 
then
ProjectileInterpolator
ProtoInstance
value_changed
SFVec3f

ROUTE
event to
(3)
BallTransform
Transform
set_translation
SFVec3f
HitSensor
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
ValueDisplayer
Script
reset
SFBool


      TimeConverter
Script
No ROUTE connection found for output from this node.
Contains SFNode field with indirect access to another node. 


      ValueDisplayer
Script
No ROUTE connection found for output from this node.
Contains SFNode field with indirect access to another node. 


HudProx
ProximitySensor
position_changed
SFVec3f

ROUTE
event to
(1)
HudTransform
Transform
set_translation
SFVec3f
HudProx
ProximitySensor
orientation_changed
SFRotation

ROUTE
event to
(1)
HudTransform
Transform
set_rotation
SFRotation


      ProjectileInterpolator
ProtoInstance
value_changed
SFVec3f

ROUTE
event to
(1)
ValueDisplayer
Script
setTextValues
SFVec3f
ProjectileInterpolator
ProtoInstance
value_changed
SFVec3f

ROUTE
event to
(1)
BallTransform
Transform
set_translation
SFVec3f


SliderAngle
ProtoInstance
currentValueFloat
SFFloat

ROUTE
event to
(1)
ProjectileInterpolator
ProtoInstance
set_theta
SFFloat

 
 
then
ProjectileInterpolator
ProtoInstance
value_changed
SFVec3f

ROUTE
event to
(2)
ValueDisplayer
Script
setTextValues
SFVec3f
 
 
 
then
ProjectileInterpolator
ProtoInstance
value_changed
SFVec3f

ROUTE
event to
(2)
BallTransform
Transform
set_translation
SFVec3f


SliderVelocity
ProtoInstance
currentValueFloat
SFFloat

ROUTE
event to
(1)
ProjectileInterpolator
ProtoInstance
set_Vi
SFFloat

 
 
then
ProjectileInterpolator
ProtoInstance
value_changed
SFVec3f

ROUTE
event to
(2)
ValueDisplayer
Script
setTextValues
SFVec3f
 
 
 
then
ProjectileInterpolator
ProtoInstance
value_changed
SFVec3f

ROUTE
event to
(2)
BallTransform
Transform
set_translation
SFVec3f


TimeCycle
ProtoInstance
currentValueFloat
SFFloat

ROUTE
event to
(1)
TimeConverter
Script
setTime
SFFloat


-->

<!-- Online at
https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/ProjectileInterpolatorArenaIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/StudentProjects/ProjectileInterpolatorArena.x3d -->

<!-- Color 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. -->