Examples of Rotation


Examples of de.christopherstock.lib.Lib.Rotation

            }
        }

        private Rotation[] getNewArmPosition( Arm arm, ArmTarget newArmPosition )
        {
            Rotation upperArmPitch      = new Rotation();
            Rotation lowerArmPitch      = new Rotation();
            Rotation handPitch          = new Rotation();

            //define roations
            switch ( newArmPosition )
            {
                case EWalk1:
                {
                    upperArmPitch.set(   45.0f0.0f, 0.0f, RotationSpeed.LIMBS );
                    lowerArmPitch.set(   0.0f,   0.0f, 0.0f, RotationSpeed.LIMBS );
                    handPitch.set(       0.0f,   0.0f, 0.0f, RotationSpeed.LIMBS );
                    break;
                }

                case EWalk2:
                {
                    upperArmPitch.set(   -45.0f, 0.0f, 0.0f, RotationSpeed.LIMBS );
                    lowerArmPitch.set(   0.0f,   0.0f, 0.0f, RotationSpeed.LIMBS );
                    handPitch.set(       0.0f,   0.0f, 0.0f, RotationSpeed.LIMBS );
                    break;
                }

                case ETest1:
                {
                    upperArmPitch.set(   0.0f,   0.0f, -45.0f, RotationSpeed.LIMBS );
                    lowerArmPitch.set(   -30.0f, -30.0f, 0.0f, RotationSpeed.LIMBS );
                    handPitch.set(       0.0f,   0.0f, 0.0f, RotationSpeed.LIMBS );
                    break;
                }
                case ETest2:
                {
                    upperArmPitch.set90.0f,      0.0f,   0.0f,       RotationSpeed.LIMBS );
                    lowerArmPitch.set-90.0f,     -90.0f, 0.0f,       RotationSpeed.LIMBS );
                    handPitch.set(      0.0f,       0.0f,   0.0f,       RotationSpeed.LIMBS );
                    break;
                }

                case ERestInHip:
                {
                    upperArmPitch.set0.0f,       0.0f,       0.0f,   RotationSpeed.LIMBS );
                    lowerArmPitch.set0.0f,       -10.0f,     0.0f,   RotationSpeed.LIMBS );
                    handPitch.set(      0.0f,       0.0f,       -90.0f, RotationSpeed.LIMBS );
                    break;
                }

                case EPickUp:
                {
                    upperArmPitch.set-75.0f,     0.0f,       -30.0f, RotationSpeed.LIMBS );
                    lowerArmPitch.set-40.0f,     0.0f,       0.0f,   RotationSpeed.LIMBS );
                    handPitch.set(      0.0f,       -67.5f,     -90.0f, RotationSpeed.LIMBS );
                    break;
                }

                case EHangDown:
                {
                    upperArmPitch.set0.0f,       20.0f,      0.0f,   RotationSpeed.LIMBS );
                    lowerArmPitch.set0.0f,       -25.0f,     0.0f,   RotationSpeed.LIMBS );
                    handPitch.set(      0.0f,       -10.0f,     -90.0f, RotationSpeed.LIMBS );
                    break;
                }

                case EPointToSide:
                {
                    upperArmPitch.set0.0f,       -50.0f,     0.0f,   RotationSpeed.LIMBS );
                    lowerArmPitch.set0.0f,       -110.0f,    0.0f,   RotationSpeed.LIMBS );
                    handPitch.set(      0.0f,       -95.0f,     0.0f,   RotationSpeed.LIMBS );
                    break;
                }

                case EAimLow:
                {
                    upperArmPitch.set-50.0f,     50.0f,      0.0f,   RotationSpeed.LIMBS );
                    lowerArmPitch.set-60.0f,     0.0f,       0.0f,   RotationSpeed.LIMBS );
                    handPitch.set(      -95.0f,     0.0f,       0.0f,   RotationSpeed.LIMBS );
                    break;
                }

                case EEllbowBack:
                {
                    upperArmPitch.set0.0f,       0.0f,       90.0f,  RotationSpeed.LIMBS );
                    lowerArmPitch.set0.0f,       40.0f,      90.0f,  RotationSpeed.LIMBS );
                    handPitch.set(      -55.0f,     0.0f,       0.0f,   RotationSpeed.LIMBS  );
                    break;
                }

                case EAimHigh:
                {
                    upperArmPitch.set-100.0f,    0.0f,       0.0f,   RotationSpeed.LIMBS  );
                    lowerArmPitch.set0.0f,       0.0f,       0.0f,   RotationSpeed.LIMBS  );
                    handPitch.set(      90.0f,      -82.5f,     90.0f,  RotationSpeed.LIMBS );

                    break;
                }

                case EPointToCeiling:
                {
                    upperArmPitch.set0.0f,       -120.0f,    0.0f,   RotationSpeed.LIMBS );
                    lowerArmPitch.set0.0f,       120.0f,     0.0f,   RotationSpeed.LIMBS );
                    handPitch.set(      185.0f,     0.0f,       0.0f,   RotationSpeed.LIMBS );
                    break;
                }

                case EReloadPrimaryHandUp:
                {
                    upperArmPitch.set-45.0f,     0.0f,       0.0f,   RotationSpeed.LIMBS );
                    lowerArmPitch.set0.0f,       30.0f,      0.0f,   RotationSpeed.LIMBS );
                    handPitch.set(      0.0f,       0.0f,       0.0f,   RotationSpeed.LIMBS );
                    break;
                }

                case EReloadPrimaryHandDown:
                {
                    upperArmPitch.set-45.0f,     0.0f,       0.0f,   RotationSpeed.LIMBS );
                    lowerArmPitch.set0.0f,       50.0f,      0.0f,   RotationSpeed.LIMBS );
                    handPitch.set(      0.0f,       0.0f,       0.0f,   RotationSpeed.LIMBS );
                    break;
                }

                case EReloadSecondaryHandDown:
                {
                    upperArmPitch.set-45.0f,     0.0f,       -45.0f, RotationSpeed.LIMBS );
                    lowerArmPitch.set0.0f,       45.0f,      0.0f,   RotationSpeed.LIMBS );
                    handPitch.set(      0.0f,       0.0f,       0.0f,   RotationSpeed.LIMBS );
                    break;
                }

                case EReloadSecondaryHandUp:
                {
                    upperArmPitch.set-45.0f,     0.0f,       -45.0f, RotationSpeed.LIMBS );
                    lowerArmPitch.set0.0f,       0.0f,       0.0f,   RotationSpeed.LIMBS );
                    handPitch.set(      0.0f,       0.0f,       0.0f,   RotationSpeed.LIMBS );
                    break;
                }
            }

            //assign to specified arm
            switch ( arm )
            {
                case ELeft:
                {
                    //flip y axis for left arm!
                    upperArmPitch.set(   upperArmPitch.x, -upperArmPitch.y, -upperArmPitch.z,   RotationSpeed.UPPER_ARM );
                    lowerArmPitch.set(   lowerArmPitch.x, -lowerArmPitch.y, -lowerArmPitch.z,   RotationSpeed.LOWER_ARM );
                    handPitch.set(       handPitch.x,     -handPitch.y,     -handPitch.z,       RotationSpeed.HAND     );
                    break;
                }

                case ERight:
                {
                    upperArmPitch.setupperArmPitch.x, upperArmPitch.y, upperArmPitch.z,  RotationSpeed.UPPER_ARM );
                    lowerArmPitch.setlowerArmPitch.x, lowerArmPitch.y, lowerArmPitch.z,  RotationSpeed.LOWER_ARM );
                    handPitch.set(      handPitch.x,     handPitch.y,     handPitch.z,      RotationSpeed.HAND     );

                    break;
                }
            }
