diff options
author | 2012-09-20 20:37:44 +0900 | |
---|---|---|
committer | 2012-09-20 20:37:44 +0900 | |
commit | 379aeb18366f29b8d9d0f90e2fbb0daa3aaeefa4 (patch) | |
tree | 1836a0f65c41e66e65b22c2282c2807935dffe7a /native/jni/src/geometry_utils.h | |
parent | f18fc03621b70f5a51cf54c4bf40eb213de40652 (diff) | |
parent | 54717534b1164c575a14a4a117284e72c6cd0ee0 (diff) | |
download | latinime-379aeb18366f29b8d9d0f90e2fbb0daa3aaeefa4.tar.gz latinime-379aeb18366f29b8d9d0f90e2fbb0daa3aaeefa4.tar.xz latinime-379aeb18366f29b8d9d0f90e2fbb0daa3aaeefa4.zip |
Merge remote-tracking branch 'goog/jb-mr1-dev' into mergescriptpackage
Diffstat (limited to 'native/jni/src/geometry_utils.h')
-rw-r--r-- | native/jni/src/geometry_utils.h | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/native/jni/src/geometry_utils.h b/native/jni/src/geometry_utils.h index bad5eda61..3892b46a0 100644 --- a/native/jni/src/geometry_utils.h +++ b/native/jni/src/geometry_utils.h @@ -64,17 +64,8 @@ static inline float getAngleDiff(float a1, float a2) { return diff; } -// static float pointToLineSegSquaredDistanceFloat( -// float x, float y, float x1, float y1, float x2, float y2) { -// float A = x - x1; -// float B = y - y1; -// float C = x2 - x1; -// float D = y2 - y1; -// return fabsf(A * D - C * B) / sqrtf(C * C + D * D); -// } - static inline float pointToLineSegSquaredDistanceFloat( - float x, float y, float x1, float y1, float x2, float y2) { + float x, float y, float x1, float y1, float x2, float y2, bool extend) { const float ray1x = x - x1; const float ray1y = y - y1; const float ray2x = x2 - x1; @@ -86,10 +77,10 @@ static inline float pointToLineSegSquaredDistanceFloat( float projectionX; float projectionY; - if (projectionLengthSqr < 0.0f) { + if (!extend && projectionLengthSqr < 0.0f) { projectionX = x1; projectionY = y1; - } else if (projectionLengthSqr > 1.0f) { + } else if (!extend && projectionLengthSqr > 1.0f) { projectionX = x2; projectionY = y2; } else { |