{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Immersive",
    "@version":"3.0",
    "@xsd:noNamespaceSchemaLocation":"https://www.web3d.org/specifications/x3d-3.0.xsd",
    "JSON schema":"https://www.web3d.org/specifications/x3d-4.0-JSONSchema.autogenerated.json",
    "head": {
        "component": [
          {
            "@name":"DIS",
            "@level":1
          }
        ],
        "meta": [
          {
            "@name":"title",
            "@content":"TSSRPairPrototypeWithDIS.x3d"
          },
          {
            "@name":"description",
            "@content":"A pair of Tropo Satellite Support Radios (TSSR) used for short-range (< 20 miles) point-to-point SHF communication. The system designed to support remote equipment and users by replacing long cable runs."
          },
          {
            "@name":"creator",
            "@content":"Mike Hunsberger"
          },
          {
            "@name":"created",
            "@content":"1 May 2001"
          },
          {
            "@name":"modified",
            "@content":"20 October 2019"
          },
          {
            "@name":"warning",
            "@content":"upgrade ViewpointGroup"
          },
          {
            "@name":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/TSSR/TSSRPairPrototypeWithDIS.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../../license.html"
          },
          {
            "@name":"translated",
            "@content":"21 April 2026"
          },
          {
            "@name":"generator",
            "@content":"X3dToJson.xslt, https://www.web3d.org/x3d/stylesheets/X3dToJson.html"
          },
          {
            "@name":"reference",
            "@content":"X3D JSON encoding: https://www.web3d.org/wiki/index.php/X3D_JSON_Encoding"
          }
        ]
    },
    "Scene": {
        "-children":[
          {
            "#comment":"ExternProtoDeclare definitions must be included verbatim"
          },
          { "ExternProtoDeclare":
            {
              "@name":"BeamCylinder",
              "@appinfo":"Produce wireframe or transparent beam cylinders. Typical uses include propeller/thruster water flow or line-of-sight sonar/radar/light beams. Negative range values invert base and apex at same relative location. Default: beam with apex at (0 0 0) and base of radius 1 in x-z plane at (1 0 0).",
              "@url":["../../CommunicationsAndSensors/Beam/BeamCylinderPrototype.x3d#BeamCylinder","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/Beam/BeamCylinderPrototype.x3d#BeamCylinder","../../CommunicationsAndSensors/Beam/BeamCylinderPrototype.wrl#BeamCylinder","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/Beam/BeamCylinderPrototype.wrl#BeamCylinder"],
              "field": [
                {
                  "@name":"name",
                  "@accessType":"initializeOnly",
                  "@appinfo":"Assigning a name to a BeamCylinder aids tracing",
                  "@type":"SFString"
                },
                {
                  "@name":"contact",
                  "@accessType":"inputOnly",
                  "@appinfo":"(communications) is transmitted signal in contact with receiver or (sensor) is a target return detected?",
                  "@type":"SFBool"
                },
                {
                  "@name":"range",
                  "@accessType":"inputOnly",
                  "@appinfo":"distance in meters along x axis",
                  "@type":"SFFloat"
                },
                {
                  "@name":"defaultRange",
                  "@accessType":"initializeOnly",
                  "@appinfo":"distance in meters used until eventIn range sent",
                  "@type":"SFFloat"
                },
                {
                  "@name":"wireframe",
                  "@accessType":"initializeOnly",
                  "@appinfo":"whether wireframe beam is drawn",
                  "@type":"SFBool"
                },
                {
                  "@name":"solid",
                  "@accessType":"initializeOnly",
                  "@appinfo":"whether solid beam is drawn",
                  "@type":"SFBool"
                },
                {
                  "@name":"beamHeight",
                  "@accessType":"initializeOnly",
                  "@appinfo":"meters across vertical y axis",
                  "@type":"SFFloat"
                },
                {
                  "@name":"beamWidth",
                  "@accessType":"initializeOnly",
                  "@appinfo":"meters across horizontal z axis",
                  "@type":"SFFloat"
                },
                {
                  "@name":"contactColor",
                  "@accessType":"initializeOnly",
                  "@appinfo":"rendering color when contact=true",
                  "@type":"SFColor"
                },
                {
                  "@name":"noContactColor",
                  "@accessType":"initializeOnly",
                  "@appinfo":"rendering color when contact=false",
                  "@type":"SFColor"
                },
                {
                  "@name":"transparency",
                  "@accessType":"inputOutput",
                  "@appinfo":"1 = fully transparent wireframe only",
                  "@type":"SFFloat"
                }
              ],
              "-children":[
                {
                  "#comment":"eventIn, eventOut and field semantics must be retained due to exposedField not being allowed in VRML 97 scripts (unfortunately)"
                }
              ]
            }
          },
          { "ExternProtoDeclare":
            {
              "@name":"ViewpointGroup",
              "@appinfo":"warning: developmental prototype for X3D v3.2 node do not override native support!",
              "@url":["../../../Basic/development/ViewpointGroupPrototype.x3d#ViewpointGroup","https://www.web3d.org/x3d/content/examples/Basic/development/ViewpointGroupPrototype.x3d#ViewpointGroup","../../../Basic/development/ViewpointGroupPrototype.wrl#ViewpointGroup","https://www.web3d.org/x3d/content/examples/Basic/development/ViewpointGroupPrototype.wrl#ViewpointGroup"],
              "field": [
                {
                  "@name":"children",
                  "@accessType":"inputOutput",
                  "@appinfo":"[Viewpoint | ViewpointGroup] only",
                  "@type":"MFNode"
                },
                {
                  "@name":"description",
                  "@accessType":"inputOutput",
                  "@appinfo":"Text description or navigation hint to be displayed for this ViewpointGroup.",
                  "@type":"SFString"
                },
                {
                  "@name":"displayed",
                  "@accessType":"inputOutput",
                  "@appinfo":"Whether this ViewpointGroup description is displayed in current viewpoint list.",
                  "@type":"SFBool"
                },
                {
                  "@name":"center",
                  "@accessType":"inputOutput",
                  "@appinfo":"Position offset from origin of local coordinate system.",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"radius",
                  "@accessType":"initializeOnly",
                  "@appinfo":"[0..infinity) Radius in meters of Proximity box within which the ViewpointGroup is usable and displayed on the viewpoint list.",
                  "@type":"SFFloat"
                },
                {
                  "@name":"set_radius",
                  "@accessType":"inputOnly",
                  "@appinfo":"[0..infinity) Radius in meters of Proximity box within which the ViewpointGroup is usable and displayed on the viewpoint list.",
                  "@type":"SFFloat"
                },
                {
                  "@name":"retainUserOffsets",
                  "@accessType":"inputOutput",
                  "@appinfo":"Whether viewpoint needs to retain (true) or rezero (false) any prior user navigation offsets from defined viewpoint position orientation.",
                  "@type":"SFBool"
                }
              ]
            }
          },
          {
            "#comment":"PROTO consists of two TSSRs for short range (< 5 mile) point-to-point communication. TSSRs eliminate the need for long cable runs. This PROTO allow specification for the initial placement of each TSSR. It automatically calculates the correct angle to complete the link."
          },
          { "ProtoDeclare":
            {
              "@name":"TSSRPairDIS",
              "ProtoInterface": {
                  "field": [
                    {
                      "@name":"TSSR1Location",
                      "@accessType":"initializeOnly",
                      "@type":"SFVec3f",
                      "@value":[1,1,1]
                    },
                    {
                      "@name":"TSSR2Location",
                      "@accessType":"initializeOnly",
                      "@type":"SFVec3f",
                      "@value":[0,0,0]
                    }
                  ]
              },
              "ProtoBody": {
                  "-children":[
                    { "Group":
                      {
                        "-children":[
                          { "Viewpoint":
                            {
                              "@DEF":"TSSRPairViewpoint",
                              "@description":"TSSR Pair Viewpoint"
                            }
                          },
                          { "LOD":
                            {
                              "@range":[40000],
                              "-children":[
                                {
                                  "#comment":"TSSR 1 Two Transforms. One in the XZ plane, the second in the XY plane. Inlines for the TSSR body, stand, and the dome pattern."
                                },
                                { "EspduTransform":
                                  {
                                    "@DEF":"TSSR1_TRANSFORM",
                                    "@address":"224.2.181.145",
                                    "@port":62040,
                                    "IS": {
                                        "connect": [
                                          {
                                            "@nodeField":"translation",
                                            "@protoField":"TSSR1Location"
                                          }
                                        ]
                                    },
                                    "-children":[
                                      { "Transform":
                                        {
                                          "@DEF":"TSSR1_XY_TRANSFORM",
                                          "-children":[
                                            { "Inline":
                                              {
                                                "@DEF":"TSSRBody",
                                                "@url":["../../CommunicationsAndSensors/TSSR/TSSRBody.x3d","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/TSSR/TSSRBody.x3d","../../CommunicationsAndSensors/TSSR/TSSRBody.wrl","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/TSSR/TSSRBody.wrl"]
                                              }
                                            },
                                            { "Transform":
                                              {
                                                "@translation":[-5,0,0],
                                                "-children":[
                                                  { "ReceiverPdu":
                                                    {
                                                      "@DEF":"TSSR1_RECEIVER",
                                                      "@address":"224.2.181.145",
                                                      "@entityID":1,
                                                      "@port":62040,
                                                      "@readInterval":1
                                                    }
                                                  }
                                                ]
                                              }
                                            },
                                            { "TransmitterPdu":
                                              {
                                                "@DEF":"TSSR1_TRANSMITTER",
                                                "@address":"224.2.181.145",
                                                "@antennaLocation":[-5,0,0],
                                                "@entityID":5,
                                                "@port":62040,
                                                "@readInterval":1
                                              }
                                            },
                                            { "Transform":
                                              {
                                                "@DEF":"TSSR1Cone",
                                                "@translation":[1,0,1],
                                                "-children":[
                                                  { "Transform":
                                                    {
                                                      "@translation":[2,2,0],
                                                      "-children":[
                                                        { "Shape":
                                                          {
                                                            "-geometry":
                                                              { "Text":
                                                                {
                                                                  "@string":["Near End Transmitter to Far End Receiver Link"]
                                                                }
                                                              },
                                                            "-appearance":
                                                              { "Appearance":
                                                                {
                                                                  "@DEF":"TextAppearance",
                                                                  "-material":
                                                                    { "Material":
                                                                      {
                                                                        "@diffuseColor":[1,0.937255,0.121569]
                                                                      }
                                                                    }
                                                                }
                                                              }
                                                          }
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  { "ProtoInstance":
                                                    {
                                                      "@name":"BeamCylinder",
                                                      "@DEF":"TSSR1_BEAMCYLINDER",
                                                      "fieldValue": [
                                                        {
                                                          "@name":"defaultRange",
                                                          "@value":10
                                                        },
                                                        {
                                                          "@name":"beamHeight",
                                                          "@value":1
                                                        },
                                                        {
                                                          "@name":"beamWidth",
                                                          "@value":1
                                                        },
                                                        {
                                                          "@name":"transparency",
                                                          "@value":0.2
                                                        },
                                                        {
                                                          "@name":"wireframe",
                                                          "@value":true
                                                        },
                                                        {
                                                          "@name":"solid",
                                                          "@value":true
                                                        },
                                                        {
                                                          "@name":"contactColor",
                                                          "@value":[0.3,0.5,0.5]
                                                        },
                                                        {
                                                          "@name":"noContactColor",
                                                          "@value":[0.8,0.1,0.1]
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  { "LOD":
                                                    {
                                                      "@range":[100],
                                                      "-children":[
                                                        { "ProtoInstance":
                                                          {
                                                            "@name":"ViewpointGroup",
                                                            "fieldValue": [
                                                              {
                                                                "@name":"description",
                                                                "@value":"100m from TSSR1"
                                                              },
                                                              {
                                                                "@name":"radius",
                                                                "@value":100
                                                              },
                                                              {
                                                                "@name":"children",
                                                                "-children":[
                                                                  { "Viewpoint":
                                                                    {
                                                                      "@description":"TSSR1 side view"
                                                                    }
                                                                  }
                                                                ]
                                                              }
                                                            ]
                                                          }
                                                        },
                                                        { "WorldInfo":
                                                          {
                                                            "@info":["null node for no rendering when distant"]
                                                          }
                                                        }
                                                      ]
                                                    }
                                                  }
                                                ]
                                              }
                                            }
                                          ]
                                        }
                                      },
                                      { "Transform":
                                        {
                                          "-children":[
                                            { "Inline":
                                              {
                                                "@DEF":"TSSRStand",
                                                "@url":["../../CommunicationsAndSensors/TSSR/TSSRTripod.x3d","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/TSSR/TSSRTripod.x3d","../../CommunicationsAndSensors/TSSR/TSSRTripod.wrl","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/TSSR/TSSRTripod.wrl"]
                                              }
                                            }
                                          ]
                                        }
                                      }
                                    ]
                                  }
                                },
                                { "WorldInfo":
                                  {
                                    "@info":["null node for no rendering when distant"]
                                  }
                                }
                              ]
                            }
                          },
                          { "LOD":
                            {
                              "@range":[40000],
                              "-children":[
                                {
                                  "#comment":"TSSR 2 Two Transforms. One in the XZ plane, the second in the XY plane. Inlines for the TSSR body, stand, and the dome pattern."
                                },
                                { "EspduTransform":
                                  {
                                    "@DEF":"TSSR2_TRANSFORM",
                                    "@address":"224.2.181.145",
                                    "@port":62040,
                                    "IS": {
                                        "connect": [
                                          {
                                            "@nodeField":"translation",
                                            "@protoField":"TSSR2Location"
                                          }
                                        ]
                                    },
                                    "-children":[
                                      { "Transform":
                                        {
                                          "@DEF":"TSSR2_XY_TRANSFORM",
                                          "-children":[
                                            { "Inline":
                                              {
                                                "@USE":"TSSRBody"
                                              }
                                            },
                                            { "Transform":
                                              {
                                                "@translation":[-5,0,0],
                                                "-children":[
                                                  { "ReceiverPdu":
                                                    {
                                                      "@DEF":"TSSR2_RECEIVER",
                                                      "@address":"224.2.181.145",
                                                      "@entityID":2,
                                                      "@port":62040,
                                                      "@readInterval":1
                                                    }
                                                  }
                                                ]
                                              }
                                            },
                                            { "TransmitterPdu":
                                              {
                                                "@DEF":"TSSR2_TRANSMITTER",
                                                "@address":"224.2.181.145",
                                                "@antennaLocation":[-5,0,0],
                                                "@entityID":6,
                                                "@port":62040,
                                                "@readInterval":1
                                              }
                                            },
                                            { "Transform":
                                              {
                                                "@DEF":"TSSR2Cone",
                                                "@translation":[1,0,1],
                                                "-children":[
                                                  { "Transform":
                                                    {
                                                      "@translation":[2,2,0],
                                                      "-children":[
                                                        { "Shape":
                                                          {
                                                            "-geometry":
                                                              { "Text":
                                                                {
                                                                  "@string":["Near End Transmitter to Far End Receiver Link"]
                                                                }
                                                              },
                                                            "-appearance":
                                                              { "Appearance":
                                                                {
                                                                  "@USE":"TextAppearance"
                                                                }
                                                              }
                                                          }
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  { "ProtoInstance":
                                                    {
                                                      "@name":"BeamCylinder",
                                                      "@DEF":"TSSR2_BEAMCYLINDER",
                                                      "fieldValue": [
                                                        {
                                                          "@name":"defaultRange",
                                                          "@value":10
                                                        },
                                                        {
                                                          "@name":"beamHeight",
                                                          "@value":1
                                                        },
                                                        {
                                                          "@name":"beamWidth",
                                                          "@value":1
                                                        },
                                                        {
                                                          "@name":"transparency",
                                                          "@value":0.2
                                                        },
                                                        {
                                                          "@name":"wireframe",
                                                          "@value":true
                                                        },
                                                        {
                                                          "@name":"solid",
                                                          "@value":true
                                                        },
                                                        {
                                                          "@name":"contactColor",
                                                          "@value":[0.3,0.5,0.5]
                                                        },
                                                        {
                                                          "@name":"noContactColor",
                                                          "@value":[0.8,0.1,0.1]
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  { "LOD":
                                                    {
                                                      "@range":[100],
                                                      "-children":[
                                                        { "ProtoInstance":
                                                          {
                                                            "@name":"ViewpointGroup",
                                                            "fieldValue": [
                                                              {
                                                                "@name":"description",
                                                                "@value":"100m from TSSR2"
                                                              },
                                                              {
                                                                "@name":"radius",
                                                                "@value":100
                                                              },
                                                              {
                                                                "@name":"children",
                                                                "-children":[
                                                                  { "Viewpoint":
                                                                    {
                                                                      "@description":"TSSR2 side view",
                                                                      "@orientation":[0,1,0,3.14],
                                                                      "@position":[0,0,-10]
                                                                    }
                                                                  }
                                                                ]
                                                              }
                                                            ]
                                                          }
                                                        },
                                                        { "WorldInfo":
                                                          {
                                                            "@info":["null node for no rendering when distant"]
                                                          }
                                                        }
                                                      ]
                                                    }
                                                  }
                                                ]
                                              }
                                            }
                                          ]
                                        }
                                      },
                                      { "Transform":
                                        {
                                          "-children":[
                                            { "Inline":
                                              {
                                                "@USE":"TSSRStand"
                                              }
                                            }
                                          ]
                                        }
                                      }
                                    ]
                                  }
                                },
                                { "WorldInfo":
                                  {
                                    "@info":["null node for no rendering when distant"]
                                  }
                                }
                              ]
                            }
                          },
                          { "Script":
                            {
                              "@DEF":"TransmitScript",
                              "field": [
                                {
                                  "@name":"transState",
                                  "@accessType":"inputOnly",
                                  "@type":"SFInt32"
                                },
                                {
                                  "@name":"size",
                                  "@accessType":"outputOnly",
                                  "@type":"SFVec3f"
                                }
                              ],
                              "#sourceCode":[
"",
"",
"ecmascript:",
"",
"function initialize ()",
"{",
"\tsize = new SFVec3f(100, 100, 100) ;",
"\tBrowser.println ('TransmitScript initialize() complete') ;",
"}",
"",
"// function name matches eventIn variable name ('hour')",
"// hourValue captures the new value of the ROUTE hour event",
"// minutes is just the current field value",
"",
"function transState (newValue, timestamp)",
"{",
"\ttransmitState = newValue ;",
"\tif (transmitState == 3) {",
"\t\tsize = new SFVec3f(10, 10, 10) ;",
"\t}",
"\telse {",
"\t\tsize = new SFVec3f(100, 100, 100) ;",
"\t}",
"\tBrowser.println ('size\t= ' + size) ;",
"}",
"",
""
]
                            }
                          },
                          { "Script":
                            {
                              "@DEF":"TransmitScript2",
                              "field": [
                                {
                                  "@name":"transState",
                                  "@accessType":"inputOnly",
                                  "@type":"SFInt32"
                                },
                                {
                                  "@name":"size",
                                  "@accessType":"outputOnly",
                                  "@type":"SFVec3f"
                                }
                              ],
                              "#sourceCode":[
"",
"",
"ecmascript:",
"",
"function initialize ()",
"{",
"\tsize = new SFVec3f(100, 100, 100) ;",
"\tBrowser.println ('TransmitScript initialize() complete') ;",
"}",
"",
"// function name matches eventIn variable name ('hour')",
"// hourValue captures the new value of the ROUTE hour event",
"// minutes is just the current field value",
"",
"function transState (newValue, timestamp)",
"{",
"\ttransmitState = newValue ;",
"\tif (transmitState == 3) {",
"\t\tsize = new SFVec3f(10, 10, 10) ;",
"\t}",
"\telse {",
"\t\tsize = new SFVec3f(100, 100, 100) ;",
"\t}",
"\tBrowser.println ('size\t= ' + size) ;",
"}",
"",
""
]
                            }
                          },
                          {
                            "#comment":"This script is used to calculate the corresponding rotation angles so the TSSRs will be pointed at each other"
                          },
                          { "Script":
                            {
                              "@DEF":"CalculateAngleScript",
                              "field": [
                                {
                                  "@name":"TSSR1Location",
                                  "@accessType":"initializeOnly",
                                  "@type":"SFVec3f"
                                },
                                {
                                  "@name":"TSSR2Location",
                                  "@accessType":"initializeOnly",
                                  "@type":"SFVec3f"
                                },
                                {
                                  "@name":"TSSR1_XZangle",
                                  "@accessType":"outputOnly",
                                  "@type":"SFRotation"
                                },
                                {
                                  "@name":"TSSR2_XZangle",
                                  "@accessType":"outputOnly",
                                  "@type":"SFRotation"
                                },
                                {
                                  "@name":"beamScale",
                                  "@accessType":"outputOnly",
                                  "@type":"SFVec3f"
                                },
                                {
                                  "@name":"beamLengthLink1",
                                  "@accessType":"outputOnly",
                                  "@type":"SFFloat"
                                },
                                {
                                  "@name":"beamLengthLink2",
                                  "@accessType":"outputOnly",
                                  "@type":"SFFloat"
                                },
                                {
                                  "@name":"TSSR1_XYangle",
                                  "@accessType":"outputOnly",
                                  "@type":"SFRotation"
                                },
                                {
                                  "@name":"TSSR2_XYangle",
                                  "@accessType":"outputOnly",
                                  "@type":"SFRotation"
                                },
                                {
                                  "@name":"TSSR1ToTSSR2Link",
                                  "@accessType":"outputOnly",
                                  "@type":"SFBool"
                                },
                                {
                                  "@name":"TSSR2ToTSSR1Link",
                                  "@accessType":"outputOnly",
                                  "@type":"SFBool"
                                },
                                {
                                  "@name":"ViewpointLocation",
                                  "@accessType":"outputOnly",
                                  "@type":"SFVec3f"
                                },
                                {
                                  "@name":"ViewpointAngle",
                                  "@accessType":"outputOnly",
                                  "@type":"SFRotation"
                                },
                                {
                                  "@name":"TSSR1_receiverState",
                                  "@accessType":"inputOnly",
                                  "@type":"SFInt32"
                                },
                                {
                                  "@name":"TSSR2_receiverState",
                                  "@accessType":"inputOnly",
                                  "@type":"SFInt32"
                                },
                                {
                                  "@name":"TSSR1_transmitState",
                                  "@accessType":"inputOnly",
                                  "@type":"SFInt32"
                                },
                                {
                                  "@name":"TSSR2_transmitState",
                                  "@accessType":"inputOnly",
                                  "@type":"SFInt32"
                                }
                              ],
                              "IS": {
                                  "connect": [
                                    {
                                      "@nodeField":"TSSR1Location",
                                      "@protoField":"TSSR1Location"
                                    },
                                    {
                                      "@nodeField":"TSSR2Location",
                                      "@protoField":"TSSR2Location"
                                    }
                                  ]
                              },
                              "#sourceCode":[
"",
"",
"ecmascript:",
"",
"function initialize ()",
"{",
"\tBrowser.println ('TSSR1\t=' + TSSR1Location) ;",
"\tBrowser.println ('TSSR2\t=' + TSSR2Location) ;",
"\tBrowser.println ('TransmitScript initialize() complete') ;",
"\tactive = true ;",
"\tTSSR1_XZangle\t= new SFRotation(0, 1, 0, 0) ;",
"\tTSSR2_XZangle\t= new SFRotation(0, 1, 0, 0) ;",
"\tTSSR1_XYangle\t= new SFRotation(0, 0, 1, 0) ;",
"\tTSSR2_XYangle\t= new SFRotation(0, 0, 1, 0) ;",
"",
"\tbeamScale\t\t= new SFVec3f ( ) ;",
"\tViewpointLocation\t= new SFVec3f ( ) ;",
"\tViewpointAngle\t\t= new SFRotation(0, 1, 0, 0) ;",
"",
"\tTSSR1_RXState\t= 0 ;",
"\tTSSR1_TXState\t= 2 ;",
"\tTSSR2_RXState\t= 0 ;",
"\tTSSR2_TXState\t= 1 ;",
"\tTSSR1ToTSSR2Link\t= true;",
"\tTSSR2ToTSSR1Link\t= true;",
"\tDistanceAcceptable\t= true ;",
"",
"\tcompute(active) ;",
"}",
"",
"function TSSR1_receiverState(newValue, timestamp) {",
"\tTSSR1_RXState = newValue ;",
"\tcomputeLink( ) ;",
"}",
"",
"function TSSR2_transmitState(newValue, timestamp) {",
"\tTSSR2_TXState = newValue ;",
"\tcomputeLink( ) ;",
"}",
"",
"function TSSR2_receiverState(newValue, timestamp) {",
"\tTSSR2_RXState = newValue ;",
"\tcomputeLink( ) ;",
"}",
"",
"function TSSR1_transmitState(newValue, timestamp) {",
"\tTSSR1_TXState = newValue ;",
"\tcomputeLink( ) ;",
"}",
"",
"function computeLink( )",
"{",
"\tif ((TSSR2_TXState ==2) && (DistanceAcceptable)) {",
"\t\tbeamLengthLink2 \t= distance - 2 ;",
"\t\tif (TSSR1_RXState == 2) {",
"\t\t\tTSSR2ToTSSR1Link = true ;",
"\t\t}",
"\t\telse",
"\t\t{",
"\t\t\tTSSR2ToTSSR1Link = false ;",
"\t\t}",
"\t}",
"\telse if ((TSSR2_TXState < 2) && (DistanceAcceptable)) {",
"\t\tbeamLengthLink2 \t= 5 ;",
"\t\tTSSR2ToTSSR1Link = false ;",
"\t}",
"\tif ((TSSR1_TXState ==2) && (DistanceAcceptable)) {",
"\t\tbeamLengthLink1 \t= distance - 2 ;",
"\t\tif (TSSR2_RXState == 2) {",
"\t\t\tTSSR1ToTSSR2Link = true ;",
"\t\t}",
"\t\telse",
"\t\t{",
"\t\t\tTSSR1ToTSSR2Link = false ;",
"\t\t}",
"\t}",
"\telse if ((TSSR1_TXState < 2) && (DistanceAcceptable)) {",
"\t\tbeamLengthLink1 \t= 5 ;",
"\t\tTSSR1ToTSSR2Link = false ;",
"\t}",
"}",
"",
"",
"function compute ( )",
"{",
"\tcomputeDistance( ) ;",
"\tcomputeXZangle( );",
"\tViewpointLocation[0] = TSSR1Location[0] ;",
"\tViewpointLocation[1] = TSSR1Location[1] + 4;",
"\tViewpointLocation[2] = TSSR1Location[2] ;",
"\tBrowser.println ('ViewpointLocation\t=' + ViewpointLocation) ;",
"\tViewpointAngle[3] = TSSR1_XZangle[3] - Math.PI/2;",
"\tBrowser.println ('ViewpointAngle\t=' + ViewpointAngle) ;",
"\tcomputeXYangle( ) ;",
"}",
"",
"function computeDistance( )",
"{",
"\tBrowser.println ('TSSR1\t=' + TSSR1Location) ;",
"\tBrowser.println ('TSSR2\t=' + TSSR2Location) ;",
"\tdeltaX \t= (TSSR2Location[0] - TSSR1Location[0]) ;",
"\tdeltaY \t= (TSSR2Location[1] - TSSR1Location[1]) ;",
"\tdeltaZ \t= (TSSR2Location[2] - TSSR1Location[2]) ;",
"\tdistanceSquared\t= deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ ;",
"\tBrowser.println ('Distance Squared\t=' + distanceSquared) ;",
"\tdistance \t= Math.sqrt(distanceSquared) ;",
"\tBrowser.println ('Distance\t=' + distance) ;",
"",
"\tbeamScale[0] \t= distance/10;",
"\tbeamScale[1]\t= 5;",
"\tbeamScale[2]\t= 5;",
"\tBrowser.println ('BeamScale\t=' + beamScale) ;",
"\tif (distance > 5000/.6) {",
"\t\tDistanceAcceptable = false;",
"\t\tbeamLength = 5000;",
"\t}",
"\telse {",
"\t\tDistanceAcceptable = true ;",
"\t}",
"}",
"",
"function computeXZangle( )",
"{",
"\tif (deltaZ == 0) {",
"\t\tdeltaZ = .00000001 ;",
"\t}",
"",
"\tangle \t= Math.atan(deltaX/deltaZ) ;",
"\tif (deltaZ < 0) {",
"\t\tTSSR1_XZangle[3] = angle + Math.PI/2;",
"\t}",
"\telse {",
"\t\tTSSR1_XZangle[3] = angle -  Math.PI/2;",
"\t}",
"\tTSSR2_XZangle[3]  = TSSR1_XZangle[3] +  Math.PI;",
"",
"\tBrowser.println ('Angle\t=' + TSSR1_XZangle[3]) ;",
"\tBrowser.println ('Angle2\t=' + TSSR2_XZangle[3]) ;",
"}",
"",
"function computeXYangle( )",
"{",
"\tangle \t= Math.asin(deltaY/distance) ;",
"\tTSSR1_XYangle[3] = angle ;",
"\tTSSR2_XYangle[3]  = - TSSR1_XYangle[3];",
"",
"\tBrowser.println ('AngleXY\t=' + TSSR1_XYangle[3]) ;",
"\tBrowser.println ('Angle2XY\t=' + TSSR2_XYangle[3]) ;",
"}",
"",
""
]
                            }
                          }
                        ]
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"TSSR1_XZangle",
                        "@fromNode":"CalculateAngleScript",
                        "@toField":"rotation",
                        "@toNode":"TSSR1_TRANSFORM"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"TSSR2_XZangle",
                        "@fromNode":"CalculateAngleScript",
                        "@toField":"rotation",
                        "@toNode":"TSSR2_TRANSFORM"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"beamLengthLink1",
                        "@fromNode":"CalculateAngleScript",
                        "@toField":"range",
                        "@toNode":"TSSR1_BEAMCYLINDER"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"beamLengthLink2",
                        "@fromNode":"CalculateAngleScript",
                        "@toField":"range",
                        "@toNode":"TSSR2_BEAMCYLINDER"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"TSSR1_XYangle",
                        "@fromNode":"CalculateAngleScript",
                        "@toField":"rotation",
                        "@toNode":"TSSR1_XY_TRANSFORM"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"TSSR2_XYangle",
                        "@fromNode":"CalculateAngleScript",
                        "@toField":"rotation",
                        "@toNode":"TSSR2_XY_TRANSFORM"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"TSSR1ToTSSR2Link",
                        "@fromNode":"CalculateAngleScript",
                        "@toField":"contact",
                        "@toNode":"TSSR1_BEAMCYLINDER"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"TSSR2ToTSSR1Link",
                        "@fromNode":"CalculateAngleScript",
                        "@toField":"contact",
                        "@toNode":"TSSR2_BEAMCYLINDER"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"ViewpointLocation",
                        "@fromNode":"CalculateAngleScript",
                        "@toField":"position",
                        "@toNode":"TSSRPairViewpoint"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"ViewpointAngle",
                        "@fromNode":"CalculateAngleScript",
                        "@toField":"orientation",
                        "@toNode":"TSSRPairViewpoint"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"transmitState",
                        "@fromNode":"TSSR2_TRANSMITTER",
                        "@toField":"TSSR2_transmitState",
                        "@toNode":"CalculateAngleScript"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"transmitState",
                        "@fromNode":"TSSR1_TRANSMITTER",
                        "@toField":"TSSR1_transmitState",
                        "@toNode":"CalculateAngleScript"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"receiverState",
                        "@fromNode":"TSSR1_RECEIVER",
                        "@toField":"TSSR1_receiverState",
                        "@toNode":"CalculateAngleScript"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"receiverState",
                        "@fromNode":"TSSR2_RECEIVER",
                        "@toField":"TSSR2_receiverState",
                        "@toNode":"CalculateAngleScript"
                      }
                    }
                  ]
              }
            }
          },
          { "WorldInfo":
            {
              "@info":["Authors: Mike Hunsberger","Revised: 30 April 2001","Purpose: Pair of TSSRs","Browser: CosmoPlayer"],
              "@title":"AntennaWorld"
            }
          },
          { "ProtoInstance":
            {
              "@name":"TSSRPairDIS",
              "fieldValue": [
                {
                  "@name":"TSSR1Location",
                  "@value":[0,0,0]
                },
                {
                  "@name":"TSSR2Location",
                  "@value":[50,0,50]
                }
              ]
            }
          },
          { "Background":
            {
              "@groundAngle":[1.57079],
              "@groundColor":[1,0.8,0.6,0.6,0.4,0.2],
              "@skyAngle":[0.2],
              "@skyColor":[1,1,1,0.2,0.2,1]
            }
          }
        ]
    }
  }
}