diff --git a/include/engine/geospatial_query.hpp b/include/engine/geospatial_query.hpp index ab10a3e77b4..93c152cdbb0 100644 --- a/include/engine/geospatial_query.hpp +++ b/include/engine/geospatial_query.hpp @@ -508,7 +508,7 @@ template class GeospatialQuery reverse_duration_range[reverse_duration_range.size() - data.fwd_segment_position - 1]; EdgeDistance reverse_distance = util::coordinate_calculation::haversineDistance( datafacade.GetCoordinateOfNode(reverse_geometry_range[reverse_geometry_range.size() - - data.fwd_segment_position - 1]), + data.fwd_segment_position - 1]), point_on_segment); ratio = std::min(1.0, std::max(0.0, ratio)); diff --git a/include/engine/phantom_node.hpp b/include/engine/phantom_node.hpp index 35b311a51cd..99595e9185a 100644 --- a/include/engine/phantom_node.hpp +++ b/include/engine/phantom_node.hpp @@ -49,10 +49,10 @@ struct PhantomNode reverse_weight(INVALID_EDGE_WEIGHT), forward_weight_offset(0), reverse_weight_offset(0), forward_distance(MAXIMAL_EDGE_DISTANCE), reverse_distance(MAXIMAL_EDGE_DISTANCE), forward_distance_offset(0), reverse_distance_offset(0), - forward_duration(MAXIMAL_EDGE_DURATION), reverse_duration(MAXIMAL_EDGE_DURATION), forward_duration_offset(0), - reverse_duration_offset(0), fwd_segment_position(0), is_valid_forward_source{false}, - is_valid_forward_target{false}, is_valid_reverse_source{false}, - is_valid_reverse_target{false}, bearing(0) + forward_duration(MAXIMAL_EDGE_DURATION), reverse_duration(MAXIMAL_EDGE_DURATION), + forward_duration_offset(0), reverse_duration_offset(0), fwd_segment_position(0), + is_valid_forward_source{false}, is_valid_forward_target{false}, + is_valid_reverse_source{false}, is_valid_reverse_target{false}, bearing(0) { } @@ -83,13 +83,13 @@ struct PhantomNode // DO THIS FOR DISTANCE - EdgeWeight GetForwardDistance() const + EdgeDistance GetForwardDistance() const { BOOST_ASSERT(forward_segment_id.enabled); return forward_distance + forward_distance_offset; } - EdgeWeight GetReverseDistance() const + EdgeDistance GetReverseDistance() const { BOOST_ASSERT(reverse_segment_id.enabled); return reverse_distance + reverse_distance_offset; @@ -171,7 +171,7 @@ struct PhantomNode reverse_distance{reverse_distance}, forward_distance_offset{forward_distance_offset}, reverse_distance_offset{reverse_distance_offset}, forward_duration{forward_duration}, reverse_duration{reverse_duration}, forward_duration_offset{forward_duration_offset}, - reverse_duration_offset{reverse_duration_offset}, + reverse_duration_offset{reverse_duration_offset}, component{component.id, component.is_tiny}, location{location}, input_location{input_location}, fwd_segment_position{other.fwd_segment_position}, is_valid_forward_source{is_valid_forward_source}, diff --git a/src/engine/routing_algorithms/many_to_many_ch.cpp b/src/engine/routing_algorithms/many_to_many_ch.cpp index 2a8b58f1d50..c48326fa62b 100644 --- a/src/engine/routing_algorithms/many_to_many_ch.cpp +++ b/src/engine/routing_algorithms/many_to_many_ch.cpp @@ -226,8 +226,7 @@ std::vector manyToManySearch(SearchEngineData &engi std::vector search_space_with_buckets; std::vector packed_leg; - engine_working_data.InitializeOrClearUnpackingCacheThreadLocalStorage( - facade.GetTimestamp()); + engine_working_data.InitializeOrClearUnpackingCacheThreadLocalStorage(facade.GetTimestamp()); // Populate buckets with paths from all accessible nodes to destinations via backward searches for (std::uint32_t column_idx = 0; column_idx < target_indices.size(); ++column_idx) @@ -354,31 +353,31 @@ std::vector manyToManySearch(SearchEngineData &engi durations_table[row_idx * number_of_targets + column_idx] += offset; } - // check the direction of travel to figure out how to calculate the offset to/from - // the source/target + // SAME THING BUT FOR DISTANCE if (source_phantom.forward_segment_id.id == packed_leg.front()) { // direction of travel is forward EdgeDistance offset = source_phantom.GetForwardDistance(); - disctance_table[row_idx * number_of_targets + column_idx] -= offset; + distance_table[row_idx * number_of_targets + column_idx] -= offset; } if (source_phantom.reverse_segment_id.id == packed_leg.front()) { EdgeDistance offset = source_phantom.GetReverseDistance(); - disctance_table[row_idx * number_of_targets + column_idx] -= offset; + distance_table[row_idx * number_of_targets + column_idx] -= offset; } if (target_phantom.forward_segment_id.id == packed_leg.back()) { // direction of travel is forward EdgeDistance offset = target_phantom.GetForwardDistance(); - disctance_table[row_idx * number_of_targets + column_idx] += offset; + distance_table[row_idx * number_of_targets + column_idx] += offset; } if (target_phantom.reverse_segment_id.id == packed_leg.back()) { EdgeDistance offset = target_phantom.GetReverseDistance(); - disctance_table[row_idx * number_of_targets + column_idx] += offset; + distance_table[row_idx * number_of_targets + column_idx] += offset; } } else { + // OFFSET DURATIONS if (target_phantom.GetForwardDuration() > source_phantom.GetForwardDuration()) { EdgeDuration offset = @@ -392,15 +391,16 @@ std::vector manyToManySearch(SearchEngineData &engi durations_table[row_idx * number_of_targets + column_idx] += offset; } + // SAME EXACT CALCULATIONS FOR DISTANCE if (target_phantom.GetForwardDistance() > source_phantom.GetForwardDistance()) { - EdgeDuration offset = + EdgeDistance offset = target_phantom.GetForwardDistance() - source_phantom.GetForwardDistance(); distance_table[row_idx * number_of_targets + column_idx] += offset; } else { - EdgeDuration offset = + EdgeDistance offset = target_phantom.GetReverseDistance() - source_phantom.GetReverseDistance(); distance_table[row_idx * number_of_targets + column_idx] += offset; }