<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package X3dForWebAuthors.Chapter12EnvironmentSensorSound;

import org.web3d.x3d.jsail.Core.*;
import org.web3d.x3d.jsail.EnvironmentalEffects.*;
import org.web3d.x3d.jsail.fields.*;
import org.web3d.x3d.jsail.Geometry3D.*;
import org.web3d.x3d.jsail.Grouping.*;
import org.web3d.x3d.jsail.Interpolation.*;
import org.web3d.x3d.jsail.Navigation.*;
import org.web3d.x3d.jsail.Networking.*;
import org.web3d.x3d.jsail.Shape.*;
import org.web3d.x3d.jsail.Time.*;

// Javadoc metadata annotations follow, see below for X3DJSAIL Java source code.
/**
 * &lt;p&gt; Disabled collision with all objects with a Collision node in the Kelp Forest world. &lt;/p&gt;
 &lt;p&gt; Related links: Catalog page &lt;a href="../../../Chapter12EnvironmentSensorSound/CollisionKelpForestMainIndex.html" target="_blank"&gt;CollisionKelpForestMain&lt;/a&gt;,  source &lt;a href="../../../Chapter12EnvironmentSensorSound/CollisionKelpForestMain.java"&gt;CollisionKelpForestMain.java&lt;/a&gt;, &lt;a href="https://www.web3d.org/x3d/content/examples/X3dResources.html" target="_blank"&gt;X3D Resources&lt;/a&gt;, &lt;a href="https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html" target="_blank"&gt;X3D Scene Authoring Hints&lt;/a&gt;, and &lt;a href="https://www.web3d.org/x3d/content/X3dTooltips.html" target="_blank"&gt;X3D Tooltips&lt;/a&gt;. &lt;/p&gt;
	&lt;table style="color:black; border:0px solid; border-spacing:10px 0px;"&gt;
        &lt;caption&gt;Scene Meta Information&lt;/caption&gt;
		&lt;tr style="background-color:silver; border-color:silver;"&gt;
			&lt;td style="text-align:center; padding:10px 0px;"&gt;&lt;i&gt;meta tags&lt;/i&gt;&lt;/td&gt;
			&lt;td style="text-align:left;   padding:10px 0px;"&gt;&amp;nbsp; Document Metadata &lt;/td&gt;
		&lt;/tr&gt;

		&lt;tr&gt;
			&lt;td style="text-align:right; vertical-align: text-top;"&gt; &lt;i&gt; title &lt;/i&gt; &lt;/td&gt;
			&lt;td&gt; &lt;a href="../../../Chapter12EnvironmentSensorSound/CollisionKelpForestMain.x3d"&gt;CollisionKelpForestMain.x3d&lt;/a&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="text-align:right; vertical-align: text-top;"&gt; &lt;i&gt; description &lt;/i&gt; &lt;/td&gt;
			&lt;td&gt; Disabled collision with all objects with a Collision node in the Kelp Forest world. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="text-align:right; vertical-align: text-top;"&gt; &lt;i&gt; creator &lt;/i&gt; &lt;/td&gt;
			&lt;td&gt; Don Brutzman Revised: Leonard Daly for X3D Book &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="text-align:right; vertical-align: text-top;"&gt; &lt;i&gt; created &lt;/i&gt; &lt;/td&gt;
			&lt;td&gt; 1 June 1998 &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="text-align:right; vertical-align: text-top;"&gt; &lt;i&gt; modified &lt;/i&gt; &lt;/td&gt;
			&lt;td&gt; 29 October 2023 &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="text-align:right; vertical-align: text-top;"&gt; &lt;i&gt; reference &lt;/i&gt; &lt;/td&gt;
			&lt;td&gt; &lt;a href="http://faculty.nps.edu/brutzman/kelp" target="_blank"&gt;http://faculty.nps.edu/brutzman/kelp&lt;/a&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="text-align:right; vertical-align: text-top;"&gt; &lt;i&gt; reference &lt;/i&gt; &lt;/td&gt;
			&lt;td&gt; &lt;a href="http://faculty.nps.edu/brutzman/kelp/KelpForestDesignPaper.pdf" target="_blank"&gt;http://faculty.nps.edu/brutzman/kelp/KelpForestDesignPaper.pdf&lt;/a&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="text-align:right; vertical-align: text-top;"&gt; &lt;i&gt; subject &lt;/i&gt; &lt;/td&gt;
			&lt;td&gt; Kelp Forest 3D models &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="text-align:right; vertical-align: text-top;"&gt; &lt;i&gt; accessRights &lt;/i&gt; &lt;/td&gt;
			&lt;td&gt; All content has permissions for free use. Please provide credit to the Naval Postgraduate School (NPS) Modeling Virtual Environments and Simulation (MOVES) Institute. &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="text-align:right; vertical-align: text-top;"&gt; &lt;i&gt; reference &lt;/i&gt; &lt;/td&gt;
			&lt;td&gt; &lt;a href="https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/KelpForestMain.x3d" target="_blank"&gt;https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/KelpForestMain.x3d&lt;/a&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="text-align:right; vertical-align: text-top;"&gt; &lt;i&gt; identifier &lt;/i&gt; &lt;/td&gt;
			&lt;td&gt; &lt;a href="https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter12EnvironmentSensorSound/CollisionKelpForestMain.x3d" target="_blank"&gt;https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter12EnvironmentSensorSound/CollisionKelpForestMain.x3d&lt;/a&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="text-align:right; vertical-align: text-top;"&gt; &lt;i&gt; generator &lt;/i&gt; &lt;/td&gt;
			&lt;td&gt; X3D-Edit 4.0, &lt;a href="https://savage.nps.edu/X3D-Edit" target="_blank"&gt;https://savage.nps.edu/X3D-Edit&lt;/a&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="text-align:right; vertical-align: text-top;"&gt; &lt;i&gt; license &lt;/i&gt; &lt;/td&gt;
			&lt;td&gt; &lt;a href="../../../Chapter12EnvironmentSensorSound/../license.html"&gt;../license.html&lt;/a&gt; &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style="background-color:silver; border-color:silver;"&gt;
			&lt;td style="text-align:center;" colspan="2"&gt;  &amp;nbsp; &lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;

	&lt;p&gt;
		This program uses the
		&lt;a href="https://www.web3d.org/specifications/java/X3DJSAIL.html" target="_blank"&gt;X3D Java Scene Access Interface Library (X3DJSAIL)&lt;/a&gt;.
		It has been produced using the 
		&lt;a href="https://www.web3d.org/x3d/stylesheets/X3dToJava.xslt" target="_blank"&gt;X3dToJava.xslt&lt;/a&gt;
		stylesheet
	       (&lt;a href="https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/X3dToJava.xslt" target="_blank"&gt;version control&lt;/a&gt;)
                which is used to create Java source code from an original &lt;code&gt;.x3d&lt;/code&gt; model.
	&lt;/p&gt;

	* @author Don Brutzman Revised: Leonard Daly for X3D Book
 */

