Package de.lmu.ifi.dbs.elki.math.linearalgebra

Examples of de.lmu.ifi.dbs.elki.math.linearalgebra.AffineTransformation.apply()


      dv[i] = i * i + testdim;
    }
    Vector v1 = new Vector(dv.clone());
    Vector v2 = new Vector(dv.clone());

    Vector v3 = t.apply(v1);
    assertEquals("identity transformation wasn't identical", v2, v3);

    Vector v4 = t.applyInverse(v2);
    assertEquals("inverse of identity wasn't identity", v1, v4);
  }
View Full Code Here


      dv2[i] = i * i + i + 2 * testdim;
    }
    Vector v1 = new Vector(dv1);
    Vector v2t = new Vector(dv2);

    Vector v1t = t.apply(v1);
    assertEquals("Vector wasn't translated properly forward.", v2t, v1t);
    Vector v2b = t.applyInverse(v2t);
    assertEquals("Vector wasn't translated properly backwards.", v1, v2b);
    Vector v1b = t.applyInverse(v1t);
    assertEquals("Vector wasn't translated properly back and forward.", v1, v1b);
View Full Code Here

    double[] dv = new double[testdim];
    for(int i = 0; i < testdim; i++) {
      dv[i] = i * i + testdim;
    }
    Vector v1 = new Vector(dv);
    Vector v2 = t.apply(v1);
    Vector v3 = t.applyInverse(v2);
    assertTrue("Forward-Backward didn't work correctly.", v1.minus(v3).euclideanLength() < 0.0001);
    Vector v4 = t.apply(t.apply(t.apply(v1)));
    assertTrue("Triple-Rotation by 120 degree didn't work", v1.minus(v4).euclideanLength() < 0.0001);

View Full Code Here

    }
    Vector v1 = new Vector(dv);
    Vector v2 = t.apply(v1);
    Vector v3 = t.applyInverse(v2);
    assertTrue("Forward-Backward didn't work correctly.", v1.minus(v3).euclideanLength() < 0.0001);
    Vector v4 = t.apply(t.apply(t.apply(v1)));
    assertTrue("Triple-Rotation by 120 degree didn't work", v1.minus(v4).euclideanLength() < 0.0001);

    // Rotation shouldn't disagree for relative vectors.
    // (they just are not affected by translation!)
    assertEquals("Relative vectors were affected differently by pure rotation!", v2, t.applyRelative(v1));
View Full Code Here

    }
    Vector v1 = new Vector(dv);
    Vector v2 = t.apply(v1);
    Vector v3 = t.applyInverse(v2);
    assertTrue("Forward-Backward didn't work correctly.", v1.minus(v3).euclideanLength() < 0.0001);
    Vector v4 = t.apply(t.apply(t.apply(v1)));
    assertTrue("Triple-Rotation by 120 degree didn't work", v1.minus(v4).euclideanLength() < 0.0001);

    // Rotation shouldn't disagree for relative vectors.
    // (they just are not affected by translation!)
    assertEquals("Relative vectors were affected differently by pure rotation!", v2, t.applyRelative(v1));
View Full Code Here

    }
    Vector v1 = new Vector(dv);
    Vector v2 = t.apply(v1);
    Vector v3 = t.applyInverse(v2);
    assertTrue("Forward-Backward didn't work correctly.", v1.minus(v3).euclideanLength() < 0.0001);
    Vector v4 = t.apply(t.apply(t.apply(v1)));
    assertTrue("Triple-Rotation by 120 degree didn't work", v1.minus(v4).euclideanLength() < 0.0001);

    // Rotation shouldn't disagree for relative vectors.
    // (they just are not affected by translation!)
    assertEquals("Relative vectors were affected differently by pure rotation!", v2, t.applyRelative(v1));
View Full Code Here

    assertEquals("Relative vectors were affected differently by pure rotation!", v2, t.applyRelative(v1));

    // should do the same as built-in rotation!
    AffineTransformation t2 = new AffineTransformation(testdim);
    t2.addRotation(axis1, axis2, angle);
    Vector t2v2 = t2.apply(v1);
    assertTrue("Manual rotation and AffineTransformation.addRotation disagree.", v2.minus(t2v2).euclideanLength() < 0.0001);
  }

  /**
   * Test {@link AffineTransformation#reorderAxesTransformation}
View Full Code Here

    // index in reference array
    int idx = 0;
    // with 0 arguments
    {
      AffineTransformation aff = AffineTransformation.reorderAxesTransformation(v.getDimensionality(), new int[] {});
      Vector n = aff.apply(v).minus(ps[idx]);
      assertEquals("Permutation " + idx + " doesn't match.", n.euclideanLength(), 0.0, 0.001);
      idx++;
    }
    // with one argument
    for(int d1 = 1; d1 <= 3; d1++) {
View Full Code Here

      idx++;
    }
    // with one argument
    for(int d1 = 1; d1 <= 3; d1++) {
      AffineTransformation aff = AffineTransformation.reorderAxesTransformation(v.getDimensionality(), new int[] { d1 });
      Vector n = aff.apply(v).minus(ps[idx]);
      assertEquals("Permutation " + idx + " doesn't match.", n.euclideanLength(), 0.0, 0.001);
      idx++;
    }
    // with two arguments
    for(int d1 = 1; d1 <= 3; d1++) {
View Full Code Here

      for(int d2 = 1; d2 <= 3; d2++) {
        if(d1 == d2) {
          continue;
        }
        AffineTransformation aff = AffineTransformation.reorderAxesTransformation(v.getDimensionality(), new int[] { d1, d2 });
        Vector n = aff.apply(v).minus(ps[idx]);
        assertEquals("Permutation " + idx + " doesn't match.", n.euclideanLength(), 0.0, 0.001);
        idx++;
      }
    }
  }
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.