/** * Tests on a per component basis, if this yaw-pitch-roll is exactly equal to {@code other}. A * failing test does not necessarily mean that the two yaw-pitch-rolls represent two different * orientations. * <p> * If the two yaw-pitch-rolls have different frames, this method returns {@code false}. * </p> * * @param other the other yaw-pitch-roll to compare against this. Not modified. * @return {@code true} if the two yaw-pitch-rolls are exactly equal component-wise and are * expressed in the same reference frame, {@code false} otherwise. */ default boolean equals(FrameYawPitchRollReadOnly other) { if (other == null || getReferenceFrame() != other.getReferenceFrame()) return false; return YawPitchRollReadOnly.super.equals(other); }
/** * Tests on a per component basis, if this yaw-pitch-roll is equal to {@code other} to an * {@code epsilon}. A failing test does not necessarily mean that the two yaw-pitch-rolls represent * two different orientations. * <p> * If the two yaw-pitch-rolls have different frames, this method returns {@code false}. * </p> * * @param other the other tuple to compare against this. Not modified. * @param epsilon the tolerance to use when comparing each component. * @return {@code true} if the two yaw-pitch-rolls are equal and are expressed in the same reference * frame, {@code false} otherwise. */ default boolean epsilonEquals(FrameYawPitchRollReadOnly other, double epsilon) { if (getReferenceFrame() != other.getReferenceFrame()) return false; return YawPitchRollReadOnly.super.epsilonEquals(other, epsilon); }
/** * Sets this yaw-pitch-roll to the same value as the given {@code other} and updates the reference * frame. * * @param other the other yaw-pitch-roll. Not modified. */ default void setIncludingFrame(FrameYawPitchRollReadOnly other) { setIncludingFrame(other.getReferenceFrame(), other); }
/** * Sets this yaw-pitch-roll to the same value as the given {@code other}. * * @param other the other yaw-pitch-roll. Not modified. * @throws ReferenceFrameMismatchException if {@code other} is not expressed in the same reference * frame as {@code this}. */ default void set(FrameYawPitchRollReadOnly other) { set(other.getReferenceFrame(), other); }
throwNotEqualAssertionError(messagePrefix, expected, actual, format); if (expected.getReferenceFrame() != actual.getReferenceFrame())
/** * Asserts the frame yaw-pitch-roll orientations are geometrically equivalent to an {@code epsilon}. * <p> * Note: the two arguments are considered to be equal if they are both equal to {@code null}. * </p> * * @param messagePrefix prefix to add to the error message. * @param expected the expected frame yaw-pitch-roll orientation. Not modified. * @param actual the actual frame yaw-pitch-roll orientation. Not modified. * @param epsilon the tolerance to use. * @param format the format to use for printing each component when an {@code AssertionError} is * thrown. * @throws AssertionError if the two yaw-pitch-roll do not represent the same geometry or not * expressed in the same reference frame. If only one of the arguments is equal to * {@code null}. */ public static void assertFrameYawPitchRollGeometricallyEquals(String messagePrefix, FrameYawPitchRollReadOnly expected, FrameYawPitchRollReadOnly actual, double epsilon, String format) { if (expected == null && actual == null) return; if (expected != null ^ actual != null) throwNotEqualAssertionError(messagePrefix, expected, actual, format); if (expected.getReferenceFrame() != actual.getReferenceFrame()) { throwNotEqualAssertionError(messagePrefix, expected, actual, format); } assertYawPitchRollGeometricallyEquals(messagePrefix, expected, actual, epsilon, format); }