Fixes integer overflow due to fixed / floating mismatch in coordinate interpolation
This commit is contained in:
		
							parent
							
								
									df608e8b43
								
							
						
					
					
						commit
						51d153a5f7
					
				@ -261,10 +261,10 @@ Coordinate interpolateLinear(double factor, const Coordinate from, const Coordin
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    BOOST_ASSERT(0 <= factor && factor <= 1.0);
 | 
					    BOOST_ASSERT(0 <= factor && factor <= 1.0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FloatLongitude interpolated_lon{((1. - factor) * static_cast<std::int32_t>(from.lon)) +
 | 
					    FixedLongitude interpolated_lon(((1. - factor) * static_cast<std::int32_t>(from.lon)) +
 | 
				
			||||||
                                  (factor * static_cast<std::int32_t>(to.lon))};
 | 
					                                    (factor * static_cast<std::int32_t>(to.lon)));
 | 
				
			||||||
    FloatLatitude interpolated_lat{((1. - factor) * static_cast<std::int32_t>(from.lat)) +
 | 
					    FixedLatitude interpolated_lat(((1. - factor) * static_cast<std::int32_t>(from.lat)) +
 | 
				
			||||||
                                  (factor * static_cast<std::int32_t>(to.lat))};
 | 
					                                   (factor * static_cast<std::int32_t>(to.lat)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {std::move(interpolated_lon), std::move(interpolated_lat)};
 | 
					    return {std::move(interpolated_lon), std::move(interpolated_lat)};
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user