static unsigned findNextEdgeVertexIndex(const FloatPolygon& polygon, unsigned vertexIndex1, bool clockwise) { unsigned nVertices = polygon.numberOfVertices(); unsigned vertexIndex2 = nextVertexIndex(vertexIndex1, nVertices, clockwise); while (vertexIndex2 && areCoincidentPoints(polygon.vertexAt(vertexIndex1), polygon.vertexAt(vertexIndex2))) vertexIndex2 = nextVertexIndex(vertexIndex2, nVertices, clockwise); while (vertexIndex2) { unsigned vertexIndex3 = nextVertexIndex(vertexIndex2, nVertices, clockwise); if (!areCollinearPoints(polygon.vertexAt(vertexIndex1), polygon.vertexAt(vertexIndex2), polygon.vertexAt(vertexIndex3))) break; vertexIndex2 = vertexIndex3; } return vertexIndex2; }
unsigned ExclusionPolygon::findNextEdgeVertexIndex(unsigned vertexIndex1, bool clockwise) const { unsigned nVertices = numberOfVertices(); unsigned vertexIndex2 = nextVertexIndex(vertexIndex1, nVertices, clockwise); while (vertexIndex2 && areCoincidentPoints(vertexAt(vertexIndex1), vertexAt(vertexIndex2))) vertexIndex2 = nextVertexIndex(vertexIndex2, nVertices, clockwise); while (vertexIndex2) { unsigned vertexIndex3 = nextVertexIndex(vertexIndex2, nVertices, clockwise); if (!areCollinearPoints(vertexAt(vertexIndex1), vertexAt(vertexIndex2), vertexAt(vertexIndex3))) break; vertexIndex2 = vertexIndex3; } return vertexIndex2; }