View Full Code Here

Examples of fcagnin.jgltut.tut06.Rotation

                            Framework.CURRENT_TUTORIAL_DATAPATH = "/fcagnin/jgltut/tut06/data/";
                            new Scale().start();
                            break;
                        case "Rotation":
                            Framework.CURRENT_TUTORIAL_DATAPATH = "/fcagnin/jgltut/tut06/data/";
                            new Rotation().start();
                            break;
                        case "Hierarchy":
                            Framework.CURRENT_TUTORIAL_DATAPATH = "/fcagnin/jgltut/tut06/data/";
                            new Hierarchy().start( 700, 700 );
                            break;
View Full Code Here

Examples of net.lightstone.model.Rotation

  @Override
  public void handle(Session session, Player player, RotationMessage message) {
    if (player == null)
      return;

    player.setRotation(new Rotation(message.getRotation(), message.getPitch()));
  }
View Full Code Here

Examples of ofc4j.model.axis.Label.Rotation

        xaxis.setRange( domainMin.intValue(), domainMax.intValue(), stepforchart );
      }

      if ( domainRotation != null ) {

        Rotation rot = null;
        if ( domainRotation.equals( "vertical" ) ) {
          rot = Rotation.VERTICAL;
        } else if ( domainRotation.equals( "diagonal" ) ) {
          rot = Rotation.DIAGONAL;
        } else {
View Full Code Here

Examples of org.apache.commons.math.geometry.Rotation

    super(name);
  }

  public void testIdentity() {

    Rotation r = Rotation.IDENTITY;
    checkVector(r.applyTo(Vector3D.PLUS_I), Vector3D.PLUS_I);
    checkVector(r.applyTo(Vector3D.PLUS_J), Vector3D.PLUS_J);
    checkVector(r.applyTo(Vector3D.PLUS_K), Vector3D.PLUS_K);
    checkAngle(r.getAngle(), 0);

    r = new Rotation(-1, 0, 0, 0, false);
    checkVector(r.applyTo(Vector3D.PLUS_I), Vector3D.PLUS_I);
    checkVector(r.applyTo(Vector3D.PLUS_J), Vector3D.PLUS_J);
    checkVector(r.applyTo(Vector3D.PLUS_K), Vector3D.PLUS_K);
    checkAngle(r.getAngle(), 0);

    r = new Rotation(42, 0, 0, 0, true);
    checkVector(r.applyTo(Vector3D.PLUS_I), Vector3D.PLUS_I);
    checkVector(r.applyTo(Vector3D.PLUS_J), Vector3D.PLUS_J);
    checkVector(r.applyTo(Vector3D.PLUS_K), Vector3D.PLUS_K);
    checkAngle(r.getAngle(), 0);

  }
View Full Code Here

Examples of org.apache.commons.math.geometry.Rotation

  }

  public void testAxisAngle() {

    Rotation r = new Rotation(new Vector3D(10, 10, 10), 2 * Math.PI / 3);
    checkVector(r.applyTo(Vector3D.PLUS_I), Vector3D.PLUS_J);
    checkVector(r.applyTo(Vector3D.PLUS_J), Vector3D.PLUS_K);
    checkVector(r.applyTo(Vector3D.PLUS_K), Vector3D.PLUS_I);
    double s = 1 / Math.sqrt(3);
    checkVector(r.getAxis(), new Vector3D(s, s, s));
    checkAngle(r.getAngle(), 2 * Math.PI / 3);

    try {
      new Rotation(new Vector3D(0, 0, 0), 2 * Math.PI / 3);
      fail("an exception should have been thrown");
    } catch (ArithmeticException e) {
    } catch (Exception e) {
      fail("unexpected exception");
    }

    r = new Rotation(Vector3D.PLUS_K, 1.5 * Math.PI);
    checkVector(r.getAxis(), new Vector3D(0, 0, -1));
    checkAngle(r.getAngle(), 0.5 * Math.PI);

    r = new Rotation(Vector3D.PLUS_J, Math.PI);
    checkVector(r.getAxis(), Vector3D.PLUS_J);
    checkAngle(r.getAngle(), Math.PI);

    checkVector(Rotation.IDENTITY.getAxis(), Vector3D.PLUS_I);

  }
