private static int numberOfBorderEdges(QuadEdgeTriangle triangle, Set<QuadEdge> borderEdges) { int numberOfBorderEdges = 0; for (int edgeIndex = 0; edgeIndex < 3; edgeIndex++) { QuadEdge edge = triangle.getEdge(edgeIndex); // Need to check the opposite of the edge too (edge != edge.sym()) if (isBorderEdge(edge, borderEdges)) numberOfBorderEdges++; } return numberOfBorderEdges; }
private static List<ConcaveHullVariables> divideHullAtIntersectionTriangle(ConcaveHullVariables variables, Pair<QuadEdge, QuadEdgeTriangle> entryWithIntersectionTriangle) { Set<QuadEdge> borderEdges = variables.borderEdges; QuadEdgeTriangle intersectionTriangle = entryWithIntersectionTriangle.getRight(); QuadEdge uniqueNonBorderEdge = Arrays.stream(intersectionTriangle.getEdges()).filter(edge -> !isBorderEdge(edge, borderEdges)).findAny().get(); Vertex intersectionVertex = intersectionTriangle.getVertex(indexOfVertexOppositeToEdge(intersectionTriangle.getEdgeIndex(uniqueNonBorderEdge))); return divideHullAtIntersectionVertex(variables, intersectionVertex); }
if (!isBorderEdge(edge, borderEdges))
subBorderEdges.forEach(borderEdge -> subBorderVertices.add(borderEdge.orig())); sortedByLengthQueue.stream() .filter(pair -> isBorderEdge(pair.getLeft(), subBorderEdges)) .forEach(subSortedByLengthQueue::add); subSortedByLengthQueue.forEach(pair -> subBorderTriangles.add(pair.getRight()));
if (isConstraintEdge(edge, constraintEdges) && isBorderEdge(edge, borderEdges)) return Case.KEEP_TRIANGLE; QuadEdge uniqueNonBorderEdge = Arrays.stream(candidateTriangle.getEdges()).filter(edge -> !isBorderEdge(edge, borderEdges)).findFirst().get(); int vertexIndexOppositeToCandidateEdge = indexOfVertexOppositeToEdge(candidateTriangle.getEdgeIndex(uniqueNonBorderEdge)); List<QuadEdgeTriangle> adjacentTrianglesToVertex = candidateTriangle.getTrianglesAdjacentToVertex(vertexIndexOppositeToCandidateEdge);
if (isBorderEdge(currentIncidentEdge, borderEdges))