You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Jørgen Nystad (Jira)" <ji...@apache.org> on 2021/03/25 14:24:00 UTC
[jira] [Created] (LUCENE-9870) Circle2D intersectsLine bug mostly
causes no matches along indexed lines and outside polygon edges
Jørgen Nystad created LUCENE-9870:
-------------------------------------
Summary: Circle2D intersectsLine bug mostly causes no matches along indexed lines and outside polygon edges
Key: LUCENE-9870
URL: https://issues.apache.org/jira/browse/LUCENE-9870
Project: Lucene - Core
Issue Type: Bug
Components: modules/spatial
Affects Versions: 8.8
Reporter: Jørgen Nystad
Circle2D intersectsLine does a dot product to determine closest point on line but then filters it like this:
{code:java}
final double distance = dotProduct / magnitudeAB;
if (distance < 0 || distance > dotProduct) {
return false;
}
{code}
If magnitudeAB (squared length of line) is less than 1 (degree), this will always return false.
distance is actually the "t-value", meaning the correct behaviour here would be to clamp it between 0 and 1 to ensure point is on actual line.
A straightforward fix that works since edge and end points are checked anyway:
{code:java}
final double distance = dotProduct / magnitudeAB;
if (distance < 0 || distance > 1) {
return false;
}
{code}
This is tested and verified by building version 8.8.0 and replacing jar-files in an elasticsearch instance of version 7.12.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org