You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Ignacio Vera (Jira)" <ji...@apache.org> on 2021/03/30 06:06:00 UTC
[jira] [Resolved] (LUCENE-9870) Circle2D intersectsLine bug mostly
causes no matches along indexed lines and outside polygon edges
[ https://issues.apache.org/jira/browse/LUCENE-9870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ignacio Vera resolved LUCENE-9870.
----------------------------------
Fix Version/s: 8.8.2
Assignee: Ignacio Vera
Resolution: Fixed
> 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
> Assignee: Ignacio Vera
> Priority: Major
> Labels: easyfix
> Fix For: 8.8.2
>
> Attachments: 0001-Circle2D-Fix-intersectsLine-t-value-distance-range-c.patch
>
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> 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