diff options
author | Maxim Pimenov <m@maps.me> | 2016-10-04 19:17:18 +0300 |
---|---|---|
committer | Maxim Pimenov <m@maps.me> | 2016-10-12 14:12:05 +0300 |
commit | d08a086c592c57c8a0bb1f85233e4405dadc69de (patch) | |
tree | ff5148c8cb71d575a418bbfb7dcf8fae42b9fd76 /base | |
parent | b624f9f227a25e0720f2a453b29edc0b80f5c259 (diff) |
[coding] Added a serialization method for traffic coords.
Diffstat (limited to 'base')
-rw-r--r-- | base/math.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/base/math.hpp b/base/math.hpp index 92ac40ab06..eb20ca4295 100644 --- a/base/math.hpp +++ b/base/math.hpp @@ -73,6 +73,13 @@ inline bool AlmostEqualRel(TFloat x, TFloat y, TFloat eps) return fabs(x - y) < eps * max(fabs(x), fabs(y)); } +// Returns true if x and y are equal up to the absolute or relative difference eps. +template <typename TFloat> +inline bool AlmostEqualAbsOrRel(TFloat x, TFloat y, TFloat eps) +{ + return AlmostEqualAbs(x, y, eps) || AlmostEqualRel(x, y, eps); +} + template <typename TFloat> inline TFloat DegToRad(TFloat deg) { return deg * TFloat(math::pi) / TFloat(180); |