package X3dForAdvancedModeling.Buildings;
/*
Copyright (c) 1995-2022 held by the author(s). All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of the Web3D Consortium (https://www.web3d.org)
nor the names of its contributors may be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import org.web3d.x3d.jsail.Core.*;
import org.web3d.x3d.jsail.fields.*;
import org.web3d.x3d.jsail.Geometry3D.*;
import org.web3d.x3d.jsail.Navigation.*;
import org.web3d.x3d.jsail.Rendering.*;
import org.web3d.x3d.jsail.Shape.*;
// Javadoc annotations follow, see below for Java source code.
/**
*
Create the intrados, the interior and lower line or curve of an arch. Note it is a flat curved surface. Parameters are: clearSpanWidth=4; riseHeight=2; depth=3p. Modify them with Transform scale or by editing the IndexedFileSet node. See the reference file ArchModelingDiagrams.pdf and the ArchScript_more_readable.js script to find further information.
Related links: IntradosOnly.java source, IntradosOnly catalog page, X3D Resources, X3D Scene Authoring Hints, and X3D Tooltips.
This program uses the
X3D Java Scene Access Interface Library (X3DJSAIL).
It has been produced using the
X3dToJava.xslt
stylesheet to create Java source code from an .x3d
model.
* @author Michele Foti, Don Brutzman
*/
public class IntradosOnly
{
/** Default constructor to create this object. */
public IntradosOnly ()
{
initialize();
}
/** Create and initialize the X3D model for this object. */
public final void initialize()
{
x3dModel = new X3D().setProfile(X3D.PROFILE_INTERCHANGE).setVersion(X3D.VERSION_3_3)
.setHead(new head()
.addMeta(new meta().setName(meta.NAME_TITLE ).setContent("IntradosOnly.x3d"))
.addMeta(new meta().setName(meta.NAME_DESCRIPTION).setContent("Create the intrados, the interior and lower line or curve of an arch. Note it is a flat curved surface. Parameters are: clearSpanWidth=4; riseHeight=2; depth=3p. Modify them with Transform scale or by editing the IndexedFileSet node. See the reference file ArchModelingDiagrams.pdf and the ArchScript_more_readable.js script to find further information."))
.addMeta(new meta().setName(meta.NAME_CREATOR ).setContent("Michele Foti, Don Brutzman"))
.addMeta(new meta().setName(meta.NAME_CREATED ).setContent("15 December 2014"))
.addMeta(new meta().setName(meta.NAME_MODIFIED ).setContent("20 October 2019"))
.addMeta(new meta().setName(meta.NAME_REFERENCE ).setContent("ArchModelingDiagrams.pdf"))
.addMeta(new meta().setName(meta.NAME_REFERENCE ).setContent("https://en.wikipedia.org/wiki/Arch"))
.addMeta(new meta().setName(meta.NAME_IDENTIFIER ).setContent("https://x3dgraphics.com/examples/X3dForAdvancedModeling/Buildings/IntradosOnly.x3d"))
.addMeta(new meta().setName(meta.NAME_GENERATOR ).setContent("X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"))
.addMeta(new meta().setName(meta.NAME_LICENSE ).setContent("../license.html")))
.setScene(new Scene()
.addChild(new WorldInfo().setTitle("IntradosOnly.x3d"))
.addChild(new Viewpoint().setDescription("Intrados: interior of arch").setOrientation(1.0,0.0,0.0,-0.463648).setPosition(0.0,5.0,10.0))
.addChild(new Shape("Arch")
.addComments(" note that convex='false' (meaning concave geometry) is crucial for this IFS of a geometric chord to render properly ")
.setGeometry(new IndexedFaceSet("ArchIndex").setDEF("ArchIndex").setConvex(false).setSolid(false).setCoordIndex(new int[] {0,63,64,1,-1,1,64,65,2,-1,2,65,66,3,-1,3,66,67,4,-1,4,67,68,5,-1,5,68,69,6,-1,6,69,70,7,-1,7,70,71,8,-1,8,71,72,9,-1,9,72,73,10,-1,10,73,74,11,-1,11,74,75,12,-1,12,75,76,13,-1,13,76,77,14,-1,14,77,78,15,-1,15,78,79,16,-1,16,79,80,17,-1,17,80,81,18,-1,18,81,82,19,-1,19,82,83,20,-1,20,83,84,21,-1,21,84,85,22,-1,22,85,86,23,-1,23,86,87,24,-1,24,87,88,25,-1,25,88,89,26,-1,26,89,90,27,-1,27,90,91,28,-1,28,91,92,29,-1,29,92,93,30,-1,30,93,94,31,-1,31,94,95,32,-1,32,95,96,33,-1,33,96,97,34,-1,34,97,98,35,-1,35,98,99,36,-1,36,99,100,37,-1,37,100,101,38,-1,38,101,102,39,-1,39,102,103,40,-1,40,103,104,41,-1,41,104,105,42,-1,42,105,106,43,-1,43,106,107,44,-1,44,107,108,45,-1,45,108,109,46,-1,46,109,110,47,-1,47,110,111,48,-1,48,111,112,49,-1,49,112,113,50,-1,50,113,114,51,-1,51,114,115,52,-1,52,115,116,53,-1,53,116,117,54,-1,54,117,118,55,-1,55,118,119,56,-1,56,119,120,57,-1,57,120,121,58,-1,58,121,122,59,-1,59,122,123,60,-1,60,123,124,61,-1,61,124,125,62,-1})
.setCoord(new Coordinate("ArchChord").setPoint(getArchChord_5_14_point())))
.setAppearance(new Appearance()
.setMaterial(new Material("MaterialNode").setDiffuseColor(1.0,0.75,0.25)))));
}
// end of initialize() method
/** Define subarrays using type double[] */
private double[] getArchChord_5_14_point_1()
{
double[] value = {2.0,0.0,0.0,1.9974984355438178,0.1,0.0,1.98997487421324,0.2,0.0,1.977371993328519,0.3,0.0,1.9595917942265423,0.4,0.0,1.9364916731037084,0.5,0.0,1.9078784028338912,0.6,0.0,1.8734993995195193,0.7,0.0,1.833030277982336,0.8,0.0,1.786057109949175,0.9,0.0,1.7320508075688775,1.0,0.0,1.6703293088490067,1.1,0.0,1.60,1.2,0.0,1.5198684153570664,1.3,0.0,1.42828568570857,1.4,0.0,1.3228756555322953,1.5,0.0,1.20,1.6,0.0,1.0535653752852738,1.7,0.0,0.9020947843768965,1.785,0.0,0.7599342076785332,1.85,0.0,0.6244997998398398,1.9,0.0,0.5425633603552677,1.925,0.0,0.4444097208657794,1.95,0.0,0.36181625170796194,1.967,0.0,0.2821347195933173,1.98,0.0,0.19974984355438343,1.99,0.0,0.16718552568927703,1.993,0.0,0.14133294025102578,1.995,0.0,0.10950342460398415,1.997,0.0,0.08942035562443252,1.998,0.0,0.06323764701505419,1.999,0.0,0.0,2.0,0.0,-0.06323764701505419,1.999,0.0,-0.08942035562443252,1.998,0.0,-0.10950342460398415,1.997,0.0,-0.14133294025102578,1.995,0.0,-0.16718552568927703,1.993,0.0,-0.19974984355438343,1.99,0.0,-0.2821347195933173,1.98,0.0,-0.36181625170796194,1.967,0.0,-0.4444097208657794,1.95,0.0,-0.5425633603552677,1.925,0.0,-0.6244997998398398,1.9,0.0,-0.7599342076785332,1.85,0.0,-0.9020947843768965,1.785,0.0,-1.0535653752852738,1.7,0.0,-1.20,1.6,0.0,-1.3228756555322953,1.5,0.0,-1.42828568570857,1.4,0.0,-1.5198684153570664,1.3,0.0,-1.60,1.2,0.0,-1.6703293088490067,1.1,0.0,-1.7320508075688775,1.0,0.0,-1.786057109949175,0.9,0.0,-1.833030277982336,0.8,0.0,-1.8734993995195193,0.7,0.0,-1.9078784028338912,0.6,0.0,-1.9364916731037084,0.5,0.0,-1.9595917942265423,0.4,0.0,-1.977371993328519,0.3,0.0,-1.98997487421324,0.2,0.0,-1.9974984355438178,0.1,0.0,-2.0,0.0,0.0,2.0,0.0,3.0,1.9974984355438178,0.1,3.0,1.98997487421324,0.2,3.0,1.977371993328519,0.3,3.0,1.9595917942265423,0.4,3.0,1.9364916731037084,0.5,3.0,1.9078784028338912,0.6,3.0,1.8734993995195193,0.7,3.0,1.833030277982336,0.8,3.0,1.786057109949175,0.9,3.0,1.7320508075688775,1.0,3.0,1.6703293088490067,1.1,3.0,1.60,1.2,3.0,1.5198684153570664,1.3,3.0,1.42828568570857,1.4,3.0,1.3228756555322953,1.5,3.0,1.20,1.6,3.0,1.0535653752852738,1.7,3.0,0.9020947843768965,1.785,3.0,0.7599342076785332,1.85,3.0,0.6244997998398398,1.9,3.0,0.5425633603552677,1.925,3.0,0.4444097208657794,1.95,3.0,0.36181625170796194,1.967,3.0,0.2821347195933173,1.98,3.0,0.19974984355438343,1.99,3.0,0.16718552568927703,1.993,3.0,0.14133294025102578,1.995,3.0,0.10950342460398415,1.997,3.0,0.08942035562443252,1.998,3.0,0.06323764701505419,1.999,3.0,0.0,2.0,3.0,-0.06323764701505419,1.999,3.0,-0.08942035562443252,1.998,3.0,-0.10950342460398415,1.997,3.0,-0.14133294025102578,1.995,3.0,-0.16718552568927703,1.993,3.0};
return value;
}
private double[] getArchChord_5_14_point_2()
{
double[] value = {-0.19974984355438343,1.99,3.0,-0.2821347195933173,1.98,3.0,-0.36181625170796194,1.967,3.0,-0.4444097208657794,1.95,3.0,-0.5425633603552677,1.925,3.0,-0.6244997998398398,1.9,3.0,-0.7599342076785332,1.85,3.0,-0.9020947843768965,1.785,3.0,-1.0535653752852738,1.7,3.0,-1.20,1.6,3.0,-1.3228756555322953,1.5,3.0,-1.42828568570857,1.4,3.0,-1.5198684153570664,1.3,3.0,-1.60,1.2,3.0,-1.6703293088490067,1.1,3.0,-1.7320508075688775,1.0,3.0,-1.786057109949175,0.9,3.0,-1.833030277982336,0.8,3.0,-1.8734993995195193,0.7,3.0,-1.9078784028338912,0.6,3.0,-1.9364916731037084,0.5,3.0,-1.9595917942265423,0.4,3.0,-1.977371993328519,0.3,3.0,-1.98997487421324,0.2,3.0,-1.9974984355438178,0.1,3.0,-2.0,0.0,3.0,-2.0,-1.0,3.0,-2.5,-1.0,3.0,-2.5,2.5,3.0,2.5,2.5,3.0,2.5,-1.0,3.0,2.0,-1.0,3.0,-2.0,-1.0,0.0,-2.5,-1.0,0.0,-2.5,2.5,0.0,2.5,2.5,0.0,2.5,-1.0,0.0,2.0,-1.0,0.0,2.5,0.0,3.0,2.5,0.0,0.0,-2.5,0.0,3.0,-2.5,0.0,0.0,-2.5,2.0,3.0,-2.0,2.0,3.0,-2.0,2.0,0.0,-2.5,2.0,0.0,-2.0,2.5,3.0,-2.0,2.5,0.0,0.0,2.5,3.0,0.0,2.5,0.0,2.0,2.0,3.0,2.5,2.0,3.0,2.5,2.0,0.0,2.0,2.0,0.0,2.0,2.5,3.0,2.0,2.5,0.0};
return value;
}
/** Large attribute array: Coordinate DEF='ArchChord' point field, scene-graph level=5, element #14, 468 total numbers made up of 156 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 getArchChord_5_14_point()
{
MFVec3f ArchChord_5_14_point = new MFVec3f()/*2.finalize*/
.append(new MFVec3f(getArchChord_5_14_point_1()))
.append(new MFVec3f(getArchChord_5_14_point_2()));
return ArchChord_5_14_point;
}
/** The initialized model object, created within initialize() method. */
private X3D x3dModel;
/**
* Provide a
* shallow copy
* of the X3D model.
* @see X3D
* @return IntradosOnly 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 X3D.handleArguments(args)
* @see X3D.validationReport()
* @see CommandLine
* @see CommandLine.USAGE
* @see ConfigurationProperties
*/
public static void main(String args[])
{
X3D thisExampleX3dModel = new IntradosOnly().getX3dModel();
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: \"X3dForAdvancedModeling.Buildings.IntradosOnly\" 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.print("Java program \"X3dForAdvancedModeling.Buildings.IntradosOnly\" self-validation test results: ");
String validationResults = thisExampleX3dModel.validationReport();
if (validationResults.startsWith("\n"))
System.out.println();
System.out.println(validationResults.trim());
}
}
}