AP_Math: replace divide with multiply in distance_to_segment

This commit is contained in:
Randy Mackay 2017-09-01 10:14:59 +09:00
parent e892bbbac0
commit 2aa1f3f100

View File

@ -405,7 +405,7 @@ float Vector3<T>::distance_to_segment(const Vector3<T> &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