<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "http://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='http://www.web3d.org/specifications/x3d-3.0.xsd'>
  <head>
    <meta content='Figure15.17WigglingSnakeWithAxes.x3d' name='title'/>
    <meta content='Figure 15.17, The VRML 2.0 Sourcebook, Copyright [1997] By Andrea L. Ames, David R. Nadeau, and John L. Moreland' name='creator'/>
    <meta content='http://www.wiley.com/legacy/compbooks/vrml2sbk/ch15/15fig17.htm' name='reference'/>
    <meta content='Don Brutzman' name='translator'/>
    <meta content='20 August 2000' name='created'/>
    <meta content='14 January 2010' name='modified'/>
    <meta content='A wiggling snake whose spine is animated using a CoordinateInterpolator node.' name='description'/>
    <meta content='http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter15-Extrusion/Figure15.17WigglingSnakeWithAxes.x3d' name='identifier'/>
    <meta content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit' name='generator'/>
    <meta content='../../license.html' name='license'/>
  </head>
  <Scene>
    <!-- Computational cost of Extrusion compared to IndexedFaceSet: quicker to download, takes time to calculate polygonal faces and normals during initial loading, equally fast at run time. -->
    <!-- Authoring capabilities of Extrusion compared to IndexedFaceSet: can be more complicated to express, but also can provide great detail with much less effort. -->
    <!-- Animation considerations: computational cost of modifying spine and recalcuting all polygons/shading during each screen redraw is extremely high, though authorability remains very simple. -->
    <!-- First position and rotate viewpoint into positive-X-Y-Z octant using a Transform -->
    <Transform rotation='0 1 0 0.758' translation='10 5 10'>
      <Viewpoint description='Wiggling snake, seen from behind, using Extrusion and OrientationInterpolator' orientation='1 0 0 -0.3' position='0 0 0'/>
    </Transform>
    <Transform rotation='0 1 0 -1.57' translation='-10 4 0'>
      <Viewpoint description='Snake head' orientation='1 0 0 -0.6' position='0 0 0'/>
    </Transform>
    <!-- Floor plane -->
    <Shape>
      <Appearance>
        <Material diffuseColor='0.6 0.6 0'/>
      </Appearance>
      <Box size='20 0.01 20'/>
    </Shape>
    <!-- Snake -->
    <Transform translation='0 0.3 0'>
      <Shape>
        <Appearance>
          <Material diffuseColor='0 1.0 0.2'/>
        </Appearance>
        <Extrusion DEF='SNAKE' creaseAngle='1.57' crossSection='1.00 0.00 0.92 -0.38 0.71 -0.71 0.38 -0.92 0.00 -1.00 -0.38 -0.92 -0.71 -0.71 -0.92 -0.38 -1.00 -0.0 -0.92 0.38 -0.71 0.71 -0.38 0.92 0.00 1.00 0.38 0.92 0.71 0.71 0.92 0.38 1.00 0.00' scale='0.050 0.020 0.200 0.100 0.400 0.150 0.250 0.250 0.270 0.270 0.300 0.300 0.300 0.300 0.300 0.300 0.300 0.300 0.300 0.300 0.290 0.290 0.290 0.290 0.290 0.290 0.280 0.280 0.280 0.280 0.250 0.250 0.200 0.200 0.100 0.100 0.050 0.050' spine='-4.100 0.0 0.000 -4.0 0.0 0.000 -3.529 0.0 0.674 -3.059 0.0 0.996 -2.588 0.0 0.798 -2.118 0.0 0.184 -1.647 0.0 -0.526 -1.176 0.0 -0.962 -0.706 0.0 -0.895 -0.235 0.0 -0.361 0.235 0.0 0.361 0.706 0.0 0.895 1.176 0.0 0.962 1.647 0.0 0.526 2.118 0.0 -0.184 2.588 0.0 -0.798 3.059 0.0 -0.996 3.529 0.0 -0.674 4.0 0.0 0.0'/>
      </Shape>
    </Transform>
    <!-- Adding this Inline reference to another scene superimposes X3D/VRML coordinate system axes. -->
    <Transform scale='5 5 5'>
      <Inline DEF='CoordinateAxes' url='"../../X3dForWebAuthors/Chapter03-Grouping/CoordinateAxes.x3d" "http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter03-Grouping/CoordinateAxes.x3d" "https://savage.nps.edu/Savage/Tools/Authoring/CoordinateAxes.x3d" "../../X3dForWebAuthors/Chapter03-Grouping/CoordinateAxes.wrl" "http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter03-Grouping/CoordinateAxes.wrl" "https://savage.nps.edu/Savage/Tools/Authoring/CoordinateAxes.wrl"'/>
    </Transform>
    <!-- Animation clock -->
    <TimeSensor DEF='CLOCK' cycleInterval='4' loop='true'/>
    <!-- each keyValue block corresponds to spine position at time 0.0, 0.25, 0.5, 0.75 and 1.0 (matching endpoints are closed so that looping is continuous) -->
    <!-- Animate the snake spine -->
    <CoordinateInterpolator DEF='SNAKE_WIGGLE' key='0.0 0.25 0.50 0.75 1.0' keyValue='-4.100 0 0.000 -4.0 0 0.000 -3.529 0 0.674 -3.059 0 0.996 -2.588 0 0.798 -2.118 0 0.184 -1.647 0 -0.526 -1.176 0 -0.962 -0.706 0 -0.895 -0.235 0 -0.361 0.235 0 0.361 0.706 0 0.895 1.176 0 0.962 1.647 0 0.526 2.118 0 -0.184 2.588 0 -0.798 3.059 0 -0.996 3.529 0 -0.674 4.0 0 0.000 -4.100 0 -1.000 -4.0 0 -1.000 -3.529 0 -0.739 -3.059 0 -0.092 -2.588 0 0.603 -2.118 0 0.983 -1.647 0 0.850 -1.176 0 0.274 -0.706 0 -0.446 -0.235 0 -0.932 0.235 0 -0.932 0.706 0 -0.446 1.176 0 0.274 1.647 0 0.850 2.118 0 0.983 2.588 0 0.603 3.059 0 -0.092 3.529 0 -0.739 4.0 0 -1.000 -4.100 0 0.000 -4.0 0 0.000 -3.529 0 -0.674 -3.059 0 -0.996 -2.588 0 -0.798 -2.118 0 -0.184 -1.647 0 0.526 -1.176 0 0.962 -0.706 0 0.895 -0.235 0 0.361 0.235 0 -0.361 0.706 0 -0.895 1.176 0 -0.962 1.647 0 -0.526 2.118 0 0.184 2.588 0 0.798 3.059 0 0.996 3.529 0 0.674 4.0 0 0.000 -4.100 0 1.000 -4.0 0 1.000 -3.529 0 0.739 -3.059 0 0.092 -2.588 0 -0.603 -2.118 0 -0.983 -1.647 0 -0.850 -1.176 0 -0.274 -0.706 0 0.446 -0.235 0 0.932 0.235 0 0.932 0.706 0 0.446 1.176 0 -0.274 1.647 0 -0.850 2.118 0 -0.983 2.588 0 -0.603 3.059 0 0.092 3.529 0 0.739 4.0 0 1.000 -4.100 0 0.000 -4.0 0 0.000 -3.529 0 0.674 -3.059 0 0.996 -2.588 0 0.798 -2.118 0 0.184 -1.647 0 -0.526 -1.176 0 -0.962 -0.706 0 -0.895 -0.235 0 -0.361 0.235 0 0.361 0.706 0 0.895 1.176 0 0.962 1.647 0 0.526 2.118 0 -0.184 2.588 0 -0.798 3.059 0 -0.996 3.529 0 -0.674 4.0 0 0.0'/>
    <ROUTE fromField='fraction_changed' fromNode='CLOCK' toField='set_fraction' toNode='SNAKE_WIGGLE'/>
    <ROUTE fromField='value_changed' fromNode='SNAKE_WIGGLE' toField='set_spine' toNode='SNAKE'/>
  </Scene>
</X3D>