package HumanoidAnimation.Bones;

import org.web3d.x3d.jsail.Core.*;
import org.web3d.x3d.jsail.fields.*;
import org.web3d.x3d.jsail.Geometry3D.*;
import org.web3d.x3d.jsail.Grouping.*;
import org.web3d.x3d.jsail.Lighting.*;
import org.web3d.x3d.jsail.Navigation.*;
import org.web3d.x3d.jsail.PointingDeviceSensor.*;
import org.web3d.x3d.jsail.Rendering.*;
import org.web3d.x3d.jsail.Shape.*;

// Javadoc metadata annotations follow, see below for X3DJSAIL Java source code.
/**
 * <p> cartilage model, TODO finish. </p>
 <p> Related links:  source lccart.java, <a href="https://www.web3d.org/x3d/content/examples/X3dResources.html" target="_blank">X3D Resources</a>, <a href="https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html" target="_blank">X3D Scene Authoring Hints</a>, and <a href="https://www.web3d.org/x3d/content/X3dTooltips.html" target="_blank">X3D Tooltips</a>. </p>
	<table style="color:black; border:0px solid; border-spacing:10px 0px;">
        <caption>Scene Meta Information</caption>
		<tr style="background-color:silver; border-color:silver;">
			<td style="text-align:center; padding:10px 0px;"><i>meta tags</i></td>
			<td style="text-align:left;   padding:10px 0px;">HumanoidAnimation.Bones.lccart&nbsp; Document Metadata </td>
		</tr>

		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> title </i> </td>
			<td> <a href="https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Bones/lccart.x3d">lccart.x3d</a> </td>
		</tr>
		<tr style="color:burntorange">
			<td style="text-align:right; vertical-align: text-top;"> <i> warning </i> </td>
			<td> fix naming </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> description </i> </td>
			<td> cartilage model, TODO finish </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> creator </i> </td>
			<td> Joe Williams, John Carlson, Damon Hernandez, Don Brutzman </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> translator </i> </td>
			<td> Don Brutzman </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> created </i> </td>
			<td> 5 December 2013 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> translated </i> </td>
			<td> 5 March 2026 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> modified </i> </td>
			<td> 16 March 2026 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> <a href="https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Bones/originals/lccart.x3d">originals/lccart.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> <a href="https://en.wikipedia.org/wiki/List_of_bones_of_the_human_skeleton" target="_blank">https://en.wikipedia.org/wiki/List_of_bones_of_the_human_skeleton</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> usage examples <a href="https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Medical" target="_blank">https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Medical</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> generator </i> </td>
			<td> X3D-Edit 4.0, <a href="https://www.web3d.org/x3d/tools/X3D-Edit" target="_blank">https://www.web3d.org/x3d/tools/X3D-Edit</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> generator </i> </td>
			<td> X3D Tidy, <a href="https://www.web3d.org/x3d/stylesheets/X3dTidy.html" target="_blank">https://www.web3d.org/x3d/stylesheets/X3dTidy.html</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> identifier </i> </td>
			<td> <a href="https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Bones/lccart.x3d" target="_blank">https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Bones/lccart.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> license </i> </td>
			<td> <a href="https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Bones/../license.html">../license.html</a> </td>
		</tr>
		<tr style="background-color:silver; border-color:silver;">
			<td style="text-align:center;" colspan="2">  &nbsp; </td>
		</tr>
	</table>

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

	* @author Joe Williams, John Carlson, Damon Hernandez, Don Brutzman
 */

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

	/** Create and initialize the X3D model for this object. */
	public final void initialize()
	{
            try { // catch-all
  x3dModel = new X3D().setProfile(X3D.PROFILE_INTERACTIVE).setVersion(X3D.VERSION_4_0)
  .setHead(new head()
    .addMeta(new meta().setName(meta.NAME_TITLE      ).setContent("lccart.x3d"))
    .addMeta(new meta().setName(meta.NAME_WARNING    ).setContent("fix naming"))
    .addMeta(new meta().setName(meta.NAME_DESCRIPTION).setContent("cartilage model, TODO finish"))
    .addMeta(new meta().setName(meta.NAME_CREATOR    ).setContent("Joe Williams, John Carlson, Damon Hernandez, Don Brutzman"))
    .addMeta(new meta().setName(meta.NAME_TRANSLATOR ).setContent("Don Brutzman"))
    .addMeta(new meta().setName(meta.NAME_CREATED    ).setContent("5 December 2013"))
    .addMeta(new meta().setName(meta.NAME_TRANSLATED ).setContent("5 March 2026"))
    .addMeta(new meta().setName(meta.NAME_MODIFIED   ).setContent("16 March 2026"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("originals/lccart.x3d"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("https://en.wikipedia.org/wiki/List_of_bones_of_the_human_skeleton"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("usage examples https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Medical"))
    .addMeta(new meta().setName(meta.NAME_GENERATOR  ).setContent("X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit"))
    .addMeta(new meta().setName(meta.NAME_GENERATOR  ).setContent("X3D Tidy, https://www.web3d.org/x3d/stylesheets/X3dTidy.html"))
    .addMeta(new meta().setName(meta.NAME_IDENTIFIER ).setContent("https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Bones/lccart.x3d"))
    .addMeta(new meta().setName(meta.NAME_LICENSE    ).setContent("../license.html")))
  .setScene(new Scene()
    .addChild(new WorldInfo().setTitle("*TODO_add_title*"))
    .addComments(" user hover lights bone and reveals description, user selection/deselection temporarily binds/unbinds close-up hidden viewpoint ")
    .addChild(new TouchSensor("UserTouchSensor").setDescription("cartilage lccart"))
    .addChild(new Transform("lccart").setTranslation(0.0391,1.4470,0.0185)
      .addChild(new Viewpoint("HiddenViewpoint").setNearDistance(0.001).setPosition(0.0,0.0,0.3).setRetainUserOffsets(true)
        .setNavigationInfo(new NavigationInfo().setTransitionType(new String[] {"ANIMATE"}).setType(new String[] {"EXAMINE"})))
      .addChild(new ROUTE().setFromNode("UserTouchSensor").setFromField("isActive").setToNode("HiddenViewpoint").setToField("set_bind"))
      .addChild(new DirectionalLight("HiddenLight").setAmbientIntensity(1).setColor(0.1,0.1,1.0).setOn(false))
      .addChild(new ROUTE().setFromNode("UserTouchSensor").setFromField("isOver").setToNode("HiddenLight").setToField("on"))
      .addChild(new Shape()
        .setAppearance(new Appearance()
          .setMaterial(new Material("CartilageMaterial").setAmbientIntensity(0.965).setDiffuseColor(0.9843,0.949,0.7843).setShininess(0.05).setSpecularColor(0.9647,0.949,0.9098)))
        .setGeometry(new IndexedFaceSet("lccart_geometry").setDEF("lccart_geometry").setCreaseAngle(1.571).setCoordIndex(getlccart_geometry_5_26_coordIndex())
          .setCoord(new Coordinate("lccart_coordinate").setPoint(getlccart_coordinate_6_26_point()))))));
            }
            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

		/** Large attribute array: IndexedFaceSet DEF='lccart_geometry' coordIndex field, scene-graph level=5, element #26, 676 total numbers.
		 * Reassemble split array as single method to improve readability and runnability.
		 * Provide large array values via separate methods, hoping to avoid 'code too large' Java compilation errors. 
		 * Individual Java methods (including aggregated initializations) are limited to 64KB.
		 * @see https://stackoverflow.com/questions/2407912/code-too-large-compilation-error-in-java
		 * @see https://stackoverflow.com/questions/11437905/java-too-many-constants-jvm-error
		 */
		private MFInt32 getlccart_geometry_5_26_coordIndex()
		{
			MFInt32 lccart_geometry_5_26_coordIndex = new MFInt32(new int[] {0,1,2,-1,1,3,2,-1,4,5,6,-1,6,7,4,-1,8,9,10,-1,10,11,8,-1,12,13,14,-1,13,15,14,-1,16,17,18,-1,16,19,17,-1,20,21,22,-1,20,23,21,-1,20,24,18,-1,20,25,24,-1,21,26,27,-1,27,28,21,-1,23,29,26,-1,26,21,23,-1,30,31,15,-1,15,13,30,-1,32,33,19,-1,33,17,19,-1,34,35,36,-1,35,37,36,-1,4,38,39,-1,4,7,38,-1,17,29,23,-1,17,33,29,-1,24,40,16,-1,16,18,24,-1,18,23,20,-1,18,17,23,-1,41,42,12,-1,12,14,41,-1,43,2,44,-1,45,3,1,-1,45,32,3,-1,5,46,47,-1,46,48,47,-1,47,49,5,-1,49,6,5,-1,50,51,52,-1,50,53,51,-1,54,55,30,-1,55,56,30,-1,57,58,55,-1,55,54,57,-1,27,26,59,-1,26,60,59,-1,61,62,63,-1,63,64,61,-1,6,65,66,-1,6,49,65,-1,30,67,31,-1,30,56,67,-1,32,68,33,-1,32,45,68,-1,69,70,71,-1,39,70,69,-1,72,73,74,-1,75,73,72,-1,48,76,77,-1,48,46,76,-1,61,78,66,-1,78,61,79,-1,2,80,64,-1,80,2,43,-1,7,81,38,-1,7,78,81,-1,80,82,79,-1,82,80,83,-1,44,84,43,-1,84,44,10,-1,85,86,87,-1,85,88,86,-1,89,85,90,-1,85,89,91,-1,92,57,54,-1,93,57,92,-1,41,72,74,-1,72,41,14,-1,35,12,42,-1,12,35,34,-1,94,91,89,-1,91,94,22,-1,16,8,11,-1,16,40,8,-1,95,36,37,-1,36,95,87,-1,96,75,72,-1,96,77,75,-1,96,31,97,-1,15,31,96,-1,76,39,69,-1,39,76,4,-1,38,98,99,-1,81,98,38,-1,52,88,50,-1,88,52,86,-1,13,54,30,-1,92,54,13,-1,28,50,88,-1,28,27,50,-1,100,10,44,-1,100,11,10,-1,83,101,82,-1,83,102,101,-1,93,52,57,-1,86,52,93,-1,84,102,83,-1,84,103,102,-1,82,98,81,-1,82,101,98,-1,77,69,75,-1,77,76,69,-1,10,103,84,-1,10,9,103,-1,87,93,36,-1,87,86,93,-1,22,25,20,-1,22,94,25,-1,22,28,91,-1,22,21,28,-1,19,11,100,-1,11,19,16,-1,14,96,72,-1,14,15,96,-1,12,92,13,-1,34,92,12,-1,34,93,92,-1,34,36,93,-1,90,87,95,-1,87,90,85,-1,91,88,85,-1,91,28,88,-1,43,83,80,-1,83,43,84,-1,79,81,78,-1,81,79,82,-1,64,79,61,-1,79,64,80,-1,3,44,2,-1,44,3,100,-1,66,7,6,-1,7,66,78,-1,5,76,46,-1,76,5,4,-1,97,77,96,-1,97,48,77,-1,75,71,73,-1,69,71,75,-1,39,99,70,-1,38,99,39,-1,32,100,3,-1,19,100,32,-1,29,60,26,-1,29,104,60,-1,67,48,97,-1,67,47,48,-1,61,65,62,-1,66,65,61,-1,64,0,2,-1,64,63,0,-1,51,57,52,-1,51,58,57,-1,59,50,27,-1,59,53,50,-1,33,104,29,-1,33,68,104,-1});
			return lccart_geometry_5_26_coordIndex;
		}
		/** Large attribute array: Coordinate DEF='lccart_coordinate' point field, scene-graph level=6, element #26, 315 total numbers made up of 105 3-tuple values.
		 * Reassemble split array as single method to improve readability and runnability.
		 * Provide large array values via separate methods, hoping to avoid 'code too large' Java compilation errors. 
		 * Individual Java methods (including aggregated initializations) are limited to 64KB.
		 * @see https://stackoverflow.com/questions/2407912/code-too-large-compilation-error-in-java
		 * @see https://stackoverflow.com/questions/11437905/java-too-many-constants-jvm-error
		 */
		private MFVec3f getlccart_coordinate_6_26_point()
		{
			MFVec3f lccart_coordinate_6_26_point = new MFVec3f(new double[] {-0.0074,0.0017,-0.0034,-0.0055,0.0048,-0.0030,-0.0072,0.0020,-0.0036,-0.0055,0.0050,-0.0033,-0.0050,-0.0077,0.0023,-0.0110,-0.0082,0.0034,-0.0108,-0.0077,0.0020,-0.0054,-0.0065,0.0007,0.0035,0.0102,-0.0065,0.0033,0.0099,-0.0069,-0.0003,0.0080,-0.0059,0.0003,0.0092,-0.0053,0.0037,-0.0082,0.0066,-0.0032,-0.0081,0.0072,0.0037,-0.0091,0.0057,-0.0038,-0.0087,0.0061,0.0013,0.0087,-0.0039,-0.0011,0.0074,-0.0018,0.0018,0.0082,-0.0030,-0.0018,0.0074,-0.0029,0.0025,0.0074,-0.0017,0.0003,0.0066,0.0004,0.0028,0.0069,-0.0013,-0.0004,0.0071,-0.0005,0.0044,0.0084,-0.0046,0.0052,0.0069,-0.0030,-0.0021,0.0060,0.0016,-0.0020,0.0060,0.0019,0.0006,0.0061,0.0009,-0.0026,0.0060,0.0008,-0.0096,-0.0082,0.0071,-0.0109,-0.0086,0.0058,-0.0047,0.0055,-0.0021,-0.0037,0.0060,-0.0009,0.0044,-0.0065,0.0064,0.0093,-0.0068,0.0053,0.0049,-0.0026,0.0050,0.0084,-0.0036,0.0039,0.0006,-0.0053,-0.0007,0.0015,-0.0074,0.0012,0.0038,0.0096,-0.0056,0.0110,-0.0098,0.0044,0.0101,-0.0088,0.0053,-0.0040,0.0042,-0.0049,-0.0038,0.0054,-0.0047,-0.0047,0.0052,-0.0020,-0.0111,-0.0082,0.0034,-0.0112,-0.0081,0.0035,-0.0111,-0.0082,0.0034,-0.0110,-0.0076,0.0020,-0.0016,0.0049,0.0033,-0.0014,0.0017,0.0047,-0.0014,0.0017,0.0049,-0.0016,0.0047,0.0032,-0.0057,-0.0069,0.0070,-0.0062,-0.0066,0.0068,-0.0098,-0.0080,0.0069,-0.0026,-0.0013,0.0060,-0.0026,-0.0013,0.0058,-0.0021,0.0057,0.0019,-0.0023,0.0057,0.0015,-0.0092,-0.0035,-0.0019,-0.0092,-0.0035,-0.0018,-0.0083,-0.0016,-0.0027,-0.0083,-0.0016,-0.0028,-0.0110,-0.0053,-0.0001,-0.0109,-0.0053,-0.0002,-0.0111,-0.0085,0.0058,-0.0038,0.0056,-0.0008,0.0026,-0.0086,0.0025,0.0079,-0.0071,-0.0001,0.0098,-0.0092,0.0017,0.0037,-0.0095,0.0051,0.0105,-0.0101,0.0027,0.0112,-0.0103,0.0037,0.0032,-0.0092,0.0034,-0.0043,-0.0082,0.0031,-0.0040,-0.0086,0.0036,-0.0057,-0.0040,-0.0015,-0.0048,-0.0017,-0.0032,-0.0045,0.0006,-0.0042,-0.0003,-0.0029,-0.0027,-0.0001,-0.0002,-0.0042,-0.0002,0.0025,-0.0054,-0.0003,0.0063,-0.0062,0.0042,0.0037,0.0019,0.0015,0.0014,0.0044,0.0047,0.0007,0.0037,0.0013,0.0044,0.0028,0.0057,0.0055,-0.0018,0.0069,0.0027,0.0008,0.0032,0.0059,-0.0003,-0.0008,-0.0065,0.0070,0.0010,-0.0018,0.0057,0.0052,0.0069,-0.0030,0.0076,-0.0001,0.0026,-0.0038,-0.0089,0.0058,-0.0109,-0.0087,0.0058,0.0052,-0.0019,-0.0037,0.0064,-0.0043,-0.0021,-0.0028,0.0073,-0.0042,0.0044,0.0012,-0.0053,0.0039,0.0043,-0.0065,0.0033,0.0083,-0.0072,-0.0028,0.0057,0.0008});
			return lccart_coordinate_6_26_point;
		}

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

	/** 
	 * Provide a 
	 * <a href="https://dzone.com/articles/java-copy-shallow-vs-deep-in-which-you-will-swim" target="_blank">shallow copy</a>
	 * of the X3D model.
	 * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3D.html">X3D</a>
	 * @return lccart 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 <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3D.html#handleArguments-java.lang.String:A-">X3D.handleArguments(args)</a>
     * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3D.html#validationReport--">X3D.validationReport()</a>
     * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/CommandLine.html">CommandLine</a>
     * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/CommandLine.html#USAGE">CommandLine.USAGE</a>
     * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/ConfigurationProperties.html">ConfigurationProperties</a>
     */
    public static void main(String args[])
    {
        System.out.println("Build this X3D model, showing validation diagnostics...");
        X3D thisExampleX3dModel = new lccart().getX3dModel();
//      System.out.println("X3D model construction complete.");
	
        // next handle command line arguments
        boolean hasArguments = (args != null) && (args.length > 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: \"HumanoidAnimation.Bones.lccart\" 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("HumanoidAnimation.Bones.lccart self-validation test confirmation: ");
                if (!validationResults.equals("success"))
                    System.out.println();
                System.out.println(validationResults.trim());

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