####################################################################################################
#
# Invoking X3D model self-test:
#
#   $ python r_inferior_nasal_conchae.py
#
# Python package x3d.py package is available on PyPI for import.
#   This approach simplifies Python X3D deployment and use.
#   https://pypi.org/project/x3d
#
# Installation:
#       pip install x3d
# or
#       python -m pip install x3d
#
# Developer options for loading x3d package in other Python programs:
#
#    from x3d import *  # preferred approach, terser source that avoids x3d.* class prefixes
#
# or
#    import x3d         # traditional way to subclass x3d package, all classes require x3d.* prefix,
#                       # but python source is very verbose, for example x3d.Material x3d.Shape etc.
#                       # X3dToPython.xslt stylesheet insertPackagePrefix=true supports this option.
#
# Project home page:    # X3D Python Scene Access Interface Library (X3DPSAIL)
#                       # https://www.web3d.org/x3d/stylesheets/python/python.html
# Conversion generator: # https://www.web3d.org/x3d/stylesheets/X3dToPython.xslt
#
####################################################################################################

from x3d import *

newModel=X3D(profile='Interactive',version='4.0',
  head=head(
    children=[
    meta(content='r_inferior_nasal_conchae.x3d',name='title'),
    meta(content='inferior nasal concha (inferior turbinated bone or inferior turbinal/turbinate) is one of the three paired nasal conchae in the nose, LOA-5 part of skull LOA-1',name='description'),
    meta(content='Don Brutzman, Joe Williams, John Carlson, Damon Hernandez',name='creator'),
    meta(content='Don Brutzman',name='translator'),
    meta(content='5 December 2013',name='created'),
    meta(content='5 March 2026',name='translated'),
    meta(content='23 April 2026',name='modified'),
    meta(content='originals/inconr.x3d',name='reference'),
    meta(content='https://en.wikipedia.org/wiki/Inferior_nasal_concha',name='reference'),
    meta(content='https://en.wikipedia.org/wiki/List_of_bones_of_the_human_skeleton',name='reference'),
    meta(content='usage examples https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Medical',name='reference'),
    meta(content='X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit',name='generator'),
    meta(content='X3D Tidy, https://www.web3d.org/x3d/stylesheets/X3dTidy.html',name='generator'),
    meta(content='https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Bones/r_inferior_nasal_conchae.x3d',name='identifier'),
    meta(content='../license.html',name='license')]),
  Scene=Scene(
    children=[
    WorldInfo(title='r_inferior_nasal_conchae.x3d'),
    Background(skyColor=[(0.858824,1,0.94902)]),
    Comment('user hover lights bone and reveals description, user selection/deselection temporarily binds/unbinds close-up hidden viewpoint'),
    TouchSensor(DEF='UserTouchSensor',description='bone r_inferior_nasal_conchae, LOA-5 part of skull LOA-1'),
    Transform(DEF='r_inferior_nasal_conchae',translation=(-0.0117,1.6309,0.0621),
      children=[
      BooleanToggle(DEF='UserTouchState'),
      ROUTE(fromField='isActive',fromNode='UserTouchSensor',toField='set_boolean',toNode='UserTouchState'),
      Viewpoint(DEF='HiddenViewpoint',nearDistance=0.001,position=(0,0,0.2),retainUserOffsets=True,
        navigationInfo=NavigationInfo(transitionType=["ANIMATE"],type=["EXAMINE"])),
      ROUTE(fromField='toggle',fromNode='UserTouchState',toField='set_bind',toNode='HiddenViewpoint'),
      DirectionalLight(DEF='HiddenLight',ambientIntensity=1,color=(0.1,0.1,1),on=False),
      ROUTE(fromField='toggle',fromNode='UserTouchState',toField='on',toNode='HiddenLight'),
      Transform(DEF='CenterOfRotationForJoint',visible=False,
        children=[
        Comment('insert computations for joint center of rotation here'),
        Inline(DEF='AxesDisplay',description='RGB display axes showing XYZ direction in local coordinate system',url=["AxesDisplay.x3d"],visible=False)]),
      ROUTE(fromField='toggle',fromNode='UserTouchState',toField='visible',toNode='CenterOfRotationForJoint'),
      Shape(
        appearance=Appearance(
          material=Material(DEF='BoneMaterial',ambientIntensity=0.965,diffuseColor=(1,0.9765,0.8667),shininess=0.05,specularColor=(0.349,0.349,0.349))),
        geometry=IndexedFaceSet(DEF='r_inferior_nasal_conchae_geometry',coordIndex=[0,1,2,-1,3,4,1,-1,5,6,7,-1,8,9,10,-1,7,11,8,-1,5,8,12,-1,13,14,15,-1,16,17,18,-1,19,20,21,-1,22,23,24,-1,25,26,27,-1,28,29,30,-1,31,32,33,-1,34,35,36,-1,37,38,39,-1,40,3,30,-1,41,39,42,-1,43,44,45,-1,46,47,48,-1,49,50,51,-1,52,53,54,-1,55,56,57,-1,58,59,43,-1,60,61,62,-1,63,64,65,-1,66,67,4,-1,0,68,65,-1,67,69,17,-1,70,71,61,-1,72,73,40,-1,74,75,76,-1,37,6,29,-1,77,78,79,-1,3,40,66,-1,76,75,80,-1,70,81,82,-1,83,84,85,-1,82,54,49,-1,86,87,88,-1,62,89,90,-1,57,52,33,-1,91,92,93,-1,91,53,92,-1,94,91,95,-1,56,96,93,-1,24,97,20,-1,89,98,99,-1,100,101,102,-1,91,94,53,-1,79,43,59,-1,55,57,32,-1,52,54,82,-1,60,48,47,-1,67,16,103,-1,104,105,106,-1,107,36,35,-1,79,78,108,-1,109,110,31,-1,111,38,112,-1,113,48,114,-1,73,88,66,-1,37,39,6,-1,69,66,88,-1,38,111,74,-1,28,3,112,-1,68,115,15,-1,90,116,62,-1,59,117,118,-1,52,57,56,-1,41,113,114,-1,72,119,10,-1,64,85,84,-1,120,93,96,-1,121,122,123,-1,13,15,115,-1,12,119,30,-1,8,11,9,-1,124,125,103,-1,2,1,4,-1,113,42,48,-1,124,103,16,-1,126,68,2,-1,12,10,119,-1,30,127,12,-1,115,128,13,-1,129,110,130,-1,62,61,71,-1,64,84,80,-1,72,40,119,-1,74,42,39,-1,56,92,52,-1,59,58,117,-1,60,70,61,-1,68,126,115,-1,38,74,39,-1,76,48,42,-1,69,67,66,-1,39,7,6,-1,73,86,88,-1,111,112,0,-1,109,31,131,-1,79,108,132,-1,107,35,77,-1,104,106,133,-1,124,16,18,-1,70,60,47,-1,84,83,46,-1,33,52,82,-1,104,55,32,-1,59,77,79,-1,93,92,56,-1,100,96,101,-1,134,89,99,-1,24,44,97,-1,20,97,21,-1,87,135,136,-1,56,101,96,-1,95,50,94,-1,137,138,139,-1,32,57,33,-1,62,140,89,-1,86,134,87,-1,82,49,70,-1,109,83,85,-1,70,47,81,-1,66,4,3,-1,77,35,78,-1,28,37,29,-1,76,42,74,-1,73,66,40,-1,131,33,82,-1,82,81,131,-1,16,67,17,-1,0,65,111,-1,65,14,63,-1,60,62,116,-1,43,45,58,-1,55,101,56,-1,52,92,53,-1,49,94,50,-1,48,76,46,-1,41,42,113,-1,40,30,119,-1,34,13,35,-1,33,131,31,-1,3,28,30,-1,26,141,27,-1,24,142,22,-1,21,143,19,-1,13,34,14,-1,127,5,12,-1,7,8,5,-1,12,8,10,-1,127,30,29,-1,2,4,67,-1,2,68,0,-1,144,145,146,-1,144,98,145,-1,115,147,128,-1,147,115,125,-1,108,128,147,-1,128,108,78,-1,11,39,41,-1,39,11,7,-1,148,138,149,-1,139,138,148,-1,132,97,44,-1,97,132,137,-1,73,90,86,-1,150,90,73,-1,129,31,110,-1,129,105,31,-1,18,149,124,-1,18,148,149,-1,136,17,69,-1,136,121,17,-1,151,104,133,-1,151,55,104,-1,44,79,132,-1,44,43,79,-1,140,98,89,-1,98,140,145,-1,25,144,26,-1,152,144,25,-1,45,27,58,-1,45,23,27,-1,153,121,136,-1,153,122,121,-1,19,123,122,-1,19,143,123,-1,24,45,44,-1,23,45,24,-1,58,141,117,-1,27,141,58,-1,95,145,50,-1,146,145,95,-1,108,137,132,-1,108,138,137,-1,140,71,51,-1,71,140,62,-1,69,87,136,-1,88,87,69,-1,109,130,110,-1,130,109,85,-1,85,63,130,-1,85,64,63,-1,114,90,150,-1,114,116,90,-1,94,54,53,-1,54,94,49,-1,116,48,60,-1,116,114,48,-1,142,122,153,-1,122,142,19,-1,143,139,148,-1,143,21,139,-1,74,65,75,-1,111,65,74,-1,154,36,106,-1,36,154,34,-1,149,108,147,-1,138,108,149,-1,23,25,27,-1,22,25,23,-1,63,34,154,-1,34,63,14,-1,29,5,127,-1,5,29,6,-1,98,152,99,-1,144,152,98,-1,0,3,1,-1,0,112,3,-1,155,136,135,-1,155,153,136,-1,124,147,125,-1,149,147,124,-1,24,19,142,-1,19,24,20,-1,156,141,26,-1,156,100,141,-1,32,105,104,-1,32,31,105,-1,13,78,35,-1,78,13,128,-1,157,11,41,-1,157,9,11,-1,123,148,18,-1,143,148,123,-1,81,109,131,-1,83,109,81,-1,51,145,140,-1,51,50,145,-1,55,102,101,-1,151,102,55,-1,157,73,72,-1,157,150,73,-1,65,15,14,-1,15,65,68,-1,18,121,123,-1,18,17,121,-1,134,90,89,-1,90,134,86,-1,133,118,151,-1,107,118,133,-1,93,95,91,-1,93,120,95,-1,26,146,156,-1,146,26,144,-1,25,155,152,-1,25,22,155,-1,22,153,155,-1,142,153,22,-1,99,87,134,-1,99,135,87,-1,117,100,102,-1,117,141,100,-1,156,95,120,-1,146,95,156,-1,118,77,59,-1,77,118,107,-1,70,51,71,-1,70,49,51,-1,80,46,76,-1,80,84,46,-1,103,115,126,-1,103,125,115,-1,107,106,36,-1,133,106,107,-1,41,150,157,-1,114,150,41,-1,112,37,28,-1,112,38,37,-1,102,118,117,-1,118,102,151,-1,46,81,47,-1,46,83,81,-1,21,137,139,-1,137,21,97,-1,9,72,10,-1,157,72,9,-1,80,65,64,-1,65,80,75,-1,154,105,129,-1,154,106,105,-1,156,96,100,-1,156,120,96,-1,154,130,63,-1,154,129,130,-1,152,135,99,-1,152,155,135,-1,67,126,2,-1,103,126,67,-1],creaseAngle=1.571,
          coord=Coordinate(DEF='r_inferior_nasal_conchae_coordinate',point=[(-0.0026,-0.0007,-0.0032),(-0.0021,0.0018,-0.0058),(-0.0006,0.0029,-0.0078),(-0.0038,-0.0003,-0.0064),(-0.0012,0.0046,-0.0080),(-0.0046,-0.0017,0.0023),(-0.0044,-0.0009,0.0024),(-0.0040,0.0001,0.0048),(-0.0050,-0.0018,0.0020),(-0.0050,-0.0010,0.0019),(-0.0052,-0.0035,-0.0046),(-0.0043,0.0003,0.0048),(-0.0048,-0.0042,-0.0040),(0.0020,-0.0027,-0.0012),(0.0019,-0.0012,0.0038),(-0.0001,-0.0013,-0.0020),(-0.0002,0.0001,-0.0181),(-0.0001,0.0008,-0.0182),(0.0010,-0.0026,-0.0218),(0.0023,-0.0020,-0.0185),(0.0026,-0.0029,-0.0181),(0.0020,-0.0035,-0.0216),(0.0035,-0.0008,-0.0088),(0.0039,-0.0026,-0.0084),(0.0034,-0.0027,-0.0138),(0.0038,-0.0008,-0.0036),(0.0045,-0.0017,0.0011),(0.0044,-0.0034,-0.0030),(-0.0046,-0.0027,-0.0040),(-0.0046,-0.0034,-0.0039),(-0.0046,-0.0038,-0.0076),(0.0041,-0.0046,0.0190),(0.0044,-0.0056,0.0202),(0.0041,-0.0018,0.0219),(0.0030,-0.0036,0.0038),(0.0030,-0.0048,-0.0012),(0.0034,-0.0060,0.0035),(-0.0040,-0.0002,0.0025),(-0.0037,0.0001,0.0026),(-0.0033,0.0028,0.0067),(-0.0040,0.0003,-0.0061),(-0.0034,0.0030,0.0068),(-0.0017,0.0074,0.0110),(0.0038,-0.0042,-0.0081),(0.0034,-0.0040,-0.0135),(0.0038,-0.0036,-0.0081),(0.0003,0.0065,0.0161),(0.0005,0.0070,0.0164),(-0.0017,0.0079,0.0111),(0.0025,0.0068,0.0164),(0.0014,0.0056,0.0095),(0.0008,0.0062,0.0095),(0.0045,-0.0019,0.0215),(0.0030,0.0035,0.0181),(0.0030,0.0037,0.0188),(0.0048,-0.0082,0.0142),(0.0053,-0.0048,0.0195),(0.0048,-0.0054,0.0200),(0.0042,-0.0049,-0.0022),(0.0036,-0.0061,-0.0016),(-0.0012,0.0083,0.0113),(-0.0010,0.0082,0.0112),(-0.0009,0.0070,0.0068),(0.0028,-0.0015,0.0101),(0.0018,0.0009,0.0105),(0.0002,0.0008,0.0035),(-0.0011,0.0054,-0.0084),(-0.0003,0.0025,-0.0132),(-0.0014,0.0001,-0.0028),(-0.0001,0.0032,-0.0134),(0.0015,0.0074,0.0166),(-0.0002,0.0070,0.0103),(-0.0053,-0.0002,-0.0042),(-0.0024,0.0068,-0.0027),(-0.0011,0.0040,0.0073),(-0.0004,0.0044,0.0076),(-0.0015,0.0074,0.0111),(0.0031,-0.0061,-0.0015),(0.0029,-0.0030,-0.0076),(0.0034,-0.0043,-0.0079),(0.0002,0.0043,0.0108),(0.0024,0.0042,0.0205),(0.0028,0.0041,0.0207),(0.0021,0.0040,0.0200),(0.0014,0.0041,0.0159),(0.0028,-0.0002,0.0173),(-0.0016,0.0073,-0.0027),(-0.0005,0.0058,-0.0084),(-0.0009,0.0059,-0.0084),(-0.0008,0.0067,0.0018),(-0.0017,0.0072,0.0020),(0.0031,0.0039,0.0169),(0.0045,-0.0020,0.0212),(0.0046,-0.0025,0.0193),(0.0028,0.0053,0.0164),(0.0030,0.0030,0.0097),(0.0049,-0.0045,0.0122),(0.0028,-0.0037,-0.0178),(0.0005,0.0052,0.0014),(0.0001,0.0054,-0.0030),(0.0050,-0.0051,0.0077),(0.0048,-0.0071,0.0134),(0.0047,-0.0071,0.0092),(0.0004,0.0013,-0.0133),(0.0044,-0.0082,0.0145),(0.0041,-0.0067,0.0147),(0.0039,-0.0068,0.0102),(0.0032,-0.0078,0.0030),(0.0026,-0.0027,-0.0131),(0.0031,-0.0008,0.0207),(0.0037,-0.0031,0.0176),(-0.0008,0.0010,0.0035),(-0.0043,-0.0025,-0.0039),(-0.0018,0.0076,0.0108),(-0.0015,0.0069,0.0073),(0.0011,0.0001,-0.0075),(-0.0012,0.0071,0.0069),(0.0042,-0.0062,0.0024),(0.0037,-0.0078,0.0030),(-0.0049,-0.0038,-0.0076),(0.0047,-0.0025,0.0111),(0.0004,0.0008,-0.0181),(0.0015,-0.0004,-0.0183),(0.0014,-0.0026,-0.0218),(0.0009,-0.0009,-0.0176),(0.0012,0.0000,-0.0132),(0.0003,0.0015,-0.0077),(-0.0045,-0.0041,-0.0038),(0.0022,-0.0017,-0.0075),(0.0038,-0.0037,0.0154),(0.0036,-0.0026,0.0160),(0.0036,-0.0012,0.0213),(0.0029,-0.0042,-0.0133),(0.0039,-0.0083,0.0105),(-0.0010,0.0069,-0.0028),(0.0003,0.0045,-0.0085),(0.0003,0.0032,-0.0137),(0.0024,-0.0039,-0.0175),(0.0023,-0.0030,-0.0171),(0.0017,-0.0035,-0.0217),(0.0001,0.0062,0.0060),(0.0045,-0.0043,0.0018),(0.0029,-0.0013,-0.0140),(0.0018,-0.0032,-0.0218),(0.0024,0.0030,0.0013),(0.0011,0.0053,0.0057),(0.0029,0.0030,0.0054),(0.0021,-0.0015,-0.0129),(0.0014,-0.0032,-0.0219),(0.0018,-0.0021,-0.0171),(-0.0024,0.0068,0.0020),(0.0045,-0.0083,0.0101),(0.0018,0.0031,-0.0033),(0.0017,0.0012,-0.0141),(0.0037,-0.0041,0.0100),(0.0020,0.0025,-0.0089),(0.0047,-0.0022,0.0062),(-0.0049,0.0014,0.0019)])))])])
)

