DelaunayTriangulation triangulation1,
DelaunayTriangulation triangulation2) {
for (DelaunayTriangle t1 : triangulation1.getTriangles()) {
DelaunayTriangle twinTriangle = null;
for (DelaunayTriangle t2 : triangulation2.getTriangles()) {
if (t1.asTriangleXZ().equals(t2.asTriangleXZ())) {
twinTriangle = t2;
}
}
assertNotNull("must contain " + t1, twinTriangle);
for (int i = 0; i <= 2; i++) {
DelaunayTriangle n1 = t1.getNeighbor(i);
DelaunayTriangle n2 = twinTriangle.getNeighbor(i);
if (n1 == null && n2 == null) {
continue;
} else if (n1 != null && n2 != null
&& n1.asTriangleXZ().equals(n2.asTriangleXZ())) {
continue;
} else {
fail(String.format("neighbor %d different: %s vs. %s",
i, n1, n2));
}