diff options
author | 2012-12-27 19:55:30 -0800 | |
---|---|---|
committer | 2012-12-27 19:55:30 -0800 | |
commit | 3847ce5d96d017a288f0ba4ddbe88e39620e0994 (patch) | |
tree | cf7cc77a65f3eec9c239935fc76f3e1c9a2eb4ca /native/jni/src/geometry_utils.h | |
parent | 71ea09d2b3eba95f1beec22842251089b13b0d1c (diff) | |
parent | 07711c10b8a64f26f4ecb1df0bb84df95c7f25d2 (diff) | |
download | latinime-3847ce5d96d017a288f0ba4ddbe88e39620e0994.tar.gz latinime-3847ce5d96d017a288f0ba4ddbe88e39620e0994.tar.xz latinime-3847ce5d96d017a288f0ba4ddbe88e39620e0994.zip |
am 07711c10: Tidy up GeometryUtils a bit
* commit '07711c10b8a64f26f4ecb1df0bb84df95c7f25d2':
Tidy up GeometryUtils a bit
Diffstat (limited to 'native/jni/src/geometry_utils.h')
-rw-r--r-- | native/jni/src/geometry_utils.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/native/jni/src/geometry_utils.h b/native/jni/src/geometry_utils.h index 38b91cc50..4060a7bd3 100644 --- a/native/jni/src/geometry_utils.h +++ b/native/jni/src/geometry_utils.h @@ -54,7 +54,7 @@ static AK_FORCE_INLINE int getDistanceInt(const int x1, const int y1, const int static AK_FORCE_INLINE float getAngle(const int x1, const int y1, const int x2, const int y2) { const int dx = x1 - x2; const int dy = y1 - y2; - if (dx == 0 && dy == 0) return 0; + if (dx == 0 && dy == 0) return 0.0f; return atan2f(static_cast<float>(dy), static_cast<float>(dx)); } @@ -96,6 +96,7 @@ static inline float pointToLineSegSquaredDistanceFloat(const float x, const floa // Normal distribution N(u, sigma^2). struct NormalDistribution { + public: NormalDistribution(const float u, const float sigma) : mU(u), mSigma(sigma), mPreComputedNonExpPart(1.0f / sqrtf(2.0f * M_PI_F * SQUARE_FLOAT(sigma))), @@ -108,10 +109,10 @@ struct NormalDistribution { private: DISALLOW_IMPLICIT_CONSTRUCTORS(NormalDistribution); - float mU; // mean value - float mSigma; // standard deviation - float mPreComputedNonExpPart; // = 1 / sqrt(2 * PI * sigma^2) - float mPreComputedExponentPart; // = -1 / (2 * sigma^2) + const float mU; // mean value + const float mSigma; // standard deviation + const float mPreComputedNonExpPart; // = 1 / sqrt(2 * PI * sigma^2) + const float mPreComputedExponentPart; // = -1 / (2 * sigma^2) }; // struct NormalDistribution } // namespace latinime #endif // LATINIME_GEOMETRY_UTILS_H |