MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / ExploreLeafNode

Method ExploreLeafNode

include/util/static_rtree.hpp:688–719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

686 */
687 template <typename QueueT>
688 void ExploreLeafNode(const TreeIndex &leaf_id,
689 const Coordinate &projected_input_coordinate_fixed,
690 const FloatCoordinate &projected_input_coordinate,
691 QueueT &traversal_queue) const
692 {
693 // Check that we're actually looking at the bottom level of the tree
694 BOOST_ASSERT(is_leaf(leaf_id));
695
696 for (const auto i : child_indexes(leaf_id))
697 {
698 const auto &current_edge = m_objects[i];
699
700 const auto projected_u = web_mercator::fromWGS84(m_coordinate_list[current_edge.u]);
701 const auto projected_v = web_mercator::fromWGS84(m_coordinate_list[current_edge.v]);
702
703 FloatCoordinate projected_nearest;
704 std::tie(std::ignore, projected_nearest) =
705 coordinate_calculation::projectPointOnSegment(
706 projected_u, projected_v, projected_input_coordinate);
707
708 const auto squared_distance = coordinate_calculation::squaredEuclideanDistance(
709 projected_input_coordinate_fixed, projected_nearest);
710 // distance must be non-negative
711 BOOST_ASSERT(0. <= squared_distance);
712 BOOST_ASSERT(i < std::numeric_limits<std::uint32_t>::max());
713
714 traversal_queue.emplace(QueryCandidate{squared_distance,
715 leaf_id,
716 static_cast<std::uint32_t>(i),
717 Coordinate{projected_nearest}});
718 }
719 }
720
721 /**
722 * Iterates over all the children of a TreeNode and inserts them into the search

Callers

nothing calls this directly

Calls 4

fromWGS84Function · 0.85
projectPointOnSegmentFunction · 0.85
squaredEuclideanDistanceFunction · 0.85
emplaceMethod · 0.45

Tested by

no test coverage detected