Examples of MathVector


Examples of org.jamesii.core.math.MathVector

  /**
   * Test vector product exceptions.
   */
  public void testVectorProductExceptions() {
    try {
      new MathVector(2).vectorProduct(new MathVector(3));
      fail();
    } catch (MatrixException e) {
      assertTrue(true);
    } catch (Exception e) {
      fail();
    }

    // The cross product is only defined in 3 and 7 dimensions. Thus 2 and 4
    // dimensions must yield an error!

    try {
      new MathVector(2).vectorProduct(new MathVector(2));
      assertTrue(
          "The cross-product isn't really defined in two-dimensional space. ",
          false);
    } catch (MatrixException e) {
      assertTrue(true);
    } catch (Exception e) {
      fail();
    }

    try {
      new MathVector(4).vectorProduct(new MathVector(4));
      assertTrue("The cross-product isn't really defined for dimensions other"
          + "than three and seven.", false);
    } catch (MatrixException e) {
      assertTrue(true);
    } catch (Exception e) {
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.