View Full Code Here

Examples of org.apache.commons.math.geometry.Rotation

    checkVector(Rotation.IDENTITY.getAxis(), Vector3D.PLUS_I);

  }

  public void testRevert() {
    Rotation r = new Rotation(0.001, 0.36, 0.48, 0.8, true);
    Rotation reverted = r.revert();
    checkRotation(r.applyTo(reverted), 1, 0, 0, 0);
    checkRotation(reverted.applyTo(r), 1, 0, 0, 0);
    assertEquals(r.getAngle(), reverted.getAngle(), 1.0e-12);
    assertEquals(-1, Vector3D.dotProduct(r.getAxis(), reverted.getAxis()), 1.0e-12);
  }
View Full Code Here

Examples of org.apache.commons.math.geometry.Rotation

  public void testVectorOnePair() {

    Vector3D u = new Vector3D(3, 2, 1);
    Vector3D v = new Vector3D(-4, 2, 2);
    Rotation r = new Rotation(u, v);
    checkVector(r.applyTo(u.scalarMultiply(v.getNorm())), v.scalarMultiply(u.getNorm()));

    checkAngle(new Rotation(u, u.negate()).getAngle(), Math.PI);

    try {
        new Rotation(u, Vector3D.ZERO);
        fail("an exception should have been thrown");
      } catch (IllegalArgumentException e) {
        // expected behavior
      } catch (Exception e) {
        fail("unexpected exception");
View Full Code Here

Examples of org.apache.commons.math.geometry.Rotation

    Vector3D u1 = new Vector3D(3, 0, 0);
    Vector3D u2 = new Vector3D(0, 5, 0);
    Vector3D v1 = new Vector3D(0, 0, 2);
    Vector3D v2 = new Vector3D(-2, 0, 2);
    Rotation r = new Rotation(u1, u2, v1, v2);
    checkVector(r.applyTo(Vector3D.PLUS_I), Vector3D.PLUS_K);
    checkVector(r.applyTo(Vector3D.PLUS_J), Vector3D.MINUS_I);

    r = new Rotation(u1, u2, u1.negate(), u2.negate());
    Vector3D axis = r.getAxis();
    if (Vector3D.dotProduct(axis, Vector3D.PLUS_K) > 0) {
      checkVector(axis, Vector3D.PLUS_K);
    } else {
      checkVector(axis, Vector3D.MINUS_K);
    }
    checkAngle(r.getAngle(), Math.PI);

    double sqrt = Math.sqrt(2) / 2;
    r = new Rotation(Vector3D.PLUS_I,  Vector3D.PLUS_J,
                     new Vector3D(0.5, 0.5,  sqrt),
                     new Vector3D(0.5, 0.5, -sqrt));
    checkRotation(r, sqrt, 0.5, 0.5, 0);

    r = new Rotation(u1, u2, u1, Vector3D.crossProduct(u1, u2));
    checkRotation(r, sqrt, -sqrt, 0, 0);

    checkRotation(new Rotation(u1, u2, u1, u2), 1, 0, 0, 0);

    try {
        new Rotation(u1, u2, Vector3D.ZERO, v2);
        fail("an exception should have been thrown");
    } catch (IllegalArgumentException e) {
      // expected behavior
    } catch (Exception e) {
        fail("unexpected exception");
View Full Code Here

Examples of org.apache.commons.math.geometry.Rotation

  public void testMatrix()
    throws NotARotationMatrixException {

    try {
      new Rotation(new double[][] {
                     { 0.0, 1.0, 0.0 },
                     { 1.0, 0.0, 0.0 }
                   }, 1.0e-7);
    } catch (NotARotationMatrixException nrme) {
      // expected behavior
    } catch (Exception e) {
      fail("wrong exception caught: " + e.getMessage());
    }

    try {
      new Rotation(new double[][] {
                     {  0.4458880.797184, -0.407040 },
                     0.821760, -0.1843200.539200 },
                     { -0.3548160.5749120.737280 }
                   }, 1.0e-7);
    } catch (NotARotationMatrixException nrme) {
      // expected behavior
    } catch (Exception e) {
      fail("wrong exception caught: " + e.getMessage());
    }

    try {
        new Rotation(new double[][] {
                       {  0.40.8, -0.4 },
                       { -0.40.60.7 },
                       0.8, -0.20.5 }
                     }, 1.0e-15);
      } catch (NotARotationMatrixException nrme) {
        // expected behavior
      } catch (Exception e) {
        fail("wrong exception caught: " + e.getMessage());
      }

    checkRotation(new Rotation(new double[][] {
                                 {  0.4458880.797184, -0.407040 },
                                 { -0.3548160.5749120.737280 },
                                 0.821760, -0.1843200.539200 }
                               }, 1.0e-10),
                  0.8, 0.288, 0.384, 0.36);

    checkRotation(new Rotation(new double[][] {
                                 {  0.5392000.7372800.407040 },
                                 0.184320, -0.5749120.797184 },
                                 0.821760, -0.354816, -0.445888 }
                              }, 1.0e-10),
                  0.36, 0.8, 0.288, 0.384);

    checkRotation(new Rotation(new double[][] {
                                 { -0.4458880.797184, -0.407040 },
                                 0.3548160.5749120.737280 },
                                 0.8217600.184320, -0.539200 }
                               }, 1.0e-10),
                  0.384, 0.36, 0.8, 0.288);

    checkRotation(new Rotation(new double[][] {
                                 { -0.5392000.7372800.407040 },
                                 { -0.184320, -0.5749120.797184 },
                                 0.8217600.3548160.445888 }
                               }, 1.0e-10),
                  0.288, 0.384, 0.36, 0.8);

    double[][] m1 = { { 0.0, 1.0, 0.0 },
                      { 0.0, 0.0, 1.0 },
                      { 1.0, 0.0, 0.0 } };
    Rotation r = new Rotation(m1, 1.0e-7);
    checkVector(r.applyTo(Vector3D.PLUS_I), Vector3D.PLUS_K);
    checkVector(r.applyTo(Vector3D.PLUS_J), Vector3D.PLUS_I);
    checkVector(r.applyTo(Vector3D.PLUS_K), Vector3D.PLUS_J);

    double[][] m2 = { { 0.83203, -0.55012, -0.07139 },
                      { 0.482930.78164, -0.39474 },
                      { 0.272960.293960.91602 } };
    r = new Rotation(m2, 1.0e-12);

    double[][] m3 = r.getMatrix();
    double d00 = m2[0][0] - m3[0][0];
    double d01 = m2[0][1] - m3[0][1];
    double d02 = m2[0][2] - m3[0][2];
    double d10 = m2[1][0] - m3[1][0];
    double d11 = m2[1][1] - m3[1][1];
    double d12 = m2[1][2] - m3[1][2];
    double d20 = m2[2][0] - m3[2][0];
    double d21 = m2[2][1] - m3[2][1];
    double d22 = m2[2][2] - m3[2][2];

    assertTrue(Math.abs(d00) < 6.0e-6);
    assertTrue(Math.abs(d01) < 6.0e-6);
    assertTrue(Math.abs(d02) < 6.0e-6);
    assertTrue(Math.abs(d10) < 6.0e-6);
    assertTrue(Math.abs(d11) < 6.0e-6);
    assertTrue(Math.abs(d12) < 6.0e-6);
    assertTrue(Math.abs(d20) < 6.0e-6);
    assertTrue(Math.abs(d21) < 6.0e-6);
    assertTrue(Math.abs(d22) < 6.0e-6);

    assertTrue(Math.abs(d00) > 4.0e-7);
    assertTrue(Math.abs(d01) > 4.0e-7);
    assertTrue(Math.abs(d02) > 4.0e-7);
    assertTrue(Math.abs(d10) > 4.0e-7);
    assertTrue(Math.abs(d11) > 4.0e-7);
    assertTrue(Math.abs(d12) > 4.0e-7);
    assertTrue(Math.abs(d20) > 4.0e-7);
    assertTrue(Math.abs(d21) > 4.0e-7);
    assertTrue(Math.abs(d22) > 4.0e-7);

    for (int i = 0; i < 3; ++i) {
      for (int j = 0; j < 3; ++j) {
        double m3tm3 = m3[i][0] * m3[j][0]
                     + m3[i][1] * m3[j][1]
                     + m3[i][2] * m3[j][2];
        if (i == j) {
          assertTrue(Math.abs(m3tm3 - 1.0) < 1.0e-10);
        } else {
          assertTrue(Math.abs(m3tm3) < 1.0e-10);
        }
      }
    }

    checkVector(r.applyTo(Vector3D.PLUS_I),
                new Vector3D(m3[0][0], m3[1][0], m3[2][0]));
    checkVector(r.applyTo(Vector3D.PLUS_J),
                new Vector3D(m3[0][1], m3[1][1], m3[2][1]));
    checkVector(r.applyTo(Vector3D.PLUS_K),
                new Vector3D(m3[0][2], m3[1][2], m3[2][2]));

    double[][] m4 = { { 1.00.00.0 },
                      { 0.0, -1.00.0 },
                      { 0.00.0, -1.0 } };
    r = new Rotation(m4, 1.0e-7);
    checkAngle(r.getAngle(), Math.PI);

    try {
      double[][] m5 = { { 0.0, 0.0, 1.0 },
                        { 0.0, 1.0, 0.0 },
                        { 1.0, 0.0, 0.0 } };
      r = new Rotation(m5, 1.0e-7);
      fail("got " + r + ", should have caught an exception");
    } catch (NotARotationMatrixException e) {
      // expected
    } catch (Exception e) {
      fail("wrong exception caught");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.