コード例 #1
0
  @Test
  public void multTran_2d_3d() {
    Vector2D_F64 a = new Vector2D_F64(-1, 2);
    DenseMatrix64F M = new DenseMatrix64F(3, 3, true, 1, 2, 3, 4, 5, 6, 7, 8, 9);
    Vector3D_F64 c = new Vector3D_F64();

    GeometryMath_F64.multTran(M, a, c);

    assertEquals(14, c.getX(), GrlConstants.DOUBLE_TEST_TOL);
    assertEquals(16, c.getY(), GrlConstants.DOUBLE_TEST_TOL);
    assertEquals(18, c.getZ(), GrlConstants.DOUBLE_TEST_TOL);
  }
コード例 #2
0
  @Test
  public void sub() {
    Vector3D_F64 a = new Vector3D_F64(1, 2, 3);
    Vector3D_F64 b = new Vector3D_F64(3, 1, 4);
    Vector3D_F64 c = new Vector3D_F64();

    GeometryMath_F64.sub(a, b, c);

    assertEquals(-2, c.getX(), GrlConstants.DOUBLE_TEST_TOL);
    assertEquals(1, c.getY(), GrlConstants.DOUBLE_TEST_TOL);
    assertEquals(-1, c.getZ(), GrlConstants.DOUBLE_TEST_TOL);
  }
コード例 #3
0
  @Test
  public void add_scale() {
    Vector3D_F64 a = new Vector3D_F64(1, 2, 3);
    Vector3D_F64 b = new Vector3D_F64(3, 1, 4);
    Vector3D_F64 c = new Vector3D_F64();

    GeometryMath_F64.add(2, a, -1, b, c);

    assertEquals(-1, c.getX(), GrlConstants.DOUBLE_TEST_TOL);
    assertEquals(3, c.getY(), GrlConstants.DOUBLE_TEST_TOL);
    assertEquals(2, c.getZ(), GrlConstants.DOUBLE_TEST_TOL);
  }
コード例 #4
0
  @Test
  public void addMult() {
    Vector3D_F64 a = new Vector3D_F64(1, 2, 3);
    Vector3D_F64 b = new Vector3D_F64(2, 3, 4);
    Vector3D_F64 c = new Vector3D_F64();
    DenseMatrix64F M = new DenseMatrix64F(3, 3, true, 1, 1, 1, 1, 1, 1, 1, 1, 1);

    GeometryMath_F64.addMult(a, M, b, c);

    assertEquals(10, c.getX(), GrlConstants.DOUBLE_TEST_TOL);
    assertEquals(11, c.getY(), GrlConstants.DOUBLE_TEST_TOL);
    assertEquals(12, c.getZ(), GrlConstants.DOUBLE_TEST_TOL);
  }