1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "http://www.web3d.org/specifications/x3d-3.3.dtd">
3
<X3D profile='Full' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.3.xsd'>
5
<meta name='comment' content='World of Titania'/>
8
<ExternProtoDeclare name='Grid' url='"Grid.x3d#Grid"'>
9
<field accessType='inputOutput' type='SFVec3f' name='translation'/>
10
<field accessType='inputOutput' type='SFRotation' name='rotation'/>
11
<field accessType='inputOutput' type='SFVec3f' name='scale'/>
12
<field accessType='inputOutput' type='MFInt32' name='dimension'/>
13
<field accessType='inputOutput' type='MFInt32' name='majorLineEvery'/>
14
<field accessType='inputOutput' type='MFInt32' name='majorLineOffset'/>
15
<field accessType='inputOutput' type='SFVec3f' name='planeOffset'/>
16
<field accessType='inputOutput' type='SFColor' name='planeColor'/>
17
<field accessType='inputOutput' type='SFFloat' name='planeTransparency'/>
18
<field accessType='inputOutput' type='SFColor' name='lineColor'/>
19
<field accessType='inputOutput' type='SFFloat' name='lineTransparency'/>
20
<field accessType='inputOutput' type='SFColor' name='majorLineColor'/>
21
<field accessType='inputOutput' type='SFFloat' name='majorLineTransparency'/>
22
<field accessType='inputOutput' type='SFVec3f' name='numberOffset'/>
23
<field accessType='inputOutput' type='SFNode' name='numberAppearance'/>
24
<field accessType='inputOutput' type='SFNode' name='numberFontStyle'/>
25
<field accessType='initializeOnly' type='SFBool' name='solid'/>
27
<ExternProtoDeclare name='LineTrail' url='"LineTrail.x3d#LineTrail"'>
28
<field accessType='inputOutput' type='SFTime' name='resetTime'/>
29
<field accessType='inputOutput' type='SFVec3f' name='point'/>
30
<field accessType='inputOutput' type='SFInt32' name='dimension'/>
33
type='"PLANE_create3000.de"'
34
transitionType='"ANIMATE"'/>
36
description='Initial View'
37
position='0 0 28.9553'/>
39
<ProtoInstance name='Grid'>
40
<fieldValue name='rotation' value='1 0 0 1.5707963'/>
41
<fieldValue name='dimension' value='60, 0, 30'/>
42
<fieldValue name='planeOffset' value='0 -0.001 0'/>
43
<fieldValue name='planeColor' value='1 1 1'/>
44
<fieldValue name='planeTransparency' value='0'/>
45
<fieldValue name='lineColor' value='0 0 0'/>
46
<fieldValue name='majorLineColor' value='0 0 0'/>
47
<fieldValue name='majorLineTransparency' value='0.4'/>
48
<fieldValue name='numberOffset' value='-0.1 0 0.14'/>
49
<fieldValue name='numberAppearance'>
50
<Appearance DEF='_1' containerField='children'>
52
diffuseColor='0 0 0'/>
55
<fieldValue name='numberFontStyle'>
56
<ScreenFontStyle DEF='_2' containerField='children'
57
justify='"END", "BEGIN"'/>
60
<TouchSensor DEF='Touch'/>
61
<Script DEF='PickingScript'>
62
<field accessType='inputOnly' type='SFTime' name='set_touchTime'/>
63
<field accessType='inputOnly' type='SFVec3f' name='set_hitPoint'/>
64
<field accessType='inputOutput' type='SFInt32' name='pointType'/>
65
<field accessType='inputOutput' type='SFBool' name='active'/>
66
<field accessType='outputOnly' type='SFTime' name='doubleClickTime'/>
67
<field accessType='initializeOnly' type='SFTime' name='doubleClickInterval' value='0.3'/>
68
<field accessType='initializeOnly' type='SFFloat' name='pointSize' value='0.5'/>
69
<field accessType='initializeOnly' type='SFNode' name='xInterpolator'>
70
<ScalarInterpolator DEF='XInterpolator'
71
key='0, 0.375, 0.75, 1'
72
keyValue='-20, -5, 10, 20'/>
74
<field accessType='initializeOnly' type='SFNode' name='yInterpolator'>
75
<SplineScalarInterpolator DEF='YInterpolator'
77
keyValue='-10, 5, -5, 10'
78
keyVelocity='0, 0, 0, 0'/>
85
hitPoint = new SFVec2f (),
86
offset = new SFVec2f (),
91
function initialize ()
93
xInterpolator .key = new MFFloat (0, 0.375, 0.75, 1);
94
xInterpolator .keyValue = new MFFloat (-20, -5, 10, 20);
95
yInterpolator .keyValue = new MFFloat (-10, 5, -5, 10);
96
yInterpolator .keyVelocity = new MFFloat (0, 0, 0, 0);
99
function set_touchTime (value, time)
101
if (pointType == VELOCITY)
104
if (value - firstTime > doubleClickInterval)
110
doubleClickTime = time;
112
if (pointType == SPLINE)
114
if (pointIndex < 0 || pointIndex >= xInterpolator .keyValue .length)
122
function set_hitPoint (value, time)
124
hitPoint .x = value .x;
125
hitPoint .y = value .y;
130
if (pointIndex < 0 || pointIndex >= xInterpolator .keyValue .length)
136
xInterpolator .keyValue [pointIndex] = hitPoint .x + offset .x;
137
yInterpolator .keyValue [pointIndex] = hitPoint .y + offset .y;
140
yInterpolator .keyVelocity [pointIndex] = ((hitPoint .y + offset .y) - yInterpolator .keyValue [pointIndex]) / velocityScale;
145
function set_active (value, time)
150
pointIndex = pick (hitPoint);
153
function pick (hitPoint)
157
for (var i = 0, length = xInterpolator .keyValue .length; i < length; ++ i)
161
if (pointType == VELOCITY)
162
yOffset = yInterpolator .keyVelocity [i] * velocityScale;
164
var point = new SFVec2f (xInterpolator .keyValue [i],
165
yInterpolator .keyValue [i] + yOffset);
167
offset = point .subtract (hitPoint);
169
if (offset .length () > pointSize)
181
var pointIndex = getAddPointIndex ()
183
xInterpolator .keyValue .splice (pointIndex, 0, hitPoint .x);
184
yInterpolator .keyValue .splice (pointIndex, 0, hitPoint .y);
185
yInterpolator .keyVelocity .splice (pointIndex, 0, 0);
187
setXInterpolatorKey ();
190
function removePoint ()
192
var pointIndex = getRemovePointIndex ()
194
xInterpolator .keyValue .splice (pointIndex, 1);
195
yInterpolator .keyValue .splice (pointIndex, 1);
196
yInterpolator .keyVelocity .splice (pointIndex, 1);
198
setXInterpolatorKey ();
201
function getAddPointIndex ()
203
for (var i = 0, length = xInterpolator .keyValue .length; i < length; ++ i)
205
if (xInterpolator .keyValue [i] > hitPoint .x)
212
function getRemovePointIndex ()
215
first = xInterpolator .keyValue [0];
216
last = xInterpolator .keyValue [xInterpolator .keyValue .length - 1];
218
if (hitPoint .x < first)
221
if (hitPoint .x > last)
222
return xInterpolator .keyValue .length - 1;
224
return pick (hitPoint);
227
function setXInterpolatorKey ()
229
if (xInterpolator .keyValue .length)
232
first = xInterpolator .keyValue [0];
233
last = xInterpolator .keyValue [xInterpolator .keyValue .length - 1];
234
distance = last - first,
238
for (var i = 1, length = xInterpolator .keyValue .length; i < length; ++ i)
240
var point0 = new SFVec2f (xInterpolator .keyValue [i - 1],
241
yInterpolator .keyValue [i - 1]);
243
var point1 = new SFVec2f (xInterpolator .keyValue [i],
244
yInterpolator .keyValue [i]);
246
totalLength += point1 .subtract (point0) .length ();
249
xInterpolator .key [0] = 0;
251
for (var i = 1, length = xInterpolator .keyValue .length; i < length; ++ i)
253
var point0 = new SFVec2f (xInterpolator .keyValue [i - 1],
254
yInterpolator .keyValue [i - 1]);
256
var point1 = new SFVec2f (xInterpolator .keyValue [i],
257
yInterpolator .keyValue [i]);
259
lengthSoFar += point1 .subtract (point0) .length ();
261
xInterpolator .key [i] = lengthSoFar / totalLength;
264
xInterpolator .key .length = length;
268
xInterpolator .key .length = 0;
274
<Group DEF='LineTrail'>
275
<TimeSensor DEF='Timer'
278
<ScalarInterpolator USE='XInterpolator'/>
279
<SplineScalarInterpolator USE='YInterpolator'/>
280
<Script DEF='TrailScript'>
281
<field accessType='inputOnly' type='SFFloat' name='set_y'/>
282
<field accessType='outputOnly' type='SFVec3f' name='point_changed'/>
283
<field accessType='initializeOnly' type='SFNode' name='xInterpolator'>
284
<ScalarInterpolator USE='XInterpolator'/>
286
<field accessType='initializeOnly' type='SFNode' name='yInterpolator'>
287
<SplineScalarInterpolator USE='YInterpolator'/>
291
function set_y (value, time)
293
point_changed .x = xInterpolator .value_changed;
294
point_changed .y = yInterpolator .value_changed;
301
linewidthScaleFactor='3'/>
303
emissiveColor='0.552941 0.270588 0.14902'/>
305
<ProtoInstance name='LineTrail' DEF='Trail' containerField='geometry'>
306
<fieldValue name='resetTime' value='1505552564.37677'/>
307
<fieldValue name='point' value='-20 -10 0'/>
308
<fieldValue name='dimension' value='1000'/>
312
<Switch DEF='PointTypeSwitch'
314
<Transform DEF='Points'>
315
<Script DEF='PointsScript'>
316
<field accessType='inputOnly' type='MFFloat' name='set_x'/>
317
<field accessType='inputOnly' type='MFFloat' name='set_y'/>
318
<field accessType='initializeOnly' type='SFNode' name='points'>
319
<Polypoint2D DEF='_3'
320
point='-20 -10, -5 5, 10 -5, 20 10'/>
322
<field accessType='initializeOnly' type='SFNode' name='xInterpolator'>
323
<ScalarInterpolator USE='XInterpolator'/>
325
<field accessType='initializeOnly' type='SFNode' name='yInterpolator'>
326
<SplineScalarInterpolator USE='YInterpolator'/>
330
function initialize ()
335
function eventsProcessed ()
337
for (var i = 0, length = xInterpolator .keyValue .length; i < length; ++ i)
339
points .point [i] .x = xInterpolator .keyValue [i];
340
points .point [i] .y = yInterpolator .keyValue [i];
343
points .point .length = i;
349
<LineProperties DEF='_4'
350
linewidthScaleFactor='20'/>
352
emissiveColor='1 0.75 0.5'/>
354
<Polypoint2D USE='_3'/>
358
<LineProperties DEF='_5'
359
linewidthScaleFactor='8'/>
361
emissiveColor='1 0.5 0'/>
363
<Polypoint2D USE='_3'/>
366
<Transform DEF='KeyVelocity'>
367
<Script DEF='KeyVelocityScript'>
368
<field accessType='inputOnly' type='MFFloat' name='set_x'/>
369
<field accessType='inputOnly' type='MFFloat' name='set_y'/>
370
<field accessType='inputOnly' type='MFFloat' name='set_velocity'/>
371
<field accessType='initializeOnly' type='SFNode' name='lines'>
373
vertexCount='2, 2, 2, 2'>
375
point='-20 -10 0, -20 -10 0, -5 5 0, -5 5 0, 10 -5 0, 10 -5 0, 20 10 0, 20 10 0'/>
378
<field accessType='initializeOnly' type='SFNode' name='points'>
379
<Polypoint2D DEF='_7'
380
point='-20 -10, -5 5, 10 -5, 20 10'/>
382
<field accessType='initializeOnly' type='SFNode' name='xInterpolator'>
383
<ScalarInterpolator USE='XInterpolator'/>
385
<field accessType='initializeOnly' type='SFNode' name='yInterpolator'>
386
<SplineScalarInterpolator USE='YInterpolator'/>
390
var velocityScale = 0.5;
392
function initialize ()
397
function eventsProcessed ()
399
for (var i = 0, length = xInterpolator .keyValue .length; i < length; ++ i)
402
x = xInterpolator .keyValue [i],
403
y = yInterpolator .keyValue [i],
404
v = y + yInterpolator .keyVelocity [i] * velocityScale;
406
lines .vertexCount [i] = 2;
408
lines .coord .point [i * 2 + 0] .x = x;
409
lines .coord .point [i * 2 + 0] .y = y;
410
lines .coord .point [i * 2 + 1] .x = x;
411
lines .coord .point [i * 2 + 1] .y = v;
413
points .point [i] .x = x;
414
points .point [i] .y = v;
417
lines .vertexCount .length = i;
418
lines .coord .point .length = i * 2;
419
points .point .length = i;
426
linewidthScaleFactor='2'/>
428
emissiveColor='0.117647 0.564706 1'/>
434
<LineProperties USE='_5'/>
437
<Polypoint2D USE='_3'/>
441
<LineProperties USE='_4'/>
443
emissiveColor='0.429132 0.718372 1'/>
445
<Polypoint2D USE='_7'/>
449
<LineProperties USE='_5'/>
452
<Polypoint2D USE='_7'/>
456
<ROUTE fromNode='XInterpolator' fromField='value_changed' toNode='YInterpolator' toField='set_fraction'/>
457
<ROUTE fromNode='Timer' fromField='fraction_changed' toNode='XInterpolator' toField='set_fraction'/>
458
<ROUTE fromNode='YInterpolator' fromField='value_changed' toNode='TrailScript' toField='set_y'/>
459
<ROUTE fromNode='TrailScript' fromField='point_changed' toNode='Trail' toField='set_point'/>
460
<ROUTE fromNode='Timer' fromField='cycleTime' toNode='Trail' toField='set_resetTime'/>
461
<ROUTE fromNode='XInterpolator' fromField='keyValue_changed' toNode='YInterpolator' toField='set_key'/>
462
<ROUTE fromNode='XInterpolator' fromField='keyValue_changed' toNode='PointsScript' toField='set_x'/>
463
<ROUTE fromNode='YInterpolator' fromField='keyValue_changed' toNode='PointsScript' toField='set_y'/>
464
<ROUTE fromNode='Touch' fromField='isActive' toNode='PickingScript' toField='set_active'/>
465
<ROUTE fromNode='Touch' fromField='hitPoint_changed' toNode='PickingScript' toField='set_hitPoint'/>
466
<ROUTE fromNode='Touch' fromField='touchTime' toNode='PickingScript' toField='set_touchTime'/>
467
<ROUTE fromNode='PickingScript' fromField='doubleClickTime' toNode='Trail' toField='set_resetTime'/>
468
<ROUTE fromNode='PointTypeSwitch' fromField='whichChoice_changed' toNode='PickingScript' toField='set_pointType'/>
469
<ROUTE fromNode='XInterpolator' fromField='keyValue_changed' toNode='KeyVelocityScript' toField='set_x'/>
470
<ROUTE fromNode='YInterpolator' fromField='keyValue_changed' toNode='KeyVelocityScript' toField='set_y'/>
471
<ROUTE fromNode='YInterpolator' fromField='keyVelocity_changed' toNode='KeyVelocityScript' toField='set_velocity'/>