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='ProjectileInterpolatorArena.x3d'/> |
6 | <meta name='description' content='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.'/> |
7 | <meta name='creator' content='Ozan APAYDIN'/> |
8 | <meta name='created' content='10 December 2001'/> |
9 | <meta name='modified' content='20 October 2019'/> |
10 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/ProjectileInterpolatorArena.x3d'/> |
11 | <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> |
12 | <meta name='license' content='../license.html'/> |
13 | </head> |
14 | <Scene> |
15 | <WorldInfo title='ProjectileInterpolatorArena.x3d'/> |
16 | <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" '> |
17 | <field name='name' type='MFString' accessType='initializeOnly'/> |
18 | <field name='length' type='SFFloat' accessType='initializeOnly'/> |
19 | <field name='width' type='SFFloat' accessType='initializeOnly'/> |
20 | <field name='maxValue' type='SFFloat' accessType='initializeOnly'/> |
21 | <field name='minValue' type='SFFloat' accessType='initializeOnly'/> |
22 | <field name='barColor' type='SFColor' accessType='initializeOnly'/> |
23 | <field name='pointerColor' type='SFColor' accessType='initializeOnly'/> |
24 | <field name='nameColor' type='SFColor' accessType='initializeOnly'/> |
25 | <field name='currentValueColor' type='SFColor' accessType='initializeOnly'/> |
26 | <field name='currentValueInt' type='SFInt32' accessType='outputOnly'/> |
27 | <field name='currentValueFloat' type='SFFloat' accessType='outputOnly'/> |
28 | <field name='precision' type='SFInt32' accessType='initializeOnly'/> |
29 | <field name='translation' type='SFVec3f' accessType='initializeOnly'/> |
30 | </ExternProtoDeclare> |
31 | <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" '> |
32 | <field name='Vi' type='SFFloat' accessType='initializeOnly'/> |
33 | <field name='theta' type='SFFloat' accessType='initializeOnly'/> |
34 | <field name='B_m' type='SFFloat' accessType='initializeOnly'/> |
35 | <field name='dt' type='SFFloat' accessType='initializeOnly'/> |
36 | <field name='fraction' type='SFFloat' accessType='initializeOnly'/> |
37 | <field name='set_fraction' type='SFFloat' accessType='inputOnly'/> |
38 | <field name='set_theta' type='SFFloat' accessType='inputOnly'/> |
39 | <field name='set_Vi' type='SFFloat' accessType='inputOnly'/> |
40 | <field name='value_changed' type='SFVec3f' accessType='outputOnly'/> |
41 | </ExternProtoDeclare> |
42 | <Viewpoint DEF='FirstView' description='First view' position='60 15 150'/> |
43 | <Background groundAngle='1.309 1.570796' groundColor='0 0 0' skyAngle='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 " '/> |
44 | <DirectionalLight direction='0 -1 0' intensity='0.5'/> |
45 |
<!-- ROUTE information for SliderVelocity node:
[from currentValueFloat to ProjectileInterpolator.set_Vi
]
-->
<ProtoInstance name='ProjectileSliderBar' DEF='SliderVelocity'> |
46 | <fieldValue name='name' value='"Vi"'/> |
47 | <fieldValue name='length' value='1.5'/> |
48 | <fieldValue name='width' value='1'/> |
49 | <fieldValue name='maxValue' value='30'/> |
50 | <fieldValue name='minValue' value='0'/> |
51 | <fieldValue name='barColor' value='0 0 1'/> |
52 | <fieldValue name='pointerColor' value='1 1 0'/> |
53 | <fieldValue name='nameColor' value='1 0 1'/> |
54 | <fieldValue name='precision' value='1'/> |
55 | <fieldValue name='translation' value='-0.04 0.06 0.0'/> |
56 | </ProtoInstance> |
57 |
<!-- ROUTE information for SliderAngle node:
[from currentValueFloat to ProjectileInterpolator.set_theta
]
-->
<ProtoInstance name='ProjectileSliderBar' DEF='SliderAngle'> |
58 | <fieldValue name='name' value='"Theta"'/> |
59 | <fieldValue name='length' value='1.5'/> |
60 | <fieldValue name='width' value='1'/> |
61 | <fieldValue name='maxValue' value='90'/> |
62 | <fieldValue name='minValue' value='0'/> |
63 | <fieldValue name='barColor' value='1 0 0'/> |
64 | <fieldValue name='pointerColor' value='1 1 0'/> |
65 | <fieldValue name='nameColor' value='0 1 1'/> |
66 | <fieldValue name='precision' value='1'/> |
67 | <fieldValue name='translation' value='-0.04 0.05 0.0'/> |
68 | </ProtoInstance> |
69 |
<!-- ROUTE information for TimeCycle node:
[from currentValueFloat to TimeConverter.setTime
]
-->
<ProtoInstance name='ProjectileSliderBar' DEF='TimeCycle'> |
70 | <fieldValue name='name' value='"CycleInterval"'/> |
71 | <fieldValue name='length' value='1.5'/> |
72 | <fieldValue name='width' value='1'/> |
73 | <fieldValue name='maxValue' value='5'/> |
74 | <fieldValue name='minValue' value='1'/> |
75 | <fieldValue name='barColor' value='0 1 0'/> |
76 | <fieldValue name='pointerColor' value='1 1 0'/> |
77 | <fieldValue name='nameColor' value='0 0.3 1'/> |
78 | <fieldValue name='precision' value='1'/> |
79 | <fieldValue name='translation' value='-0.04 0.04 0.0'/> |
80 | </ProtoInstance> |
81 |
<!-- ROUTE information for ProjectileInterpolator node:
[from SliderVelocity.currentValueFloat to set_Vi
]
[from SliderAngle.currentValueFloat to set_theta
]
[from Timer.fraction_changed to set_fraction
]
[from value_changed to ValueDisplayer.setTextValues
]
[from value_changed to BallTransform.set_translation
]
-->
<ProtoInstance name='ProjectileInterpolator' DEF='ProjectileInterpolator'/> |
82 | < ROUTE fromNode='SliderVelocity' fromField='currentValueFloat' toNode='ProjectileInterpolator' toField='set_Vi'/> |
83 | < ROUTE fromNode='SliderAngle' fromField='currentValueFloat' toNode='ProjectileInterpolator' toField='set_theta'/> |
84 | <Transform> |
85 | <Group DEF='HUDGroup'> |
86 | <Collision enabled='false'> |
87 |
<!-- 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='HudProx' size='1000000 1000000 1000000'/> |
88 |
<!-- ROUTE information for HudTransform node:
[from HudProx.position_changed to set_translation
]
[from HudProx.orientation_changed to set_rotation
]
-->
<Transform DEF='HudTransform'> |
89 | <Transform translation='0.05 0.06 -0.2'> |
90 | <Transform DEF='TrajectoryTextTransform'> |
91 | <Shape> |
92 | |
93 | <FontStyle size='0.01' style='BOLD'/> |
94 | </Text> |
95 | <Appearance> |
96 | <Material diffuseColor='0.9 0.7 0.0'/> |
97 | </Appearance> |
98 | </Shape> |
99 | </Transform> |
100 | <Transform translation='0.0 -0.015 0.0'> |
101 | <Shape> |
102 |
<!-- Text
HeightText is a DEF node that has 1 USE node: USE_1 -->
<Text DEF='HeightText' string='"Max Height 0.0"'> |
103 | <FontStyle size='0.01' style='BOLD'/> |
104 | </Text> |
105 | <Appearance> |
106 | <Material diffuseColor='0 1 0'/> |
107 | </Appearance> |
108 | </Shape> |
109 | </Transform> |
110 | </Transform> |
111 | </Transform> |
112 | </Collision> |
113 | </Group> |
114 | </Transform> |
115 | < ROUTE fromNode='HudProx' fromField='position_changed' toNode='HudTransform' toField='set_translation'/> |
116 | < ROUTE fromNode='HudProx' fromField='position_changed' toNode='HudProx' toField='center'/> |
117 | < ROUTE fromNode='HudProx' fromField='orientation_changed' toNode='HudTransform' toField='set_rotation'/> |
118 |
<!-- ROUTE information for ValueDisplayer node:
[from ProjectileInterpolator.value_changed to setTextValues
]
[from HitSensor.isActive to reset
]
-->
<Script DEF='ValueDisplayer' directOutput='true'> |
119 | <field name='setTextValues' type='SFVec3f' accessType='inputOnly'/> |
120 | <field name='reset' type='SFBool' accessType='inputOnly'/> |
121 | <field name='RangeText' type='SFNode' accessType='initializeOnly'> |
122 | <Text USE='RangeText'/> |
123 | </field> |
124 | <field name='HeightText' type='SFNode' accessType='initializeOnly'> |
125 | <Text USE='HeightText'/> |
126 | </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; }
]]>
|
|
128 | </Script> |
129 | < ROUTE fromNode='ProjectileInterpolator' fromField='value_changed' toNode='ValueDisplayer' toField='setTextValues'/> |
130 | <Transform translation='0.0 -0.7 0.0'> |
131 | <Collision> |
132 | <Shape> |
133 | <Appearance> |
134 | <ImageTexture url=' "grass_1.jpg " "https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/grass_1.jpg " "https://www.web3d.org/WorkingGroups/media/textures/nature/grass_1.jpg " '/> |
135 | <TextureTransform scale='8 4'/> |
136 | </Appearance> |
137 | <ElevationGrid xDimension='4' xSpacing='40' zSpacing='25' height='-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'/> |
138 | </Shape> |
139 | </Collision> |
140 | </Transform> |
141 | <Transform translation='0 0 12.5'> |
142 |
<!-- ROUTE information for BallTransform node:
[from ProjectileInterpolator.value_changed to set_translation
]
-->
<Transform DEF='BallTransform'> |
143 | <Shape> |
144 | <Appearance> |
145 | <Material diffuseColor='1 0 0'/> |
146 | </Appearance> |
147 | <Sphere radius='1.5'/> |
148 | </Shape> |
149 | <Viewpoint description='BallView' position='0 10 70'/> |
150 |
<!-- ROUTE information for HitSensor node:
[from touchTime to Timer.set_startTime
]
[from isActive to ValueDisplayer.reset
]
-->
<TouchSensor DEF='HitSensor'/> |
151 | </Transform> |
152 | </Transform> |
153 |
<!-- TimeSensor
Timer is a DEF node that has 1 USE node: USE_1
<!-- ROUTE information for Timer node: [from HitSensor.touchTime to set_startTime ] [from fraction_changed to ProjectileInterpolator.set_fraction ] --> <TimeSensor DEF='Timer' cycleInterval='3.5'/> |
154 | < ROUTE fromNode='Timer' fromField='fraction_changed' toNode='ProjectileInterpolator' toField='set_fraction'/> |
155 | < ROUTE fromNode='HitSensor' fromField='touchTime' toNode='Timer' toField='set_startTime'/> |
156 | < ROUTE fromNode='HitSensor' fromField='isActive' toNode='ValueDisplayer' toField='reset'/> |
157 | < ROUTE fromNode='ProjectileInterpolator' fromField='value_changed' toNode='BallTransform' toField='set_translation'/> |
158 |
<!-- ROUTE information for TimeConverter node:
[from TimeCycle.currentValueFloat to setTime
]
-->
<Script DEF='TimeConverter' directOutput='true'> |
159 | <field name='TimerNode' type='SFNode' accessType='initializeOnly'> |
160 | <TimeSensor USE='Timer'/> |
161 | </field> |
162 | <field name='setTime' type='SFFloat' accessType='inputOnly'/> |
<![CDATA[
ecmascript: function initialize() { } function setTime(inputTime, timeEvent) { TimerNode.cycleInterval = inputTime; }
]]>
|
|
164 | </Script> |
165 | < ROUTE fromNode='TimeCycle' fromField='currentValueFloat' toNode='TimeConverter' toField='setTime'/> |
166 | </Scene> |
167 | </X3D> |
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 |
Timer
TimeSensor set_startTime SFTime |
then
|
Timer
TimeSensor fraction_changed SFFloat |
ProjectileInterpolator
ProtoInstance set_fraction SFFloat |
then
|
ProjectileInterpolator
ProtoInstance value_changed SFVec3f |
ValueDisplayer
Script setTextValues SFVec3f |
|||
then
|
ProjectileInterpolator
ProtoInstance value_changed SFVec3f |
BallTransform
Transform set_translation SFVec3f |
||||||||
HitSensor
TouchSensor isActive SFBool |
ValueDisplayer
Script reset SFBool |
TimeConverter
Script |
No ROUTE connection found for output events from this node. Contains SFNode field with direct access to another node. |
ValueDisplayer
Script |
No ROUTE connection found for output events from this node. Contains SFNode fields with direct access to another node. |
HudProx
ProximitySensor position_changed SFVec3f |
HudTransform
Transform set_translation SFVec3f |
|
HudProx
ProximitySensor orientation_changed SFRotation |
HudTransform
Transform set_rotation SFRotation |
SliderAngle
ProtoInstance currentValueFloat SFFloat |
ProjectileInterpolator
ProtoInstance set_theta SFFloat |
then
|
ProjectileInterpolator
ProtoInstance value_changed SFVec3f |
ValueDisplayer
Script setTextValues SFVec3f |
||
then
|
ProjectileInterpolator
ProtoInstance value_changed SFVec3f |
BallTransform
Transform set_translation SFVec3f |
SliderVelocity
ProtoInstance currentValueFloat SFFloat |
ProjectileInterpolator
ProtoInstance set_Vi SFFloat |
then
|
ProjectileInterpolator
ProtoInstance value_changed SFVec3f |
ValueDisplayer
Script setTextValues SFVec3f |
||
then
|
ProjectileInterpolator
ProtoInstance value_changed SFVec3f |
BallTransform
Transform set_translation SFVec3f |
TimeCycle
ProtoInstance currentValueFloat SFFloat |
TimeConverter
Script setTime SFFloat |
<!--
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>
-->
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->