/** * Returns true if the L-infinite distance between this tuple and tuple1 is less than or equal to the epsilon parameter, otherwise returns false. * The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2)]. * @param tuple1 Tuple2d * @param threshold double */ public final boolean epsilonEquals(Tuple2d tuple1, double threshold) { return tuple.epsilonEquals(tuple1, threshold); }
/** * Sets the value of this tuple to the sum of itself and tuple1. * @param tuple1 the other Tuple2d */ public final void add(Tuple2d tuple1) { tuple.add(tuple1); }
public final double getX() { return tuple.getX(); }
public final double getY() { return tuple.getY(); }
/** * Sets the value of this tuple to the scalar multiplication of tuple1 and then adds tuple2 (this = scaleFactor * tuple1 + tuple2). * * @param scaleFactor double * @param frameTuple1 Tuple2d * @param frameTuple2 Tuple2d */ public final void scaleAdd(double scaleFactor, Tuple2d tuple1, Tuple2d tuple2) { tuple.scaleAdd(scaleFactor, tuple1, tuple2); }
/** * Sets the value of this tuple to the scalar multiplication of tuple1 (this = scaleFactor * tuple1). * * @param scaleFactor double * @param frameTuple1 Tuple2d */ public final void scale(double scaleFactor, Tuple2d tuple1) { tuple.scale(scaleFactor, tuple1); }
/** * Linearly interpolates between tuples tuple1 and tuple2 and places the result into this tuple: this = (1-alpha) * tuple1 + alpha * tuple2. * @param t1 the first tuple * @param t2 the second tuple * @param alpha the alpha interpolation parameter */ public final void interpolate(Tuple2d tuple1, Tuple2d tuple2, double alpha) { tuple.interpolate(tuple1, tuple2, alpha); }
public final void clipToMinMax(double minValue, double maxValue) { this.tuple.clamp(minValue, maxValue); }
public final void negate() { tuple.negate(); }
/** * Sets the value of this tuple to the scalar multiplication of itself and then adds tuple1 (this = scaleFactor * this + tuple1). * Checks if reference frames match. * * @param scaleFactor double * @param frameTuple1 Tuple2d */ public final void scaleAdd(double scaleFactor, Tuple2d tuple1) { tuple.scaleAdd(scaleFactor, tuple1); }
public final void scale(double scaleFactor) { tuple.scale(scaleFactor); }
public static void assertTuple2dEquals(String message, Tuple2d expected, Tuple2d actual, double delta) { boolean areEqual = expected.epsilonEquals(actual, delta); if (message.equals("")) { message = "Tuple2ds are not Equal!"; } if (!areEqual) { Vector2d difference = new Vector2d(actual); difference.sub(expected); fail(message + " Expected = " + expected + ", actual = " + actual + ". norm of difference = " + difference.length()); } }
/** * Sets the value of this tuple to the sum of tuple1 and tuple2 (this = tuple1 + tuple2). * @param tuple1 the first Tuple2d * @param tuple2 the second Tuple2d */ public final void add(Tuple2d tuple1, Tuple2d tuple2) { tuple.add(tuple1, tuple2); }
/** * Sets the value of this tuple to the scalar multiplication of tuple1 and then adds the scalar multiplication of tuple2 (this = scaleFactor1 * tuple1 + scaleFactor2 * tuple2). * * @param scaleFactor1 double * @param frameTuple1 Tuple2d * @param scaleFactor2 double * @param frameTuple2 Tuple2d */ public final void scaleAdd(double scaleFactor1, Tuple2d tuple1, double scaleFactor2, Tuple2d tuple2) { tuple.setX(scaleFactor1 * tuple1.getX() + scaleFactor2 * tuple2.getX()); tuple.setY(scaleFactor1 * tuple1.getY() + scaleFactor2 * tuple2.getY()); }