public class CollisionKelpForestMain
{
	/** Default constructor to create this object. */
	public CollisionKelpForestMain ()
	{
	  initialize();
	}

	/** Create and initialize the X3D model for this object. */
	public final void initialize()
	{
            try { // catch-all
  x3dModel = new X3D().setProfile(X3D.PROFILE_IMMERSIVE).setVersion(X3D.VERSION_3_3)
  .setHead(new head()
    .addMeta(new meta().setName(meta.NAME_TITLE      ).setContent("CollisionKelpForestMain.x3d"))
    .addMeta(new meta().setName(meta.NAME_DESCRIPTION).setContent("Disabled collision with all objects with a Collision node in the Kelp Forest world."))
    .addMeta(new meta().setName(meta.NAME_CREATOR    ).setContent("Don Brutzman Revised: Leonard Daly for X3D Book"))
    .addMeta(new meta().setName(meta.NAME_CREATED    ).setContent("1 June 1998"))
    .addMeta(new meta().setName(meta.NAME_MODIFIED   ).setContent("29 October 2023"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("http://faculty.nps.edu/brutzman/kelp"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("http://faculty.nps.edu/brutzman/kelp/KelpForestDesignPaper.pdf"))
    .addMeta(new meta().setName(meta.NAME_SUBJECT    ).setContent("Kelp Forest 3D models"))
    .addMeta(new meta().setName(meta.NAME_ACCESSRIGHTS).setContent("All content has permissions for free use. Please provide credit to the Naval Postgraduate School (NPS) Modeling Virtual Environments and Simulation (MOVES) Institute."))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/KelpForestMain.x3d"))
    .addMeta(new meta().setName(meta.NAME_IDENTIFIER ).setContent("https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter12EnvironmentSensorSound/CollisionKelpForestMain.x3d"))
    .addMeta(new meta().setName(meta.NAME_GENERATOR  ).setContent("X3D-Edit 4.0, https://savage.nps.edu/X3D-Edit"))
    .addMeta(new meta().setName(meta.NAME_LICENSE    ).setContent("../license.html")))
  .setScene(new Scene()
    .addChild(new Collision().setEnabled(false)
      .addChild(new Transform().setTranslation(0.0,-3.5,-2.0)
        .addChild(new Shape()
          .setAppearance(new Appearance()
            .setMaterial(new Material().setDiffuseColor(1.0,.5,0.0).setTransparency(.9)))
          .setGeometry(new Box().setSize(20.0,11.0,11.0)))))
    .addChild(new WorldInfo().setInfo(new String[] {"kelpForestMain3.4.wrl","Model of the Monterey Bay Aquarium Kelp Forest","DTG of last updated: 111500Jun98","Added: ","Updated: kelpTank2.9.wrl; ","Created by Naval Postgraduate School students under the supervision of Don Brutzman","Feel free to copy anything you wish - just give credit where it is due","http://faculty.nps.edu/brutzman/kelp"}).setTitle("NPS Virtual Kelp Forest Exhibit"))
    .addChild(new NavigationInfo().setSpeed(3.0))
    .addChild(new ExternProtoDeclare("WhereAmI").setName("WhereAmI").setUrl(new String[] {"../Chapter14Prototypes/WhereAmIPrototype.x3d#WhereAmI","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter14Prototypes/WhereAmIPrototype.x3d#WhereAmI","../Chapter14Prototypes/WhereAmIPrototype.wrl#WhereAmI","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter14Prototypes/WhereAmIPrototype.wrl#WhereAmI"}))
    .addChild(new ProtoInstance("WhereAmI").setContainerField("children"))
    .addChild(new ExternProtoDeclare("WaypointInterpolator").setName("WaypointInterpolator").setAppinfo("Reads waypoints and legSpeeds/legDurations/defaultSpeed to provide a customizable position/orientation interpolator.").setUrl(new String[] {"../../Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d#WaypointInterpolator","https://savage.nps.edu/Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d#WaypointInterpolator","../../Savage/Tools/Animation/WaypointInterpolatorPrototype.wrl#WaypointInterpolator","https://savage.nps.edu/Savage/Tools/Animation/WaypointInterpolatorPrototype.wrl#WaypointInterpolator"})
      .addComments(" Priority of use: legSpeeds (m/sec), legDurations (seconds), defaultSpeed (m/sec) ")
      .addField(new field().setName("description").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Short description of what is animated by this WaypointInterpolator."))
      .addField(new field().setName("waypoints").setType(field.TYPE_MFVEC3F).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Waypoints being traversed with interpolation of intermediate positions and orientations."))
      .addField(new field().setName("add_waypoint").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Add another single waypoint to array of waypoints recalculate interpolator values."))
      .addField(new field().setName("set_waypoints").setType(field.TYPE_MFVEC3F).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("Replace all waypoints recalculate interpolator values."))
      .addField(new field().setName("pitchUpDownForVerticalWaypoints").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Whether to pitch child geometry (such as a vehicle) up or down to match vertical slope"))
      .addField(new field().setName("legSpeeds").setType(field.TYPE_MFFLOAT).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Units m/sec. If used array lengths for legSpeeds and legDurations must be one less than number of waypoints."))
      .addField(new field().setName("legDurations").setType(field.TYPE_MFTIME).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Units in seconds. If used array lengths for legSpeeds and legDurations must be one less than number of waypoints."))
      .addField(new field().setName("defaultSpeed").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Units m/sec."))
      .addField(new field().setName("turningRate").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("turningRate (degrees/second) also determines standoff distance prior to waypoint where turn commences. If 0 turns are instantaneous."))
      .addField(new field().setName("totalDuration").setType(field.TYPE_SFTIME).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("Output calculation summing all leg durations, useful for setting TimeSensor cycleInterval. Units in seconds."))
      .addComments(" interpolation fields ")
      .addField(new field().setName("set_fraction").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INPUTONLY).setAppinfo("exposed PositionInterpolator and OrientationInterpolator setting"))
      .addField(new field().setName("position_changed").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("exposed PositionInterpolator setting"))
      .addField(new field().setName("orientation_changed").setType(field.TYPE_SFROTATION).setAccessType(field.ACCESSTYPE_OUTPUTONLY).setAppinfo("exposed OrientationInterpolator setting"))
      .addComments(" display-related fields ")
      .addField(new field().setName("lineColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("default color for non-active line segments"))
      .addField(new field().setName("highlightSegmentColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("highlightSegmentColors must contain two color values for each endpoint of the highlight segment."))
      .addField(new field().setName("transparency").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("1.0 is completely transparent, 0.0 is completely opaque."))
      .addField(new field().setName("labelDisplayMode").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("allowed values: none; waypoints (produce labels at each waypoint); or interpolation (produce single moving label at interpolator time course speed location)"))
      .addField(new field().setName("heightLabel").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("allowed values: altitude depth (negate Y value) none"))
      .addField(new field().setName("labelOffset").setType(field.TYPE_SFVEC3F).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("heightLabel relative location"))
      .addField(new field().setName("labelFontSize").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("heightLabel text size"))
      .addField(new field().setName("labelColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("heightLabel text color"))
      .addField(new field().setName("traceEnabled").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("enable console output to trace script computations and prototype progress"))
      .addField(new field().setName("outputInitializationComputations").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INITIALIZEONLY).setAppinfo("Output the number of waypoints totalDistance and totalDuration to console upon initialization"))
      .addField(new field().setName("verticalDropLineColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("default color for vertical drop-line segments"))
      .addField(new field().setName("verticalDropLineTransparency").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("1.0 is completely transparent, 0.0 is completely opaque.")))
    .addChild(new Group("Viewpoints")
      .addChild(new Viewpoint().setDescription("Kelp Forest Monterey Bay Aquarium").setPosition(0.0,-5.0,45.0))
      .addChild(new Viewpoint().setDescription("Side Windows").setFieldOfView(0.5).setOrientation(0.0,1.0,0.0,0.9).setPosition(25.0,-4.0,15.0))
      .addChild(new Viewpoint().setDescription("Star Fish").setOrientation(0.0,1.0,0.0,1.25).setPosition(14.0,-5.75,1.0))
      .addChild(new Viewpoint().setDescription("Inside Tank").setOrientation(0.0,1.0,0.0,3.14).setPosition(0.0,-5.0,-7.0))
      .addChild(new Viewpoint().setDescription("Top floor").setFieldOfView(1.04719).setOrientation(-0.3,1.0,0.3,1.57079).setPosition(12.5,5.0,-2.0))
      .addChild(new Viewpoint().setDescription("Bird's Eye View").setOrientation(1.0,0.0,0.0,-1.57).setPosition(0.0,19.0,-3.5))
      .addChild(new Viewpoint().setDescription("Pump House").setFieldOfView(0.6).setOrientation(0.0,1.0,0.0,1.3).setPosition(-5.0,1.0,0.0)))
    .addChild(new Group("Root")
      .addChild(new Background().setSkyColor(new MFColor(new double[] {.8,.8,.8})))
      .addChild(new Fog().setColor(.8,.8,.8).setVisibilityRange(60))
      .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/IntroductionMessage.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/IntroductionMessage.x3d","../KelpForestExhibit/IntroductionMessage.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/IntroductionMessage.wrl"}))
      .addChild(new Collision().setEnabled(false)
        .addChild(new Transform()
          .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/SharkLeftyLocale.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/SharkLeftyLocale.x3d","../KelpForestExhibit/SharkLeftyLocale.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/SharkLeftyLocale.wrl"})))
        .addChild(new Transform()
          .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/SharkLucyLocale.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/SharkLucyLocale.x3d","../KelpForestExhibit/SharkLucyLocale.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/SharkLucyLocale.wrl"})))
        .addChild(new Transform()
          .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/KelpTank.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/KelpTank.x3d","../KelpForestExhibit/KelpTank.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/KelpTank.wrl"})))
        .addChild(new Transform().setScale(0.54,0.75,0.52).setTranslation(0.3,-2.88,7.3)
          .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/RockFloor.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/RockFloor.x3d","../KelpForestExhibit/RockFloor.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/RockFloor.wrl"})))
        .addChild(new Transform("K2_LOCALE").setTranslation(-4.0,0.0,1.0)
          .addChild(new Transform("K2_MIDWATER").setScale(0.2,0.2,0.2).setTranslation(-1.0,-4.0,-4.0)
            .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/SardineSchool.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/SardineSchool.x3d","../KelpForestExhibit/SardineSchool.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/SardineSchool.wrl"})))
          .addChild(new Transform("K2_FLOOR").setRotation(0.0,1.0,0.0,0.44).setScale(0.5,0.9,0.5).setTranslation(-1.9,-8.5,-1.5)
            .addChild(new Inline("KelpExamplesNoBase").setUrl(new String[] {"../KelpForestExhibit/KelpExamplesNoBase.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/KelpExamplesNoBase.x3d","../KelpForestExhibit/KelpExamplesNoBase.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/KelpExamplesNoBase.wrl"}))))
        .addChild(new Transform("K4_LOCALE").setTranslation(-2.5,0.0,-2.5)
          .addChild(new Transform("K4_MIDWATER").setTranslation(-10.0,-2.0,-2.0)
            .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/HalfMoonGroup.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/HalfMoonGroup.x3d","../KelpForestExhibit/HalfMoonGroup.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/HalfMoonGroup.wrl"})))
          .addChild(new Transform("K4_FLOOR").setRotation(0.0,1.0,0.0,-0.3).setScale(0.5,0.8,0.5).setTranslation(-1.5,-7.5,0.5)
            .addChild(new Inline().setUSE("KelpExamplesNoBase"))))
        .addChild(new Transform("K7_LOCALE").setTranslation(2.0,0.0,-2.5)
          .addChild(new Transform("K7_MIDWATER").setScale(0.25,0.25,0.25).setTranslation(2.0,-4.0,0.0)
            .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/RubberLipGroup.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/RubberLipGroup.x3d","../KelpForestExhibit/RubberLipGroup.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/RubberLipGroup.wrl"})))
          .addChild(new Transform("K7_FLOOR").setScale(0.5,0.85,0.5).setTranslation(0.0,-7.75,0.0)
            .addChild(new Inline().setUSE("KelpExamplesNoBase"))))
        .addChild(new Transform("K10_LOCALE").setTranslation(7.0,0.0,2.0)
          .addChild(new Transform("K10_DEEP").setTranslation(0.0,-5.0,0.0)
            .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/StripedSurfPerch.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/StripedSurfPerch.x3d","../KelpForestExhibit/StripedSurfPerch.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/StripedSurfPerch.wrl"})))
          .addChild(new Transform("K10_FLOOR").setRotation(0.0,1.0,0.0,0.16).setScale(0.5,0.75,0.5).setTranslation(-1.0,-7.0,-1.0)
            .addChild(new Inline().setUSE("KelpExamplesNoBase"))))
        .addChild(new Transform("K11_LOCALE").setTranslation(8.0,0.0,-2.0)
          .addChild(new Transform("K11_MIDWATER").setRotation(0.0,1.0,0.0,0.3).setTranslation(2.19,-7.0,0.15)
            .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/SeaStarSimple.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/SeaStarSimple.x3d","../KelpForestExhibit/SeaStarSimple.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/SeaStarSimple.wrl"})))
          .addChild(new Transform("K11_DEEP").setRotation(0.0,1.0,0.0,0.9).setTranslation(1.0,-5.0,0.0)
            .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/BlackSurfPerch.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/BlackSurfPerch.x3d","../KelpForestExhibit/BlackSurfPerch.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/BlackSurfPerch.wrl"})))
          .addChild(new Transform("K11_FLOOR").setRotation(0.0,1.0,0.0,0.3).setScale(0.5,0.75,0.5).setTranslation(-0.3,-7.0,0.0)
            .addChild(new Inline().setUSE("KelpExamplesNoBase")))
          .addChild(new Transform().setTranslation(1.3,-5.0,3.0)
            .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/SeaStarGroup.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/SeaStarGroup.x3d","../KelpForestExhibit/SeaStarGroup.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/SeaStarGroup.wrl"}))))
        .addChild(new Transform("R2_LOCALE").setTranslation(-1.0,0.0,-1.0)
          .addChild(new Transform("R2_MIDWATER").setTranslation(-1.0,-6.0,-2.0)
            .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/BlueRockFish.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/BlueRockFish.x3d","../KelpForestExhibit/BlueRockFish.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/BlueRockFish.wrl"})))
          .addChild(new Transform("R2_DEEP").setTranslation(1.0,-6.5,-1.0)
            .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/KelpSurfPerch.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/KelpSurfPerch.x3d","../KelpForestExhibit/KelpSurfPerch.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/KelpSurfPerch.wrl"}))))
        .addChild(new Transform("R3_LOCALE").setTranslation(3.0,0.0,-4.0)
          .addChild(new Transform("R3_MIDWATER").setTranslation(0.0,-6.0,0.0)
            .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/Garibaldi.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/Garibaldi.x3d","../KelpForestExhibit/Garibaldi.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/Garibaldi.wrl"}))))
        .addChild(new Transform("R5_LOCALE").setTranslation(8.0,0.0,-2.0)
          .addChild(new Transform("R5_SHALLOW").setTranslation(-2.0,-2.0,0.0)
            .addChild(new Inline().setUrl(new String[] {"../KelpForestExhibit/KelpBass.x3d","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/KelpBass.x3d","../KelpForestExhibit/KelpBass.wrl","https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/KelpForestExhibit/KelpBass.wrl"}))))
        .addChild(new TimeSensor("WAVE_CLOCK").setCycleInterval(5.5).setEnabled(false).setLoop(true))
        .addChild(new PositionInterpolator("LEFT_SHALLOW_WAVE").setKey(new double[] {0.0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1.0}).setKeyValue(new MFVec3f(new double[] {0.0,0.0,0.0,0.056,-0.085,0.0,0.08,-0.12,0.0,0.056,-0.085,0.0,0.0,0.0,0.0,-0.056,0.085,0.0,-0.08,0.12,0.0,-0.056,0.085,0.0,0.0,0.0,0.0})))
        .addChild(new PositionInterpolator("LEFT_DEEP_WAVE").setKey(new double[] {0.0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1.0}).setKeyValue(new MFVec3f(new double[] {0.0,0.0,0.0,0.035,-0.035,0.0,0.05,-0.05,0.0,0.035,-0.035,0.0,0.0,0.0,0.0,-0.035,0.035,0.0,-0.05,0.05,0.0,-0.035,0.035,0.0,0.0,0.0,0.0})))
        .addChild(new PositionInterpolator("CENTER_WAVE").setKey(new double[] {0.0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1.0}).setKeyValue(new MFVec3f(new double[] {0.0,0.0,0.0,0.106,0.0,0.0,0.15,0.0,0.0,0.106,0.0,0.0,0.0,0.0,0.0,-0.106,0.0,0.0,-0.15,0.0,0.0,-0.106,0.0,0.0,0.0,0.0,0.0})))
        .addChild(new PositionInterpolator("RIGHT_SHALLOW_WAVE").setKey(new double[] {0.0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1.0}).setKeyValue(new MFVec3f(new double[] {0.0,0.0,0.0,0.056,0.085,0.0,0.08,0.12,0.0,0.056,0.085,0.0,0.0,0.0,0.0,-0.056,-0.085,0.0,-0.08,-0.12,0.0,-0.056,-0.085,0.0,0.0,0.0,0.0})))
        .addChild(new PositionInterpolator("RIGHT_DEEP_WAVE").setKey(new double[] {0.0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1.0}).setKeyValue(new MFVec3f(new double[] {0.0,0.0,0.0,0.035,0.035,0.0,0.05,0.05,0.0,0.035,0.035,0.0,0.0,0.0,0.0,-0.035,-0.035,0.0,-0.05,-0.05,0.0,-0.035,-0.035,0.0,0.0,0.0,0.0})))))
    .addChild(new ROUTE().setFromNode("WAVE_CLOCK").setFromField("fraction_changed").setToNode("CENTER_WAVE").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("CENTER_WAVE").setFromField("value_changed").setToNode("K7_MIDWATER").setToField("set_translation"))
    .addChild(new ROUTE().setFromNode("RIGHT_DEEP_WAVE").setFromField("value_changed").setToNode("K2_MIDWATER").setToField("set_translation"))
    .addChild(new ROUTE().setFromNode("CENTER_WAVE").setFromField("value_changed").setToNode("K4_MIDWATER").setToField("set_translation"))
    .addChild(new ROUTE().setFromNode("LEFT_DEEP_WAVE").setFromField("value_changed").setToNode("K10_DEEP").setToField("set_translation"))
    .addChild(new ROUTE().setFromNode("LEFT_DEEP_WAVE").setFromField("value_changed").setToNode("K11_DEEP").setToField("set_translation"))
    .addChild(new ROUTE().setFromNode("RIGHT_SHALLOW_WAVE").setFromField("value_changed").setToNode("R2_MIDWATER").setToField("set_translation"))
    .addChild(new ROUTE().setFromNode("RIGHT_DEEP_WAVE").setFromField("value_changed").setToNode("R2_DEEP").setToField("set_translation"))
    .addChild(new ROUTE().setFromNode("CENTER_WAVE").setFromField("value_changed").setToNode("R3_MIDWATER").setToField("set_translation"))
    .addChild(new ROUTE().setFromNode("RIGHT_SHALLOW_WAVE").setFromField("value_changed").setToNode("R5_SHALLOW").setToField("set_translation"))
    .addChild(new TimeSensor("MasterClock").setLoop(true))
    .addChild(new Group("Nancy")
      .addComments(" Scale used on Nancy underwater to approximate the defraction magnification of the plexiglass window. ")
      .addChild(new Transform("NancyTransform").setRotation(-0.45,0.77,-0.45,1.82).setScale(1.3,1.3,1.3).setTranslation(3.0,-6.5,-2.0)
        .addChild(new Inline().setUrl(new String[] {"../../HumanoidAnimation/Legacy/NancyDiving.x3d","https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Legacy/NancyDiving.x3d","../../HumanoidAnimation/Legacy/NancyDiving.wrl","https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Legacy/NancyDiving.wrl"})))
      .addChild(new TimeSensor("JEFFSCLOCK").setCycleInterval(100).setLoop(true))
      .addChild(new ProtoInstance("WaypointInterpolator", "NancyInterpolator").setContainerField("children")
        .addFieldValue(new fieldValue().setName("description").setValue("Nancy track"))
        .addFieldValue(new fieldValue().setName("waypoints").setValue(new MFVec3f(new MFVec3f(new double[] {-5.5,-5.7,-.2,-7.7,-2.7,-1.7,6.0,-3.0,-3.0,2.0,-2.0,-2.0,1.0,-4.0,-1.0,-2.0,-2.0,-2.0,-5.5,-5.7,-.2}))))
        .addFieldValue(new fieldValue().setName("defaultSpeed").setValue(0.5))
        .addFieldValue(new fieldValue().setName("pitchUpDownForVerticalWaypoints").setValue(true))
        .addFieldValue(new fieldValue().setName("labelDisplayMode").setValue("none"))
        .addFieldValue(new fieldValue().setName("lineColor").setValue(new SFColor(0.0,0.0,0.0)))
        .addFieldValue(new fieldValue().setName("labelColor").setValue(new SFColor(0.0,0.8,0.8)))
        .addFieldValue(new fieldValue().setName("labelOffset").setValue(new SFVec3f(0.0,-1.6,0.0)))
        .addFieldValue(new fieldValue().setName("labelFontSize").setValue(6))
        .addFieldValue(new fieldValue().setName("traceEnabled").setValue(false))
        .addFieldValue(new fieldValue().setName("transparency").setValue(1))
        .addFieldValue(new fieldValue().setName("turningRate").setValue(18))
        .addComments(" totalDuration is a computed output ")))
    .addChild(new ROUTE().setFromNode("JEFFSCLOCK").setFromField("fraction_changed").setToNode("NancyInterpolator").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("NancyInterpolator").setFromField("position_changed").setToNode("NancyTransform").setToField("set_translation"))
    .addChild(new ROUTE().setFromNode("NancyInterpolator").setFromField("orientation_changed").setToNode("NancyTransform").setToField("set_rotation")));
            }
            catch (Exception ex)
            {       
                System.err.println ("*** Further hints on X3DJSAIL errors and exceptions at");
                System.err.println ("*** https://www.web3d.org/specifications/java/X3DJSAIL.html");
                throw (ex);
            }
	}
	// end of initialize() method

	/** The initialized model object, created within initialize() method. */
	private X3D x3dModel;

	/** 
	 * Provide a 
	 * &lt;a href="https://dzone.com/articles/java-copy-shallow-vs-deep-in-which-you-will-swim" target="_blank"&gt;shallow copy&lt;/a&gt;
	 * of the X3D model.
	 * @see &lt;a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3D.html"&gt;X3D&lt;/a&gt;
	 * @return CollisionKelpForestMain model
	 */
	public X3D getX3dModel()
	{	  
		return x3dModel;
	}
	   
    /** 
     * Default main() method provided for test purposes, uses CommandLine to set global ConfigurationProperties for this object.
     * @param args array of input parameters, provided as arguments
     * @see &lt;a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3D.html#handleArguments-java.lang.String:A-"&gt;X3D.handleArguments(args)&lt;/a&gt;
     * @see &lt;a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3D.html#validationReport--"&gt;X3D.validationReport()&lt;/a&gt;
     * @see &lt;a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/CommandLine.html"&gt;CommandLine&lt;/a&gt;
     * @see &lt;a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/CommandLine.html#USAGE"&gt;CommandLine.USAGE&lt;/a&gt;
     * @see &lt;a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/ConfigurationProperties.html"&gt;ConfigurationProperties&lt;/a&gt;
     */
    public static void main(String args[])
    {
        System.out.println("Build this X3D model, showing validation diagnostics...");
        X3D thisExampleX3dModel = new CollisionKelpForestMain().getX3dModel();
//      System.out.println("X3D model construction complete.");
	
        // next handle command line arguments
        boolean hasArguments = (args != null) &amp;&amp; (args.length &gt; 0);
        boolean validate = true; // default
        boolean argumentsLoadNewModel = false;
        String  fileName = new String();

        if (args != null)
        {
                for (String arg : args)
                {
                        if (arg.toLowerCase().startsWith("-v") || arg.toLowerCase().contains("validate"))
                        {
                                validate = true; // making sure
                        }
                        if (arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_X3D) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_CLASSICVRML) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_X3DB) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_VRML97) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_EXI) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_GZIP) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_ZIP) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_HTML) ||
                                arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_XHTML))
                        {
                                argumentsLoadNewModel = true;
                                fileName = arg;
                        }
                }
        }
        if      (argumentsLoadNewModel)
                System.out.println("WARNING: \"X3dForWebAuthors.Chapter12EnvironmentSensorSound.CollisionKelpForestMain\" model invocation is attempting to load file \"" + fileName + "\" instead of simply validating itself... file loading ignored.");
        else if (hasArguments) // if no arguments provided, this method produces usage warning
                thisExampleX3dModel.handleArguments(args);
	
        if (validate)
        {
            //  System.out.println("--- TODO fix duplicated outputs ---"); // omit when duplicated outputs problem is solved/refactored
		String validationResults = thisExampleX3dModel.validationReport();
            //  System.out.println("-----------------------------------"); // omit when duplicated outputs problem is solved/refactored
                System.out.print("X3dForWebAuthors.Chapter12EnvironmentSensorSound.CollisionKelpForestMain self-validation test confirmation: ");
                if (!validationResults.equals("success"))
                    System.out.println();
                System.out.println(validationResults.trim());

                // experimental: test X3DJSAIL output files
                // Chapter12EnvironmentSensorSound/CollisionKelpForestMain_JavaExport.* file validation is checked when building X3D Example Archives
                String filenameX3D  = "Chapter12EnvironmentSensorSound/CollisionKelpForestMain_JavaExport.x3d"; 
                String filenameX3DV = "Chapter12EnvironmentSensorSound/CollisionKelpForestMain_JavaExport.x3dv"; 
                String filenameJSON = "Chapter12EnvironmentSensorSound/CollisionKelpForestMain_JavaExport.json";
                thisExampleX3dModel.toFileX3D        (filenameX3D);
                thisExampleX3dModel.toFileClassicVRML(filenameX3DV);
// TODO         thisExampleX3dModel.toFileJSON       (filenameJSON);
        }
    }
}
</pre></body></html>