Package sk.fiit.jim.math

Examples of sk.fiit.jim.math.Vector3D.divide()


  public void basicOperations(){
    Vector3D one = cartesian(1, 1, 1);
    assertThat(one.add(cartesian(0, 0, 0)), is(equalTo(one)));
    assertThat(one.add(cartesian(1, 0, 0)), is(equalTo(cartesian(2, 1, 1))));
    assertThat(one.multiply(5.0), is(cartesian(5, 5, 5)));
    assertThat(one.divide(0.2), is(equalTo(cartesian(5, 5, 5))));
    assertThat(one.subtract(cartesian(0, 1, 0)), is(equalTo(cartesian(1, 0, 1))));
    assertThat(one.negate(), is(equalTo(cartesian(-1, -1, -1))));
    assertThat(one.addX(1.0), is(equalTo(cartesian(2, 1, 1))));
    assertThat(one.addY(-1.0), is(equalTo(cartesian(1, 0, 1))));
    assertThat(one.addZ(0.0), is(one));
View Full Code Here


  private Vector3D average(final List<Vector3D> flags) {
    Vector3D accumulator = Vector3D.cartesian(0, 0, 0);
    for (Vector3D flag : flags)
      accumulator = accumulator.add(flag);

    return accumulator.divide(flags.size());
  }

  private Vector3D chooseTheNearestToMe(Vector3D... possibilities) {
    Vector3D best = possibilities[0];
    double bestDistance = Double.MAX_VALUE;
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.