/** * Asserts on a per component basis that the two frame convex polygon 2D 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 expected the expected frame convex polygon 2D. Not modified. * @param actual the actual frame convex polygon 2D. Not modified. * @param epsilon the tolerance to use. * @throws AssertionError if the two frame convex polygon 2D are not equal. If only one of the * arguments is equal to {@code null}. */ public static void assertFrameConvexPolygon2DEquals(FrameConvexPolygon2DReadOnly expected, FrameConvexPolygon2DReadOnly actual, double epsilon) { assertFrameConvexPolygon2DEquals(null, expected, actual, epsilon); }
/** * Asserts on a per component basis that the two frame convex polygon 2D 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 frame convex polygon 2D. Not modified. * @param actual the actual frame convex polygon 2D. Not modified. * @param epsilon the tolerance to use. * @throws AssertionError if the two frame convex polygon 2D are not equal. If only one of the * arguments is equal to {@code null}. */ public static void assertFrameConvexPolygon2DEquals(String messagePrefix, FrameConvexPolygon2DReadOnly expected, FrameConvexPolygon2DReadOnly actual, double epsilon) { assertFrameConvexPolygon2DEquals(messagePrefix, expected, actual, epsilon, DEFAULT_FORMAT); }
/** * {@link FrameConvexPolygon2D#setIncludingFrame(us.ihmc.euclid.referenceFrame.interfaces.FrameVertex2DSupplier)} * given an empty polygon does actually not set the frame. */ @Test public void testIssue16() { Random random = new Random(342); { ReferenceFrame frameA = EuclidFrameRandomTools.nextReferenceFrame(random); ReferenceFrame frameB = EuclidFrameRandomTools.nextReferenceFrame(random); FrameConvexPolygon2D firstPolygon = EuclidFrameRandomTools.nextFrameConvexPolygon2D(random, frameA, 1.0, 10); FrameConvexPolygon2D secondPolygon = new FrameConvexPolygon2D(frameB); firstPolygon.setIncludingFrame(secondPolygon); EuclidFrameTestTools.assertFrameConvexPolygon2DEquals(firstPolygon, secondPolygon, EPSILON); } { ReferenceFrame frameA = EuclidFrameRandomTools.nextReferenceFrame(random); ReferenceFrame frameB = EuclidFrameRandomTools.nextReferenceFrame(random); FrameConvexPolygon2D firstPolygon = EuclidFrameRandomTools.nextFrameConvexPolygon2D(random, frameA, 1.0, 10); FrameConvexPolygon2D secondPolygon = new FrameConvexPolygon2D(frameB); FrameConvexPolygon2D thirdPolygon = new FrameConvexPolygon2D(frameB); firstPolygon.setIncludingFrame(secondPolygon, thirdPolygon); EuclidFrameTestTools.assertFrameConvexPolygon2DEquals(firstPolygon, secondPolygon, EPSILON); } }