{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Immersive",
    "@version":"3.3",
    "@xsd:noNamespaceSchemaLocation":"https://www.web3d.org/specifications/x3d-3.3.xsd",
    "JSON schema":"https://www.web3d.org/specifications/x3d-4.0-JSONSchema.autogenerated.json",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"RotationCalculatorExample.x3d"
          },
          {
            "@name":"creator",
            "@content":"Don Brutzman"
          },
          {
            "@name":"created",
            "@content":"30 December 2015"
          },
          {
            "@name":"modified",
            "@content":"30 August 2025"
          },
          {
            "@name":"description",
            "@content":"Demonstrate composition of rotation values using X3D-Edit RotationCalculator, select and hold either side to compare direct straight-ahead views without parallax."
          },
          {
            "@name":"drawing",
            "@content":"https://www.web3d.org/x3d/tools/X3D-Edit/images/RotationCalculator.png"
          },
          {
            "@name":"reference",
            "@content":"../HumanoidAnimation/RotationTests.x3d"
          },
          {
            "@name":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Animation/RotationCalculatorExample.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../license.html"
          },
          {
            "@name":"translated",
            "@content":"16 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":[
          { "WorldInfo":
            {
              "@title":"RotationCalculatorExample.x3d"
            }
          },
          { "Background":
            {
              "@skyColor":[0.8,0.8,0.9]
            }
          },
          { "NavigationInfo":
            {
            }
          },
          { "Viewpoint":
            {
              "@DEF":"ViewCenter",
              "@description":"Rotation Calculator Example",
              "@position":[0,0,12]
            }
          },
          { "Viewpoint":
            {
              "@DEF":"ViewLeft",
              "@description":"Left side direct view",
              "@position":[-3,0,12]
            }
          },
          { "Viewpoint":
            {
              "@DEF":"ViewRight",
              "@description":"Right side direct view",
              "@position":[3,0,12]
            }
          },
          { "Transform":
            {
              "@DEF":"LeftSide",
              "@translation":[-4,0,0],
              "-children":[
                {
                  "#comment":"Individual nested rotations follow"
                },
                { "Transform":
                  {
                    "@DEF":"OuterRotationXaxis135degrees",
                    "@rotation":[1,0,0,2.356194],
                    "-children":[
                      { "Transform":
                        {
                          "@DEF":"CenterRotationYaxis45Degrees",
                          "@rotation":[0,1,0,0.785398],
                          "-children":[
                            { "Transform":
                              {
                                "@DEF":"InnerRotationZaxis-30degrees",
                                "@rotation":[0,0,1,-0.523599],
                                "-children":[
                                  { "Inline":
                                    {
                                      "@DEF":"CubeWithLabeledSides1",
                                      "@url":["../GeometricShapes/CubeWithLabeledSides.x3d","https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/GeometricShapes/CubeWithLabeledSides.x3d","../GeometricShapes/CubeWithLabeledSides.wrl","https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/GeometricShapes/CubeWithLabeledSides.wrl"],
                                      "-metadata":
                                        { "MetadataString":
                                          {
                                            "@name":"profile",
                                            "@value":["Interchange"]
                                          }
                                        }
                                    }
                                  },
                                  { "Shape":
                                    {
                                      "@DEF":"AxisLinesShape",
                                      "-geometry":
                                        { "IndexedLineSet":
                                          {
                                            "@colorIndex":[0,1,2],
                                            "@colorPerVertex":false,
                                            "@coordIndex":[0,1,-1,0,2,-1,0,3,-1],
                                            "-coord":
                                              { "Coordinate":
                                                {
                                                  "@point":[0,0,0,1.78,0,0,0,1.78,0,0,0,1.78]
                                                }
                                              },
                                            "-color":
                                              { "Color":
                                                {
                                                  "@color":[1,0,0,0,0.6,0,0,0,1]
                                                }
                                              }
                                          }
                                        },
                                      "-appearance":
                                        { "Appearance":
                                          {
                                            "-material":
                                              { "Material":
                                                {
                                                  "@diffuseColor":[0.9,0.9,0.9]
                                                }
                                              }
                                          }
                                        }
                                    }
                                  }
                                ]
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                },
                { "Transform":
                  {
                    "@translation":[0,3,0],
                    "-children":[
                      { "Shape":
                        {
                          "-geometry":
                            { "Text":
                              {
                                "@string":["Multiple single-axis","Transform rotations"],
                                "-fontStyle":
                                  { "FontStyle":
                                    {
                                      "@family":["SANS"],
                                      "@justify":["MIDDLE","MIDDLE"],
                                      "@size":0.5,
                                      "@style":"BOLD"
                                    }
                                  }
                              }
                            },
                          "-appearance":
                            { "Appearance":
                              {
                                "@DEF":"TextAppearance",
                                "-material":
                                  { "Material":
                                    {
                                      "@diffuseColor":[0.1,0.2,0.9]
                                    }
                                  }
                              }
                            }
                        }
                      }
                    ]
                  }
                },
                { "Transform":
                  {
                    "@translation":[0,-3,0],
                    "-children":[
                      { "Shape":
                        {
                          "-geometry":
                            { "Text":
                              {
                                "@string":["using multiple","nested Transform nodes"],
                                "-fontStyle":
                                  { "FontStyle":
                                    {
                                      "@family":["SANS"],
                                      "@justify":["MIDDLE","MIDDLE"],
                                      "@size":0.5,
                                      "@style":"BOLD"
                                    }
                                  }
                              }
                            },
                          "-appearance":
                            { "Appearance":
                              {
                                "@USE":"TextAppearance"
                              }
                            }
                        }
                      }
                    ]
                  }
                },
                { "Shape":
                  {
                    "@DEF":"TransparentBacking1",
                    "-geometry":
                      { "Box":
                        {
                          "@size":[7,7,0.1]
                        }
                      },
                    "-appearance":
                      { "Appearance":
                        {
                          "@DEF":"TransparentAppearance",
                          "-material":
                            { "Material":
                              {
                                "@transparency":1
                              }
                            }
                        }
                      }
                  }
                },
                { "TouchSensor":
                  {
                    "@DEF":"TouchLeftCube",
                    "@description":"Hold for direct left-side view, no parallax"
                  }
                },
                { "ROUTE":
                  {
                    "@fromField":"isActive",
                    "@fromNode":"TouchLeftCube",
                    "@toField":"set_bind",
                    "@toNode":"ViewLeft"
                  }
                }
              ]
            }
          },
          { "Transform":
            {
              "@DEF":"RightSide",
              "@translation":[4,0,0],
              "-children":[
                {
                  "#comment":"Composed equivalent rotation follows, X3D-Edit can reload rotation array values from embedded comment"
                },
                { "Transform":
                  {
                    "@DEF":"ComposedRotation",
                    "@rotation":[0.87262,0.40202,0.27735,2.24592],
                    "-children":[
                      {
                        "#comment":"RotationCalculator composed rotation: 1.0 0.0 0.0 2.35619, 0.0 1.0 0.0 0.785398, 0.0 0.0 1.0 -0.523599"
                      },
                      {
                        "#comment":"Can't re-use USE node for independent TouchSensor selection <Inline USE='CubeWithLabeledSides'/>"
                      },
                      { "Inline":
                        {
                          "@DEF":"CubeWithLabeledSides2",
                          "@url":["../GeometricShapes/CubeWithLabeledSides.x3d","https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/GeometricShapes/CubeWithLabeledSides.x3d","../GeometricShapes/CubeWithLabeledSides.wrl","https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/GeometricShapes/CubeWithLabeledSides.wrl"],
                          "-metadata":
                            { "MetadataString":
                              {
                                "@name":"profile",
                                "@value":["Interchange"]
                              }
                            }
                        }
                      },
                      { "Shape":
                        {
                          "@USE":"AxisLinesShape"
                        }
                      }
                    ]
                  }
                },
                { "Transform":
                  {
                    "@translation":[0,3,0],
                    "-children":[
                      { "Shape":
                        {
                          "-geometry":
                            { "Text":
                              {
                                "@string":["Single composed","Transform rotation"],
                                "-fontStyle":
                                  { "FontStyle":
                                    {
                                      "@family":["SANS"],
                                      "@justify":["MIDDLE","MIDDLE"],
                                      "@size":0.5,
                                      "@style":"BOLD"
                                    }
                                  }
                              }
                            },
                          "-appearance":
                            { "Appearance":
                              {
                                "@USE":"TextAppearance"
                              }
                            }
                        }
                      }
                    ]
                  }
                },
                { "Transform":
                  {
                    "@translation":[0,-3,0],
                    "-children":[
                      { "Shape":
                        {
                          "-geometry":
                            { "Text":
                              {
                                "@string":["computed with X3D-Edit","Rotation Calculator"],
                                "-fontStyle":
                                  { "FontStyle":
                                    {
                                      "@family":["SANS"],
                                      "@justify":["MIDDLE","MIDDLE"],
                                      "@size":0.5,
                                      "@style":"BOLD"
                                    }
                                  }
                              }
                            },
                          "-appearance":
                            { "Appearance":
                              {
                                "@USE":"TextAppearance"
                              }
                            }
                        }
                      }
                    ]
                  }
                },
                { "Shape":
                  {
                    "@DEF":"TransparentBacking2",
                    "-geometry":
                      { "Box":
                        {
                          "@size":[7,7,0.1]
                        }
                      },
                    "-appearance":
                      { "Appearance":
                        {
                          "@USE":"TransparentAppearance"
                        }
                      }
                  }
                },
                { "TouchSensor":
                  {
                    "@DEF":"TouchRightCube",
                    "@description":"Hold for direct right-side view, no parallax"
                  }
                },
                { "ROUTE":
                  {
                    "@fromField":"isActive",
                    "@fromNode":"TouchRightCube",
                    "@toField":"set_bind",
                    "@toNode":"ViewRight"
                  }
                }
              ]
            }
          }
        ]
    }
  }
}