<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
<X3D profile='Immersive' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.3.xsd'>
  <head>
    <meta content='ArchPrototype.x3d' name='title'/>
    <meta content='Create an arch. Can modify general parameters: clearSpanWidth, riseHeight, depth, topAbutmentHeight, pierWidth, pierHeight. See the reference file ArchModelingDiagrams.pdf to find further information. See also ArchPrototypeScript_more_readable.js. Possibility to create shapes related to arch: ArchHalf; IntradosOnly; ArchFilled; ArchHalfFilled; Lintel. See the reference file ArchModelingDiagrams.pdf to find further information.' name='description'/>
    <meta content='Michele Foti, Don Brutzman' name='creator'/>
    <meta content='15 December 2014' name='created'/>
    <meta content='16 June 2020' name='modified'/>
    <meta content='debug local ProtoInstance' name='TODO'/>
    <meta content='add test ArchPrototypeExample' name='TODO'/>
    <meta content='Xj3D Player Issue, bogus error on line 243 of script regarding assignment to MFInt32 value' name='TODO'/>
    <meta content='ArchModelingDiagrams.pdf' name='reference'/>
    <meta content='https://en.wikipedia.org/wiki/Arch' name='reference'/>
    <meta content='https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Buildings/ArchPrototype.x3d' name='identifier'/>
    <meta content='X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit' name='generator'/>
    <meta content='../license.html' name='license'/>
  </head>
  <Scene>
    <WorldInfo title='ArchPrototype.x3d'/>
    <ProtoDeclare appinfo='Create an arch. Can modify general parameters: clearSpanWidth, riseHeight, depth, topAbutmentHeight, pierWidth, pierHeight. - Possibility to create shapes related to an arch: ArchHalf; IntradosOnly; ArchFilled; ArchHalfFilled; Lintel. See the reference file ArchModelingDiagrams.pdf to find further information. See also ArchPrototypeScript_more_readable.js.js.' name='ArchPrototype'>
      <ProtoInterface>
        <!-- COLOR OF ARCH -->
        <field accessType='inputOutput' appinfo='color of arch' name='diffuseColor' type='SFColor' value='0.2 0.8 0.8'/>
        <field accessType='inputOutput' appinfo='color of arch' name='emissiveColor' type='SFColor' value='0.2 0.8 0.8'/>
        <!-- INPUT PARAMETERS -->
        <!-- General parameters: measures in meters -->
        <field accessType='initializeOnly' appinfo='clearSpanWidth: clearSpanWidth must be double of riseHeight to obtain an half circumference' name='clearSpanWidth' type='SFFloat' value='4'/>
        <field accessType='initializeOnly' appinfo='riseHeight: riseHeight must be half of clearSpanWidth to obtain an half circumference' name='riseHeight' type='SFFloat' value='2'/>
        <field accessType='initializeOnly' appinfo='depth' name='depth' type='SFFloat' value='3'/>
        <field accessType='initializeOnly' appinfo='topAbutmentHeight:topAbutmentHeight=0 means no topAbutment' name='topAbutmentHeight' type='SFFloat' value='0.5'/>
        <field accessType='initializeOnly' appinfo='pierWidth:pierWidtht=0 means no pierWidth' name='pierWidth' type='SFFloat' value='0.5'/>
        <field accessType='initializeOnly' appinfo='pierHeight: pierHeight=0 means no pierHeight' name='pierHeight' type='SFFloat' value='1'/>
        <!-- Parameters to create shapes related to arch: put true to apply -->
        <field accessType='initializeOnly' appinfo='archHalf: can modify also clearSpanWidth, riseHeight, depth, pierWidth, pierHeight, topAbutmentHeight, archHalfExtensionWidth at purpose, clearSpanWidth measure refers to a full arc, consider clearSpanWidth/2 for the archHalf width' name='archHalf' type='SFBool' value='false'/>
        <field accessType='initializeOnly' appinfo='archHalfExtensionWidth: measure in meters, use only if archHalf=true, it is the width of the etension of the abutment of the archHalf. See the reference file ArchModelingDiagrams.pdf to find further information.' name='archHalfExtensionWidth' type='SFFloat' value='0'/>
        <field accessType='initializeOnly' appinfo='onlyIntrados: note it is a flat curved surface, can modify also clearSpanWidth, riseHeight, depth at purpose, if needed apply archHalf=true.' name='onlyIntrados' type='SFBool' value='false'/>
        <field accessType='initializeOnly' appinfo='archFilled: note it is an half cylinder, can modify also clearSpanWidth, riseHeight, depth at purpose.' name='archFilled' type='SFBool' value='false'/>
        <field accessType='initializeOnly' appinfo='archHalfFilled: note it is a quarter cylinder, can modify also clearSpanWidth, riseHeight, depth at purpose, clearSpanWidth measure refers to a full arc, consider clearSpanWidth/2 for the archHalfFilled width.' name='archHalfFilled' type='SFBool' value='false'/>
        <field accessType='initializeOnly' appinfo='lintel: no arc is rendered, but a lintel: topAbutmentHeight on pierHeight, total height is pierHeight + topAbutmentHeight, if needed apply archHalf=true.' name='lintel' type='SFBool' value='false'/>
      </ProtoInterface>
      <ProtoBody>
        <!-- First node determines node type of this prototype -->
        <!-- IndexedFaceset creates arch -->
        <Transform DEF='ArchTransform'>
          <Shape DEF='Arch'>
            <!-- note that convex='false' (meaning concave geometry) is crucial for this IFS of a geometric chord to render properly -->
            <IndexedFaceSet DEF='ArchIndex' convex='false' solid='false'>
              <Coordinate DEF='ArchChord'/>
            </IndexedFaceSet>
            <Appearance>
              <Material DEF='MaterialNode'>
                <IS>
                  <connect nodeField='emissiveColor' protoField='emissiveColor'/>
                  <connect nodeField='diffuseColor' protoField='diffuseColor'/>
                </IS>
              </Material>
            </Appearance>
          </Shape>
        </Transform>
        <!-- Subsequent nodes do not render, but still must be a valid X3D subgraph -->
        <!-- This embedded Script provides the X3D author with additional visibility and control over prototype inputs and outputs -->
        <Script DEF='ArchPrototypeScript' url='"ArchPrototypeScript.js" "https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Buildings/ArchPrototypeScript.js"'>
          <!-- INPUT PARAMETERS -->
          <!-- General parameters -->
          <!-- Parameters to create to create shapes related to arch: put true to apply -->
          <!-- OUTPUT PARAMETERS -->
          <field accessType='initializeOnly' appinfo='user or default input for clearSpanWidth parameter' name='clearSpanWidth' type='SFFloat'/>
          <field accessType='initializeOnly' appinfo='user or default input for riseHeight parameter' name='riseHeight' type='SFFloat'/>
          <field accessType='initializeOnly' appinfo='user or default input for depth parameter' name='depth' type='SFFloat'/>
          <field accessType='initializeOnly' appinfo='user or default input for topAbutmentHeight parameter' name='topAbutmentHeight' type='SFFloat'/>
          <field accessType='initializeOnly' appinfo='user or default input for pierWidth parameter' name='pierWidth' type='SFFloat'/>
          <field accessType='initializeOnly' appinfo='user or default input for pierHeight parameter' name='pierHeight' type='SFFloat'/>
          <field accessType='initializeOnly' appinfo='user or default input for archHalf parameter' name='archHalf' type='SFBool'/>
          <field accessType='initializeOnly' appinfo='user or default input for archHalfExtensionWidth parameter' name='archHalfExtensionWidth' type='SFFloat'/>
          <field accessType='initializeOnly' appinfo='user or default input for onlyIntrados parameter' name='onlyIntrados' type='SFBool'/>
          <field accessType='initializeOnly' appinfo='user or default input for archFilled parameter' name='archFilled' type='SFBool'/>
          <field accessType='initializeOnly' appinfo='user or default input for archHalfFilled parameter' name='archHalfFilled' type='SFBool'/>
          <field accessType='initializeOnly' appinfo='user or default input for lintel parameter' name='lintel' type='SFBool'/>
          <field accessType='outputOnly' appinfo='computedScale: modify scale field - NOTE it is not used to modify the whole arch, but to modify clearSpanWidth, riseHeight, depth. It does not affect topAbutmentHeight, pierWidth, pierHeight, archHalfExtensionWidth' name='computedScale' type='SFVec3f'/>
          <field accessType='outputOnly' appinfo='send computed points to the Coordinate node' name='pointOut' type='MFVec3f'/>
          <field accessType='outputOnly' appinfo='send computed indices to the IndexedFaceSet node' name='indexOut' type='MFInt32'/>
          <IS>
            <connect nodeField='clearSpanWidth' protoField='clearSpanWidth'/>
            <connect nodeField='riseHeight' protoField='riseHeight'/>
            <connect nodeField='depth' protoField='depth'/>
            <connect nodeField='pierWidth' protoField='pierWidth'/>
            <connect nodeField='topAbutmentHeight' protoField='topAbutmentHeight'/>
            <connect nodeField='pierHeight' protoField='pierHeight'/>
            <connect nodeField='archHalf' protoField='archHalf'/>
            <connect nodeField='archHalfExtensionWidth' protoField='archHalfExtensionWidth'/>
            <connect nodeField='onlyIntrados' protoField='onlyIntrados'/>
            <connect nodeField='archFilled' protoField='archFilled'/>
            <connect nodeField='archHalfFilled' protoField='archHalfFilled'/>
            <connect nodeField='lintel' protoField='lintel'/>
          </IS>
        </Script>
        <ROUTE fromField='computedScale' fromNode='ArchPrototypeScript' toField='scale' toNode='ArchTransform'/>
        <ROUTE fromField='pointOut' fromNode='ArchPrototypeScript' toField='point' toNode='ArchChord'/>
        <ROUTE fromField='indexOut' fromNode='ArchPrototypeScript' toField='set_coordIndex' toNode='ArchIndex'/>
      </ProtoBody>
    </ProtoDeclare>
    <ProtoInstance DEF='ArchInstance' name='ArchPrototype'>
      <fieldValue name='diffuseColor' value='0.5 0.3 0.6'/>
      <fieldValue name='emissiveColor' value='0.5 0.3 0.6'/>
      <fieldValue name='clearSpanWidth' value='5'/>
      <fieldValue name='riseHeight' value='2.5'/>
      <fieldValue name='depth' value='2'/>
      <fieldValue name='topAbutmentHeight' value='0.6'/>
      <fieldValue name='pierWidth' value='1'/>
      <fieldValue name='pierHeight' value='2'/>
    </ProtoInstance>
    <Shape>
      <Text string='"TODO: internal and external" "prototype tests" "ArchPrototype.x3d"'>
        <FontStyle family='"SANS"' justify='"MIDDLE" "MIDDLE"' style='BOLD'/>
      </Text>
      <Appearance>
        <Material diffuseColor='0.9 0.9 0.9'/>
      </Appearance>
    </Shape>
    <!-- Add any ROUTEs here that connect ProtoInstance to/from prior nodes in Scene (and outside of ProtoDeclare) -->
    <Inline DEF='CoordinateAxes' url='"../../X3dForWebAuthors/Chapter03Grouping/CoordinateAxes.x3d" "../../../Savage/Tools/Authoring/CoordinateAxes.x3d" "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter03Grouping/CoordinateAxes.x3d" "../../X3dForWebAuthors/Chapter03Grouping/CoordinateAxes.wrl" "../../../Savage/Tools/Authoring/CoordinateAxes.wrl" "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter03Grouping/CoordinateAxes.wrl" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/CoordinateAxes.x3d" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/CoordinateAxes.wrl"'/>
  </Scene>
</X3D>