{ "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": {
        "meta": [
          {
            "@name":"title",
            "@content":"TSSRPairPrototype.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":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/TSSR/TSSRPairPrototype.x3d"
          },
          {
            "@name":"reference",
            "@content":"https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/TSSR/TSSRPairExample.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../../license.html"
          },
          {
            "@name":"translated",
            "@content":"26 March 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":[
          { "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"
                }
              ]
            }
          },
          {
            "#comment":"ExternProtoDeclare definitions must be included verbatim"
          },
          {
            "#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":"TSSRPair",
              "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."
                                },
                                { "Transform":
                                  {
                                    "@DEF":"TSSR1_TRANSFORM",
                                    "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":
                                              {
                                                "@DEF":"TSSR1Cone",
                                                "@translation":[1,0,0],
                                                "-children":[
                                                  { "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":[
                                                        { "Transform":
                                                          {
                                                            "-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."
                                },
                                { "Transform":
                                  {
                                    "@DEF":"TSSR2_TRANSFORM",
                                    "IS": {
                                        "connect": [
                                          {
                                            "@nodeField":"translation",
                                            "@protoField":"TSSR2Location"
                                          }
                                        ]
                                    },
                                    "-children":[
                                      { "Transform":
                                        {
                                          "@DEF":"TSSR2_XY_TRANSFORM",
                                          "-children":[
                                            { "Inline":
                                              {
                                                "@USE":"TSSRBody"
                                              }
                                            },
                                            { "Transform":
                                              {
                                                "@DEF":"TSSR2Cone",
                                                "@translation":[1,0,0],
                                                "-children":[
                                                  { "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":[
                                                        { "Transform":
                                                          {
                                                            "-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":"beamLength",
                                  "@accessType":"outputOnly",
                                  "@type":"SFFloat"
                                },
                                {
                                  "@name":"TSSR1_XYangle",
                                  "@accessType":"outputOnly",
                                  "@type":"SFRotation"
                                },
                                {
                                  "@name":"TSSR2_XYangle",
                                  "@accessType":"outputOnly",
                                  "@type":"SFRotation"
                                },
                                {
                                  "@name":"LinkEstablished",
                                  "@accessType":"outputOnly",
                                  "@type":"SFBool"
                                },
                                {
                                  "@name":"ViewpointLocation",
                                  "@accessType":"outputOnly",
                                  "@type":"SFVec3f"
                                },
                                {
                                  "@name":"ViewpointAngle",
                                  "@accessType":"outputOnly",
                                  "@type":"SFRotation"
                                }
                              ],
                              "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) ;",
"\t",
"\tbeamScale\t\t= new SFVec3f ( ) ;",
"\tViewpointLocation\t= new SFVec3f ( ) ;",
"\tViewpointAngle\t\t= new SFRotation(0, 1, 0, 0) ;",
"\tLinkEstablished\t= true;",
"\t",
"\tcompute(active) ;",
"}",
"",
"",
"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( ) ;",
"\t",
"}",
"\t",
"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;\t",
"\tBrowser.println ('BeamScale\t=' + beamScale) ;",
"\tbeamLength \t= distance - 2 ;",
"\tif (distance > 5000/.6) {",
"\t\tLinkEstablished = false;",
"\t\tbeamLength = 5000;",
"\t}",
"}",
"",
"function computeXZangle( ) ",
"{",
"\tif (deltaZ == 0) {",
"\t\tdeltaZ = .00000001 ;",
"\t}",
"\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;",
"\t",
"\tBrowser.println ('Angle\t=' + TSSR1_XZangle[3]) ;",
"\tBrowser.println ('Angle2\t=' + TSSR2_XZangle[3]) ;",
"}\t",
"\t\t",
"",
"",
"function computeXYangle( ) ",
"{",
"\tangle \t= Math.asin(deltaY/distance) ;",
"\tTSSR1_XYangle[3] = angle ;",
"\tTSSR2_XYangle[3]  = - TSSR1_XYangle[3];",
"\t",
"\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":"beamLength",
                        "@fromNode":"CalculateAngleScript",
                        "@toField":"range",
                        "@toNode":"TSSR1_BEAMCYLINDER"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"beamLength",
                        "@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":"LinkEstablished",
                        "@fromNode":"CalculateAngleScript",
                        "@toField":"contact",
                        "@toNode":"TSSR1_BEAMCYLINDER"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"LinkEstablished",
                        "@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"
                      }
                    }
                  ]
              }
            }
          },
          {
            "#comment":"===================="
          },
          { "WorldInfo":
            {
              "@info":["Author: Mike Hunsberger","Revised: 30 April 2001","Purpose: Pair of TSSRs","Browser: CosmoPlayer"],
              "@title":"AntennaWorld"
            }
          },
          { "ProtoInstance":
            {
              "@name":"TSSRPair",
              "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]
            }
          }
        ]
    }
  }
}