### X3D model conversion complete ###

####################################################################################################
# Self-test diagnostics
####################################################################################################

print('Self-test diagnostics for r_inferior_nasal_conchae.py:')
if        metaDiagnostics(newModel): # built-in utility method in X3D class
    print(metaDiagnostics(newModel)) # display meta info, hint, warning, error, TODO values in this model
# print('check newModel.XML() serialization...')
newModelXML= newModel.XML() # test export method XML() for exceptions during export
newModel.XMLvalidate()
# print(newModelXML) # diagnostic

try:
#   print('check newModel.VRML() serialization...')
    newModelVRML=newModel.VRML() # test export method VRML() for exceptions during export
    # print(prependLineNumbers(newModelVRML)) # debug
    print("Python-to-VRML export of VRML output successful", flush=True)
except Exception as err: # usually BaseException
    # https://stackoverflow.com/questions/18176602/how-to-get-the-name-of-an-exception-that-was-caught-in-python
    print("*** Python-to-VRML export of VRML output failed:", type(err).__name__, err)
    if newModelVRML: # may have failed to generate
        print(prependLineNumbers(newModelVRML, err.lineno))

try:
#   print('check newModel.JSON() serialization...')
    newModelJSON=newModel.JSON() # test export method JSON() for exceptions during export
#   print(prependLineNumbers(newModelJSON)) # debug
    print("Python-to-JSON export of JSON output successful (under development)")
except Exception as err: # usually SyntaxError
    print("*** Python-to-JSON export of JSON output failed:", type(err).__name__, err)
    if newModelJSON: # may have failed to generate
        print(prependLineNumbers(newModelJSON,err.lineno))

print("python r_inferior_nasal_conchae.py load and self-test diagnostics complete.")
