From 2aa1f3f100646db6b55ef25a3430dc2045000231 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Fri, 1 Sep 2017 10:14:59 +0900 Subject: [PATCH] AP_Math: replace divide with multiply in distance_to_segment --- libraries/AP_Math/vector3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_Math/vector3.cpp b/libraries/AP_Math/vector3.cpp index 63970cf797..04fd508df8 100644 --- a/libraries/AP_Math/vector3.cpp +++ b/libraries/AP_Math/vector3.cpp @@ -405,7 +405,7 @@ float Vector3::distance_to_segment(const Vector3 &seg_start, const Vector3 } // semiperimeter of triangle - float s = (a+b+c)/2.0f; + float s = (a+b+c) * 0.5f; float area_squared = s*(s-a)*(s-b)*(s-c); // area must be constrained above 0 because a triangle could have 3 points could be on a line and float rounding could push this under 0