CellHandle findCrossedIncidentCell(const Predicate isValid, const VertexHandle vh, const Real2 query, const real eps) const { std::list<CellHandle> cells = allIncidentCells(vh); for (CellHandle candidate : cells) { if (!isValid(candidate)) { continue; } VertexHandle a = otherVertex(candidate, vh, vh); VertexHandle b = otherVertex(candidate, vh, a); if (linal::angleContains( realD(vh), realD(a), realD(b), query, eps)) { return candidate; } } return NULL; }
/** * Searches vertices on the silhouette of the convex hull * @param number of vertices * @param vertices * @return left most vertex on the silhouette of the convex hull */ int ConvexHull::searchSilhouette(int nv, int* kv0) { int iv0 = 0; for (int i = 0; i < nv; i++) { iv0 = kv0[i]; int iv = iv0; bool found = false; do { int e0 = kve[iv]; int e = e0; bool or2 = isFront(rightFace(iv, e)); found = false; do { bool or1 = isFront(leftFace(iv, e)); // if the silhouette edge is found, entries vertex to cyclic list if (!or1 && or2) { int nxv = otherVertex(iv, e); kcnxv[iv] = nxv; kccnxv[nxv] = iv; iv = nxv; found = true; break; } e = nextCCWEdge(iv, e); or2 = or1; } while (e != e0); if (!found) { break; } } while (iv != iv0); if (found) { break; } // if silhouette edge is not found, the vertex is not on the silhouette edge // then, searches next vertex } return iv0; }