コード例 #1
0
  /** Sees if both crossMatrix functions produce the same output */
  @Test
  public void crossMatrix_sameOut() {
    double a = 1.1, b = -0.5, c = 2.2;

    Vector3D_F64 v = new Vector3D_F64(a, b, c);

    DenseMatrix64F V1 = GeometryMath_F64.crossMatrix(v, null);
    DenseMatrix64F V2 = GeometryMath_F64.crossMatrix(a, b, c, null);

    assertTrue(MatrixFeatures.isIdentical(V1, V2, 1e-8));
  }
コード例 #2
0
  @Test
  public void multCrossA_2d() {
    Vector2D_F64 a = new Vector2D_F64(-1, 2);
    DenseMatrix64F M = new DenseMatrix64F(3, 3, true, 1, 2, 3, 4, 5, 6, 7, 8, 9);

    DenseMatrix64F a_hat = GeometryMath_F64.crossMatrix(a.x, a.y, 1, null);

    DenseMatrix64F expected = new DenseMatrix64F(3, 3);
    CommonOps.mult(a_hat, M, expected);

    DenseMatrix64F found = GeometryMath_F64.multCrossA(a, M, null);

    assertTrue(MatrixFeatures.isIdentical(expected, found, GrlConstants.DOUBLE_TEST_TOL));
  }
コード例 #3
0
  /** Sees if crossMatrix produces a valid output */
  @Test
  public void crossMatrix_validOut() {
    double a = 1.1, b = -0.5, c = 2.2;

    Vector3D_F64 v = new Vector3D_F64(a, b, c);

    Vector3D_F64 x = new Vector3D_F64(7.6, 2.9, 0.5);

    Vector3D_F64 found0 = new Vector3D_F64();
    Vector3D_F64 found1 = new Vector3D_F64();

    GeometryMath_F64.cross(v, x, found0);
    DenseMatrix64F V = GeometryMath_F64.crossMatrix(a, b, c, null);

    GeometryMath_F64.mult(V, x, found1);

    assertEquals(found0.x, found1.x, GrlConstants.DOUBLE_TEST_TOL);
    assertEquals(found0.y, found1.y, GrlConstants.DOUBLE_TEST_TOL);
    assertEquals(found0.z, found1.z, GrlConstants.DOUBLE_TEST_TOL);
  }