<?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=' Figure09_9DeskLampWithAxes.x3d '/>
<meta name='creatorcontent='Figure 9.9, The VRML 2.0 Sourcebook, Copyright [1997] By Andrea L. Ames, David R. Nadeau, and John L. Moreland'/>
<meta name='referencecontent=' http://www.wiley.com/legacy/compbooks/vrml2sbk/ch09/09fig09.htm '/>
<meta name='transcribercontent='Don Brutzman'/>
<meta name='createdcontent='12 August 2000'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='Imagecontent='Figure09_9DeskLampWithAxes.SlideshowSnapshot.png' />
<meta name='descriptioncontent='A desk lamp with arm angles that can be adjusted using nested sensors, with coordinate axes superimposed to show X3D/VRML directions.'/>
<meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter09SensingViewer/Figure09_9DeskLampWithAxes.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../../license.html'/>
</head>
<!-- -->
<Scene>
<WorldInfo title='Figure09_9DeskLampWithAxes.x3d'/>
<Viewpoint description='Desk lamporientation='0 1 0 0.29position='0.3 0.2 1'/>
<!-- First rotate PlaneSensor to horizontal XZ (Y = 0) plane -->
<Transform rotation='1 0 0 1.57'>
<!-- ROUTE information for MOVE_LAMP node:  [from translation_changed to LAMP_TRANSFORM.set_translation ] -->
<PlaneSensor DEF='MOVE_LAMPdescription='drag to move lampmaxPosition='0.1 0.1minPosition='-0.1 -0.1'/>

<!-- ROUTE information for LAMP_TRANSFORM node:  [from MOVE_LAMP.translation_changed to set_translation ] -->
<Transform DEF='LAMP_TRANSFORM'>
<!-- Note that we are connecting a chain of behavior engines in these ROUTEs. The event types passed via each ROUTE must each match. -->
< ROUTE  fromNode=' MOVE_LAMP' fromField='translation_changed' toNode=' LAMP_TRANSFORM' toField='set_translation'/>
<!-- Now rotate back so that actual geometry remains in original coordinate system -->
<Transform rotation='1 0 0 -1.57'>
<Shape>
<Cylinder height='0.01radius='0.1'/>
<Appearance DEF='WHITE'>
<Material diffuseColor='.9 .9 .9'/>
</Appearance>
</Shape>
<Group>
<!-- ROUTE information for MOVE_FIRST_ARM node:  [from rotation_changed to FIRST_ARM_TRANSFORM.set_rotation ] -->
<SphereSensor DEF='MOVE_FIRST_ARMdescription='rotate first armoffset='1 0 0 -0.7'/>

<!-- ROUTE information for FIRST_ARM_TRANSFORM node:  [from MOVE_FIRST_ARM.rotation_changed to set_rotation ] -->
<Transform DEF='FIRST_ARM_TRANSFORMcenter='0 -0.15 0rotation='1 0 0 -0.7translation='0 0.15 0'>
< ROUTE  fromNode=' MOVE_FIRST_ARM' fromField='rotation_changed' toNode=' FIRST_ARM_TRANSFORM' toField='set_rotation'/>
<Shape DEF='LAMP_ARM'>
<Appearance DEF='LIGHT_BROWN'>
<Material diffuseColor='.6 .6 .2'/>
</Appearance>
<Cylinder height='0.3radius='0.01'/>
</Shape>
<Group>
<!-- ROUTE information for MOVE_SECOND_ARM node:  [from rotation_changed to SECOND_ARM_TRANSFORM.set_rotation ] -->
<SphereSensor DEF='MOVE_SECOND_ARMdescription='rotate second armoffset='1 0 0 1.9'/>

<!-- ROUTE information for SECOND_ARM_TRANSFORM node:  [from MOVE_SECOND_ARM.rotation_changed to set_rotation ] -->
<Transform DEF='SECOND_ARM_TRANSFORMcenter='0 -0.15 0rotation='1 0 0 1.9translation='0 0.3 0'>
< ROUTE  fromNode=' MOVE_SECOND_ARM' fromField='rotation_changed' toNode=' SECOND_ARM_TRANSFORM' toField='set_rotation'/>
<Shape USE=' LAMP_ARM'/>
<Group>
<!-- ROUTE information for MOVE_LAMP_SHADE node:  [from rotation_changed to LAMP_SHADE_TRANSFORM.set_rotation ] -->
<SphereSensor DEF='MOVE_LAMP_SHADEdescription='rotate lamp shadeoffset='1 0 0 -1.25'/>

<!-- ROUTE information for LAMP_SHADE_TRANSFORM node:  [from MOVE_LAMP_SHADE.rotation_changed to set_rotation ] -->
<Transform DEF='LAMP_SHADE_TRANSFORMcenter='0 0.07 0rotation='1 0 0 -1.25translation='0 0.075 0'>
< ROUTE  fromNode=' MOVE_LAMP_SHADE' fromField='rotation_changed' toNode=' LAMP_SHADE_TRANSFORM' toField='set_rotation'/>
<Shape>
<Appearance>
<Material diffuseColor='.1 .6 .6'/>
</Appearance>
<Cone bottom='falsebottomRadius='0.12height='0.15'/>
</Shape>
<Transform translation='0 -0.05 0'>
<Shape>
<Appearance>
<Material diffuseColor='.4 .4 .1emissiveColor='.8 .8 .2'/>
</Appearance>
<Sphere radius='0.05'/>
</Shape>
<SpotLight beamWidth='1.570796color='.8 .8 .1cutOffAngle='.785398direction='0 -1 0'/>
</Transform>
</Transform>
</Group>
</Transform>
</Group>
</Transform>
</Group>
</Transform>
</Transform>
</Transform>
<!-- Adding this Inline reference to another scene superimposes X3D/VRML coordinate system axes. -->
<Transform scale='.25 .25 .25'> </Transform>
</Scene>
</X3D>
<!--

to top <!-- Event Graph ROUTE Table shows event connections -->
 
<!-- Index for DEF nodes: CoordinateAxes, FIRST_ARM_TRANSFORM, LAMP_ARM, LAMP_SHADE_TRANSFORM, LAMP_TRANSFORM, LIGHT_BROWN, MOVE_FIRST_ARM, MOVE_LAMP, MOVE_LAMP_SHADE, MOVE_SECOND_ARM, SECOND_ARM_TRANSFORM, WHITE

Index for Viewpoint node: Viewpoint_1
-->

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

MOVE_FIRST_ARM
SphereSensor
rotation_changed
SFRotation

ROUTE
event to
(1)
FIRST_ARM_TRANSFORM
Transform
set_rotation
SFRotation


MOVE_LAMP_SHADE
SphereSensor
rotation_changed
SFRotation

ROUTE
event to
(1)
LAMP_SHADE_TRANSFORM
Transform
set_rotation
SFRotation


MOVE_SECOND_ARM
SphereSensor
rotation_changed
SFRotation

ROUTE
event to
(1)
SECOND_ARM_TRANSFORM
Transform
set_rotation
SFRotation


MOVE_LAMP
PlaneSensor
translation_changed
SFVec3f

ROUTE
event to
(1)
LAMP_TRANSFORM
Transform
set_translation
SFVec3f


-->

<!-- Online at
https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter09SensingViewer/Figure09_9DeskLampWithAxesIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter09SensingViewer/Figure09_9DeskLampWithAxes.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)
-->

to top <!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->