From 28d9be1cc0c7655ff21846f5b017acef86df34a2 Mon Sep 17 00:00:00 2001 From: Josh Henderson Date: Sat, 11 Sep 2021 04:18:29 -0400 Subject: [PATCH] AP_Math: get_horizontal_cm() simplify --- libraries/AP_Math/location.cpp | 6 ------ libraries/AP_Math/location.h | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/libraries/AP_Math/location.cpp b/libraries/AP_Math/location.cpp index f89802535a..0e7f4cccf7 100644 --- a/libraries/AP_Math/location.cpp +++ b/libraries/AP_Math/location.cpp @@ -23,12 +23,6 @@ #include "AP_Math.h" #include "location.h" -// return horizontal distance between two positions in cm -float get_horizontal_distance_cm(const Vector2f &origin, const Vector2f &destination) -{ - return (destination - origin).length(); -} - // return bearing in centi-degrees between two positions float get_bearing_cd(const Vector2f &origin, const Vector2f &destination) { diff --git a/libraries/AP_Math/location.h b/libraries/AP_Math/location.h index e87f4c7c8b..9a8f132924 100644 --- a/libraries/AP_Math/location.h +++ b/libraries/AP_Math/location.h @@ -9,8 +9,12 @@ * LOCATION */ -// return horizontal distance in centimeters between two positions -float get_horizontal_distance_cm(const Vector2f &origin, const Vector2f &destination); +// return horizontal distance between two positions in cm +template +float get_horizontal_distance_cm(const Vector2 &origin, const Vector2 &destination) +{ + return (destination - origin).length(); +} // return bearing in centi-degrees between two positions float get_bearing_cd(const Vector2f &origin, const Vector2f &destination);