You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Nicholas Knize (JIRA)" <ji...@apache.org> on 2018/12/03 18:12:00 UTC

[jira] [Commented] (LUCENE-8581) Change LatLonShape encoding to use 4 BYTES Per Dimension

    [ https://issues.apache.org/jira/browse/LUCENE-8581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16707612#comment-16707612 ] 

Nicholas Knize commented on LUCENE-8581:
----------------------------------------

Thanks [~ivera]

 {{setTriangleValue((aLon), (aLat), (bLon), (bLat), (cLon), (cLat));}}

I think it would be good to keep the calls to {{encodeLatitude}} and {{encodeLongitude}} here. The tessellator already encodes polygon triangles, so there's no need to call the encode methods twice.

{{setTriangleValue(t.getLon(0), t.getLat(0), t.getLon(1), t.getLat(1), t.getLon(2), t.getLat(2));}}

Just keep the calls to {{getEncodedX}} {{getEncodedY}} to unnecessarily encode twice.


{code:java}
int ccw = GeoUtils.orient(aLon, aLat, bLon, bLat, cLon, cLat);
if (ccw == 1) {
  throw new IllegalArgumentException("Orientation of the triangle cannot be clock-wise");
}{code}

Encoding should be orientation agnostic, but congruent (order preserved). I think we should remove the orientation dependency.

 
{code:java}
if (minY == aY && minX == aX) {
...{code}
For maintenance I'd really like to reduce this tree of conditionals. Its pretty hard to follow. However, I think we could do that in a separate issue/patch iteration (this is in sandbox after all). For now, lets at least make sure this code is well documented so it's clear what's going on. 

 

 

 

 

> Change LatLonShape encoding to use 4 BYTES Per Dimension
> --------------------------------------------------------
>
>                 Key: LUCENE-8581
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8581
>             Project: Lucene - Core
>          Issue Type: New Feature
>            Reporter: Nicholas Knize
>            Assignee: Ignacio Vera
>            Priority: Major
>         Attachments: LUCENE-8581.patch
>
>
> {{LatLonShape}} tessellated triangles currently use a relatively naive encoding with the first four dimensions as the bounding box of the triangle and the last three dimensions as the vertices of the triangle. To encode the {{x,y}} vertices in the last three dimensions requires {{bytesPerDim}} to be set to 8, with 4 bytes for the x & y axis, respectively. We can reduce {{bytesPerDim}} to 4 by encoding the index(es) of the vertices shared by the bounding box along with the orientation of the triangle. This also opens the door for supporting {{CONTAINS}} queries.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org