27 const triangulationType &triangulation,
28 std::vector<T> &outputDists,
29 const std::vector<SimplexId> &bounds
30 = std::vector<SimplexId>(),
31 const std::vector<bool> &mask = std::vector<bool>()) {
34 bool const processAllVertices = bounds.empty();
38 bool const isMask = !mask.empty();
41 if(isMask && mask.size() != vertexNumber) {
46 std::vector<bool> reachedBounds;
49 if(!processAllVertices) {
50 reachedBounds.resize(bounds.size(),
false);
55 outputDists.resize(vertexNumber, std::numeric_limits<T>::infinity());
58 using pq_t = std::pair<T, SimplexId>;
61 std::priority_queue<pq_t, std::vector<pq_t>, std::greater<pq_t>> pq;
64 pq.push(std::make_pair(T(0.0F), source));
65 outputDists[source] = T(0.0F);
70 auto vert = elem.second;
71 std::array<float, 3> vCoords{};
72 triangulation.getVertexPoint(vert, vCoords[0], vCoords[1], vCoords[2]);
74 auto nneigh = triangulation.getVertexNeighborNumber(vert);
79 triangulation.getVertexNeighbor(vert, i, neigh);
82 if(isMask && !mask[neigh]) {
87 std::array<float, 3> nCoords{};
88 triangulation.getVertexPoint(
89 neigh, nCoords[0], nCoords[1], nCoords[2]);
92 if(outputDists[neigh] > outputDists[vert] + distVN) {
93 outputDists[neigh] = outputDists[vert] + distVN;
94 if(!processAllVertices) {
96 auto it = std::find(bounds.begin(), bounds.end(), neigh);
97 if(it != bounds.end()) {
99 reachedBounds[it - bounds.begin()] =
true;
102 if(std::all_of(reachedBounds.begin(), reachedBounds.end(),
103 [](
const bool v) { return v; })) {
107 pq.push(std::make_pair(outputDists[neigh], neigh));