/** * Tests if this pose is equal to the given {@code other} to an {@code epsilon}. * <p> * If the two poses have different frames, this method returns {@code false}. * </p> * * @param other the other pose to compare against this. Not modified. * @param epsilon the tolerance to use when comparing.. * @return {@code true} if the two poses are equal and are expressed in the same reference frame, * {@code false} otherwise. */ default boolean epsilonEquals(FramePose2DReadOnly other, double epsilon) { if (getReferenceFrame() != other.getReferenceFrame()) return false; return Pose2DReadOnly.super.epsilonEquals(other, epsilon); }
/** * Asserts on a per component basis that the two pose 2Ds are equal 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 pose 2D. Not modified. * @param actual the actual pose 2D. 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 pose 2Ds are not equal. If only one of the arguments is * equal to {@code null}. */ public static void assertPose2DEquals(String messagePrefix, Pose2DReadOnly expected, Pose2DReadOnly actual, double epsilon, String format) { if (expected == null && actual == null) return; if (!(expected != null && actual != null)) throwNotEqualAssertionError(messagePrefix, expected, actual, format); if (!expected.epsilonEquals(actual, epsilon)) { throwNotEqualAssertionError(messagePrefix, expected, actual, format); } }