| 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=' GridYZ_20x20Movable.x3d '/> |
| 6 | <meta name='creator' content='Don Brutzman'/> |
| 7 | <meta name='created' content='8 November 2000'/> |
| 8 | <meta name='modified' content='28 November 2019'/> |
| 9 | <meta name='description' content='Line grid authoring tool for precise measurement in 3D space: drag plane to move along X axis, click numbers to hide grid. Oriented along YZ plane, size 20m by 20m, default block size 1m by 1m.'/> |
| 10 | <meta name='reference' content=' https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/GridsExample.x3d '/> |
| 11 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/GridYZ_20x20Movable.x3d '/> |
| 12 | <meta name='generator' content='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 13 | <meta name='license' content='../../license.html'/> |
| 14 | </head> |
| 15 | <Scene> |
| 16 | <WorldInfo title='GridYZ_20x20Movable.x3d'/> |
| 17 | <Viewpoint description='YZ grid (15 0 30 relative)' orientation='0 1 0 0.465' position='15 0 30'/> |
| 18 | <Viewpoint description='YZ grid (30 0 0 relative)' orientation='0 1 0 1.57079' position='30 0 0'/> |
| 19 | <Viewpoint description='YZ grid (25 0 -25 relative)' orientation='0 1 0 2.37' position='25 0 -25'/> |
| 20 |
<!-- ROUTE information for GridLocation node:
[from LineSensorAxisX.translation_changed to set_translation
]
-->
<Transform DEF='GridLocation'> |
| 21 | <Group> |
| 22 |
<!-- ROUTE information for TextLabelTouchSensor node:
[from isActive to SwitchTextOnOffScript.isTouched
]
-->
<TouchSensor DEF='TextLabelTouchSensor' description='select and hold to hide grid'/> |
| 23 | <Transform translation='0 -0.5 0'> |
| 24 | <Billboard> |
| 25 | <Shape> |
| 26 |
<!-- ROUTE information for CenterText node:
[from CenterTextScript.value to string
]
-->
<Text DEF='CenterText' string='"origin"'> |
| 27 | |
| 28 | </Text> |
| 29 |
<!-- Appearance
DefaultAppearance is a DEF node that has 4 USE nodes: USE_1, USE_2, USE_3, USE_4 -->
<Appearance DEF='DefaultAppearance'> |
| 30 | <Material/> |
| 31 | </Appearance> |
| 32 | </Shape> |
| 33 | </Billboard> |
| 34 | </Transform> |
| 35 | <Transform translation='0 10.5 -10'> |
| 36 | <Billboard> |
| 37 | <Shape> |
| 38 |
<!-- ROUTE information for UpperRightText node:
[from UpperRightTextScript.value to string
]
-->
<Text DEF='UpperRightText' string='"0 10 -10"'> |
| 39 | <FontStyle USE='LABEL_FONT'/> |
| 40 | </Text> |
| 41 | <Appearance USE='DefaultAppearance'/> |
| 42 | </Shape> |
| 43 | </Billboard> |
| 44 | </Transform> |
| 45 | <Transform translation='0 10.5 10'> |
| 46 | <Billboard> |
| 47 | <Shape> |
| 48 |
<!-- ROUTE information for UpperLeftText node:
[from UpperLeftTextScript.value to string
]
-->
<Text DEF='UpperLeftText' string='"0 10 10"'> |
| 49 | <FontStyle USE='LABEL_FONT'/> |
| 50 | </Text> |
| 51 | <Appearance USE='DefaultAppearance'/> |
| 52 | </Shape> |
| 53 | </Billboard> |
| 54 | </Transform> |
| 55 | <Transform translation='0 -10.5 10'> |
| 56 | <Billboard> |
| 57 | <Shape> |
| 58 |
<!-- ROUTE information for LowerLeftText node:
[from LowerLeftTextScript.value to string
]
-->
<Text DEF='LowerLeftText' string='"0 -10 10"'> |
| 59 | <FontStyle USE='LABEL_FONT'/> |
| 60 | </Text> |
| 61 | <Appearance USE='DefaultAppearance'/> |
| 62 | </Shape> |
| 63 | </Billboard> |
| 64 | </Transform> |
| 65 | <Transform translation='0 -10.5 -10'> |
| 66 | <Billboard> |
| 67 | <Shape> |
| 68 |
<!-- ROUTE information for LowerRightText node:
[from LowerRightTextScript.value to string
]
-->
<Text DEF='LowerRightText' string='"0 -10 -10"'> |
| 69 | <FontStyle USE='LABEL_FONT'/> |
| 70 | </Text> |
| 71 | <Appearance USE='DefaultAppearance'/> |
| 72 | </Shape> |
| 73 | </Billboard> |
| 74 | </Transform> |
| 75 | </Group> |
| 76 |
<!-- ROUTE information for GridOnOffSwitch node:
[from SwitchTextOnOffScript.touchChoice to whichChoice
]
-->
<Switch DEF='GridOnOffSwitch' whichChoice='0'> |
| 77 | <Transform rotation='0 0 1 -1.57079'> |
| 78 |
<!-- ROUTE information for GridSensor node:
[from translation_changed to LineSensorAxisX.set_translation
]
-->
<PlaneSensor DEF='GridSensor' description='click and drag to move grid'/> |
| 79 |
<!-- ROUTE information for LineSensorAxisX node:
[from GridSensor.translation_changed to set_translation
]
[from translation_changed to GridLocation.set_translation
]
[from translation_changed to CenterTextScript.set_translation
]
[from translation_changed to UpperRightTextScript.set_translation
]
[from translation_changed to UpperLeftTextScript.set_translation
]
[from translation_changed to LowerLeftTextScript.set_translation
]
[from translation_changed to LowerRightTextScript.set_translation
]
-->
<Script DEF='LineSensorAxisX'> |
| 80 | <field name='set_translation' type='SFVec3f' accessType='inputOnly'/> |
| 81 | <field name='translation_changed' type='SFVec3f' accessType='outputOnly'/> |
<![CDATA[
ecmascript:
// local-coordinates vertical Y is world-coordinates axis X
function set_translation (location, timeStamp) {
translation_changed [0] = location.y;
translation_changed [1] = 0;
translation_changed [2] = 0;
// Browser.println ('location=' + location + ', translation_changed=' + translation_changed);
}
]]>
|
|
| 83 | </Script> |
| 84 |
<!-- Shape
LinesAlignedAlongZ is a DEF node that has 1 USE node: USE_1 -->
<Shape DEF='LinesAlignedAlongZ'> |
| 85 | <IndexedLineSet colorPerVertex='false' colorIndex='1 0 0 0 0 2 0 0 0 0 1 0 0 0 0 2 0 0 0 0 1' coordIndex='1 22 -1 2 23 -1 3 24 -1 4 25 -1 5 26 -1 6 27 -1 7 28 -1 8 29 -1 9 30 -1 10 31 -1 11 32 -1 12 33 -1 13 34 -1 14 35 -1 15 36 -1 16 37 -1 17 38 -1 18 39 -1 19 40 -1 20 41 -1 21 42 -1'> |
| 86 | <Coordinate DEF='EndPoints' point='0 0 0 -10 0 10 -9 0 10 -8 0 10 -7 0 10 -6 0 10 -5 0 10 -4 0 10 -3 0 10 -2 0 10 -1 0 10 0 0 10 1 0 10 2 0 10 3 0 10 4 0 10 5 0 10 6 0 10 7 0 10 8 0 10 9 0 10 10 0 10 -10 0 -10 -9 0 -10 -8 0 -10 -7 0 -10 -6 0 -10 -5 0 -10 -4 0 -10 -3 0 -10 -2 0 -10 -1 0 -10 0 0 -10 1 0 -10 2 0 -10 3 0 -10 4 0 -10 5 0 -10 6 0 -10 7 0 -10 8 0 -10 9 0 -10 10 0 -10'/> |
| 87 | <Color color='0.4 0.4 0.4 0.8 0.2 0 0.4 0.1 0.05'/> |
| 88 | </IndexedLineSet> |
| 89 | </Shape> |
| 90 | <Transform DEF='LinesAlignedAlongX' rotation='0 1 0 1.57079'> |
| 91 | <Shape USE='LinesAlignedAlongZ'/> |
| 92 | </Transform> |
| 93 | <Transform rotation='0 0 1 1.57079' translation='-10.5 0 0'> |
| 94 | <Billboard> |
| 95 | <Shape> |
| 96 | <Text string='"Y"'> |
| 97 | <FontStyle USE='LABEL_FONT'/> |
| 98 | </Text> |
| 99 |
<!-- Appearance
LABEL_APPEARANCE is a DEF node that has 1 USE node: USE_1 -->
<Appearance DEF='LABEL_APPEARANCE'> |
| 100 | <Material diffuseColor='1 1 .3' emissiveColor='.33 .33 .1'/> |
| 101 | </Appearance> |
| 102 | </Shape> |
| 103 | </Billboard> |
| 104 | </Transform> |
| 105 | <Transform rotation='0 0 1 1.57079' translation='0 0 10.5'> |
| 106 | <Billboard> |
| 107 | <Shape> |
| 108 | <Text string='"Z"'> |
| 109 | <FontStyle USE='LABEL_FONT'/> |
| 110 | </Text> |
| 111 | <Appearance USE='LABEL_APPEARANCE'/> |
| 112 | </Shape> |
| 113 | </Billboard> |
| 114 | </Transform> |
| 115 | </Transform> |
| 116 | </Switch> |
| 117 | </Transform> |
| 118 |
<!-- ROUTE information for CenterTextScript node:
[from LineSensorAxisX.translation_changed to set_translation
]
[from value to CenterText.string
]
-->
<Script DEF='CenterTextScript'> |
| 119 | <field name='set_translation' type='SFVec3f' accessType='inputOnly'/> |
| 120 | <field name='value' type='MFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript:
// eventOut 'value' is an MFString array to match type of destination Text node string field
function initialize ( ) {
// Browser.println ('Grid script initialized, print function works');
// trace ('Grid script initialized, trace function works');
}
function set_translation (location, timeStamp) {
numberOfPlaces = 1000;
value[0] = (Math.round (location.x * numberOfPlaces) / numberOfPlaces) + ' '
+ (Math.round (location.y * numberOfPlaces) / numberOfPlaces) + ' '
+ (Math.round (location.z * numberOfPlaces) / numberOfPlaces);
// Browser.println ('location=' + location);
}
]]>
|
|
| 122 | </Script> |
| 123 |
<!-- ROUTE information for UpperRightTextScript node:
[from LineSensorAxisX.translation_changed to set_translation
]
[from value to UpperRightText.string
]
-->
<Script DEF='UpperRightTextScript'> |
| 124 | <field name='set_translation' type='SFVec3f' accessType='inputOnly'/> |
| 125 | <field name='value' type='MFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript:
function set_translation (location, timeStamp) {
numberOfPlaces = 1000;
value[0] = (Math.round (location.x * numberOfPlaces) / numberOfPlaces)
+ ' ' + 10 + ' ' + -10;
}
]]>
|
|
| 127 | </Script> |
| 128 |
<!-- ROUTE information for UpperLeftTextScript node:
[from LineSensorAxisX.translation_changed to set_translation
]
[from value to UpperLeftText.string
]
-->
<Script DEF='UpperLeftTextScript'> |
| 129 | <field name='set_translation' type='SFVec3f' accessType='inputOnly'/> |
| 130 | <field name='value' type='MFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript:
function set_translation (location, timeStamp) {
numberOfPlaces = 1000;
value[0] = (Math.round (location.x * numberOfPlaces) / numberOfPlaces)
+ ' ' + 10 + ' ' + 10;
}
]]>
|
|
| 132 | </Script> |
| 133 |
<!-- ROUTE information for LowerLeftTextScript node:
[from LineSensorAxisX.translation_changed to set_translation
]
[from value to LowerLeftText.string
]
-->
<Script DEF='LowerLeftTextScript'> |
| 134 | <field name='set_translation' type='SFVec3f' accessType='inputOnly'/> |
| 135 | <field name='value' type='MFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript:
function set_translation (location, timeStamp) {
numberOfPlaces = 1000;
value[0] = (Math.round (location.x * numberOfPlaces) / numberOfPlaces)
+ ' ' + -10 + ' ' + 10;
}
]]>
|
|
| 137 | </Script> |
| 138 |
<!-- ROUTE information for LowerRightTextScript node:
[from LineSensorAxisX.translation_changed to set_translation
]
[from value to LowerRightText.string
]
-->
<Script DEF='LowerRightTextScript'> |
| 139 | <field name='set_translation' type='SFVec3f' accessType='inputOnly'/> |
| 140 | <field name='value' type='MFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript:
function set_translation (location, timeStamp) {
numberOfPlaces = 1000;
value[0] = (Math.round (location.x * numberOfPlaces) / numberOfPlaces)
+ ' ' + -10 + ' ' + -10;
}
]]>
|
|
| 142 | </Script> |
| 143 |
<!-- ROUTE information for SwitchTextOnOffScript node:
[from TextLabelTouchSensor.isActive to isTouched
]
[from touchChoice to GridOnOffSwitch.whichChoice
]
-->
<Script DEF='SwitchTextOnOffScript'> |
| 144 | <field name='isTouched' type='SFBool' accessType='inputOnly'/> |
| 145 | <field name='touchChoice' type='SFInt32' accessType='outputOnly'/> |
<![CDATA[
ecmascript:
function isTouched (value, timeStamp) {
if (value == true)
touchChoice = -1;
else touchChoice = 0;
}
]]>
|
|
| 147 | </Script> |
| 148 | < ROUTE fromNode='GridSensor' fromField='translation_changed' toNode='LineSensorAxisX' toField='set_translation'/> |
| 149 | <!-- Send changed position to text-construction scripts --> |
| 150 | < ROUTE fromNode='LineSensorAxisX' fromField='translation_changed' toNode='GridLocation' toField='set_translation'/> |
| 151 | < ROUTE fromNode='LineSensorAxisX' fromField='translation_changed' toNode='CenterTextScript' toField='set_translation'/> |
| 152 | < ROUTE fromNode='LineSensorAxisX' fromField='translation_changed' toNode='UpperRightTextScript' toField='set_translation'/> |
| 153 | < ROUTE fromNode='LineSensorAxisX' fromField='translation_changed' toNode='UpperLeftTextScript' toField='set_translation'/> |
| 154 | < ROUTE fromNode='LineSensorAxisX' fromField='translation_changed' toNode='LowerLeftTextScript' toField='set_translation'/> |
| 155 | < ROUTE fromNode='LineSensorAxisX' fromField='translation_changed' toNode='LowerRightTextScript' toField='set_translation'/> |
| 156 | <!-- Send text showing changed position to output Text nodes --> |
| 157 | < ROUTE fromNode='CenterTextScript' fromField='value' toNode='CenterText' toField='string'/> |
| 158 | < ROUTE fromNode='UpperRightTextScript' fromField='value' toNode='UpperRightText' toField='string'/> |
| 159 | < ROUTE fromNode='UpperLeftTextScript' fromField='value' toNode='UpperLeftText' toField='string'/> |
| 160 | < ROUTE fromNode='LowerLeftTextScript' fromField='value' toNode='LowerLeftText' toField='string'/> |
| 161 | < ROUTE fromNode='LowerRightTextScript' fromField='value' toNode='LowerRightText' toField='string'/> |
| 162 | <!-- Enable/disable grid visibility based on user touching coordinate labels --> |
| 163 | < ROUTE fromNode='TextLabelTouchSensor' fromField='isActive' toNode='SwitchTextOnOffScript' toField='isTouched'/> |
| 164 | < ROUTE fromNode='SwitchTextOnOffScript' fromField='touchChoice' toNode='GridOnOffSwitch' toField='whichChoice'/> |
| 165 | </Scene> |
| 166 | </X3D> |
Event Graph ROUTE Table entries with 14 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.
|
TextLabelTouchSensor
TouchSensor isActive SFBool |
SwitchTextOnOffScript
Script isTouched SFBool |
then
|
SwitchTextOnOffScript
Script touchChoice SFInt32 |
GridOnOffSwitch
Switch whichChoice SFInt32 |
<!--
Color-coding 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)
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->