test_class.file: singa-mathematics/src/test/java/bio/singa/mathematics/quaternions/QuaternionsTest.java
test_class.identifier: QuaternionsTest
test_case.body: @Test
      void shouldCalculateRelativeOrientation() {
          List<Vector3D> reference = new ArrayList<>();
          reference.add(new Vector3D(-1.31335947229961, 6.132195247750678, 26.597580121882984));
          reference.add(new Vector3D(11.135460599181105, -1.3011346522772929, 10.142414202778763));
          reference.add(new Vector3D(-9.324636059776925, -8.375850907604685, -19.94633510012016));
          reference.add(new Vector3D(-30.5101676477022, 37.463763708911834, -16.085896893612315));
          reference.add(new Vector3D(30.01270258059763, -33.91897339678054, -0.707762330929274));
  
          List<Vector3D> candidate = new ArrayList<>();
          candidate.add(new Vector3D(7.557214201253842, 19.818131954467926, 16.47816882822429));
          candidate.add(new Vector3D(1.3360581699972016, -0.5060770735319743, 15.240344737289538));
          candidate.add(new Vector3D(-11.73619504954975, -8.122942855021256, -18.933663036107482));
          candidate.add(new Vector3D(29.91535584593334, 13.613572072519185, -39.01369141711738));
          candidate.add(new Vector3D(-27.072433167634635, -24.80268409843388, 26.228840887711037));
  
          Quaternion quaternion = Quaternions.relativeOrientation(reference, candidate);
          assertArrayEquals(new double[]{-0.314536338481798, -0.21739989933815962,
                  -0.5963273276405343, -0.7058313494393125}, quaternion.getElements(), 1E-6);
      }
test_case.class_method_signature: QuaternionsTest.shouldCalculateRelativeOrientation()
test_case.full_signature: @Test void shouldCalculateRelativeOrientation()
test_case.identifier: shouldCalculateRelativeOrientation
test_case.invocations: add add add add add add add add add add relativeOrientation assertArrayEquals getElements
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldCalculateRelativeOrientation()
focal_class.file: singa-mathematics/src/main/java/bio/singa/mathematics/quaternions/Quaternions.java
focal_class.identifier: Quaternions
focal_class.class_method_signature: Quaternions.normalize(Quaternion quaternion)
focal_class.full_signature: public static Quaternion normalize(Quaternion quaternion)
focal_class.identifier: normalize
focal_class.modifiers: public static
focal_class.parameters: (Quaternion quaternion)
focal_class.return: Quaternion
focal_class.signature: Quaternion normalize(Quaternion quaternion)
focal_class.class_method_signature: Quaternions.relativeOrientation(List<Vector3D> reference, List<Vector3D> candidate)
focal_class.full_signature: public static Quaternion relativeOrientation(List<Vector3D> reference, List<Vector3D> candidate)
focal_class.identifier: relativeOrientation
focal_class.modifiers: public static
focal_class.parameters: (List<Vector3D> reference, List<Vector3D> candidate)
focal_class.return: Quaternion
focal_class.signature: Quaternion relativeOrientation(List<Vector3D> reference, List<Vector3D> candidate)
focal_method.body: public static Quaternion relativeOrientation(List<Vector3D> reference, List<Vector3D> candidate) {
  
          double xx = 0.0, xy = 0.0, xz = 0.0;
          double yx = 0.0, yy = 0.0, yz = 0.0;
          double zx = 0.0, zy = 0.0, zz = 0.0;
  
          for (int i = 0; i < reference.size(); i++) {
              xx += reference.get(i).getX() * candidate.get(i).getX();
              xy += reference.get(i).getX() * candidate.get(i).getY();
              xz += reference.get(i).getX() * candidate.get(i).getZ();
              yx += reference.get(i).getY() * candidate.get(i).getX();
              yy += reference.get(i).getY() * candidate.get(i).getY();
              yz += reference.get(i).getY() * candidate.get(i).getZ();
              zx += reference.get(i).getZ() * candidate.get(i).getX();
              zy += reference.get(i).getZ() * candidate.get(i).getY();
              zz += reference.get(i).getZ() * candidate.get(i).getZ();
          }
  
          double[][] f = new double[4][4];
          f[0][0] = xx + yy + zz;
          f[0][1] = zy - yz;
          f[1][0] = f[0][1];
          f[1][1] = xx - yy - zz;
          f[0][2] = xz - zx;
          f[2][0] = f[0][2];
          f[1][2] = xy + yx;
          f[2][1] = f[1][2];
          f[2][2] = yy - zz - xx;
          f[0][3] = yx - xy;
          f[3][0] = f[0][3];
          f[1][3] = zx + xz;
          f[3][1] = f[1][3];
          f[2][3] = yz + zy;
          f[3][2] = f[2][3];
          f[3][3] = zz - xx - yy;
  
          Matrix matrix = new SquareMatrix(f);
          EigenvalueDecomposition eig = new EigenvalueDecomposition(matrix);
          double[][] v = eig.getV().getElements();
          Quaternion q = new RegularQuaternion(v[1][3], v[2][3], v[3][3], v[0][3]);
          return q.additivelyInvert();
      }
focal_method.class_method_signature: Quaternions.relativeOrientation(List<Vector3D> reference, List<Vector3D> candidate)
focal_method.full_signature: public static Quaternion relativeOrientation(List<Vector3D> reference, List<Vector3D> candidate)
focal_method.identifier: relativeOrientation
focal_method.invocations: size getX get getX get getX get getY get getX get getZ get getY get getX get getY get getY get getY get getZ get getZ get getX get getZ get getY get getZ get getZ get getElements getV additivelyInvert
focal_method.modifiers: public static
focal_method.parameters: (List<Vector3D> reference, List<Vector3D> candidate)
focal_method.return: Quaternion
focal_method.signature: Quaternion relativeOrientation(List<Vector3D> reference, List<Vector3D> candidate)