/** * Tests if this {@link PolyLine} has the same shape as another {@link PolyLine}. This is * different from equals as some {@link PolyLine}s that are different can still have the same * shape, by being reversed or by self intersecting in the same point for example. * * @param other * The other {@link PolyLine} to compare to * @return True if they both have the same shape */ public boolean equalsShape(final PolyLine other) { return this.overlapsShapeOf(other) && other.overlapsShapeOf(this); }
@Test public void testOverlapsShape() { final PolyLine larger = new PolyLine(Location.CROSSING_85_280, Location.TEST_1, Location.TEST_7); final PolyLine smaller = new PolyLine(Location.CROSSING_85_280, Location.TEST_1); final PolyLine smallerReversed = new PolyLine(Location.TEST_1, Location.CROSSING_85_280); Assert.assertTrue(larger.overlapsShapeOf(smaller)); Assert.assertTrue(larger.overlapsShapeOf(smallerReversed)); Assert.assertTrue(smaller.overlapsShapeOf(smallerReversed)); Assert.assertTrue(smallerReversed.overlapsShapeOf(smaller)); Assert.assertFalse(smaller.overlapsShapeOf(larger)); Assert.assertFalse(smallerReversed.overlapsShapeOf(larger)); }
if (longerEdge.overlapsShapeOf(subsetEdge))