Skip to content

Commit f17b913

Browse files
peterbarkertridge
authored andcommitted
AP_Math: provide float and double norm variants
1 parent 3b43db2 commit f17b913

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

libraries/AP_Math/AP_Math.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,13 @@ ftype norm(const T first, const U second, const Params... parameters)
288288
return sqrtF(sq(first, second, parameters...));
289289
}
290290

291+
inline float norm(const float first, const float second) {
292+
return sqrtf(sq(first) + sq(second));
293+
}
294+
inline float norm(const float first, const float second, const float third) {
295+
return sqrtf(sq(first) + sq(second) + sq(third));
296+
}
297+
291298
#undef MIN
292299
template<typename A, typename B>
293300
static inline auto MIN(const A &one, const B &two) -> decltype(one < two ? one : two)

0 commit comments

Comments
 (0)