diff --git a/libs/geom/include/psemek/geom/math.hpp b/libs/geom/include/psemek/geom/math.hpp index 5be880fe..1ef70b72 100644 --- a/libs/geom/include/psemek/geom/math.hpp +++ b/libs/geom/include/psemek/geom/math.hpp @@ -8,6 +8,17 @@ namespace psemek::geom { + template + T sign(T const & x) + { + if (x > 0) + return 1; + else if (x < 0) + return -1; + else + return 0; + } + template auto sqr(T const & x) {