You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Karl Wright (JIRA)" <ji...@apache.org> on 2016/04/06 17:12:25 UTC

[jira] [Comment Edited] (LUCENE-7173) Add Polygon... variant of newPolygonQuery() to Geo3DPoint

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

Karl Wright edited comment on LUCENE-7173 at 4/6/16 3:12 PM:
-------------------------------------------------------------

While adding tests for this ticket, which involve creating random nested polygons, I ran into another problem with polygon construction.  Turns out you can still specify a polygon that cannot be "tiled" using convex and concave polygons -- or, at least, I haven't yet found a way.  Here's the analysis:

{code}
   [junit4]   1> Concave polygon points:
   [junit4]   1>  [A=0.9444789194829755, B=-0.31589995244017205, C=-0.09037029766780857, D=0.0, side=1.0]: [X=0.17279348371564082, Y=0.24422965662722748, Z=0.9521675605930696]->[X=-0.30329807815178533, Y=-0.9447434167936289, Z=0.13262941042055737]; previous? out next? out
   [junit4]   1>  [A=-0.37808203585577344, B=-0.008581987948372853, C=-0.9257323174903248, D=0.0, side=1.0]: [X=-0.30329807815178533, Y=-0.9447434167936289, Z=0.13262941042055737]->[X=-0.5367607140926697, Y=0.8179452639396644, Z=0.21163783898691005]; previous? out next? out
   [junit4]   1>  [A=0.45582365981598694, B=0.4911827320867173, C=-0.7422697049265768, D=0.0, side=1.0]: [X=-0.5367607140926697, Y=0.8179452639396644, Z=0.21163783898691005]->[X=0.39285411191111597, Y=0.6369575362013932, Z=0.6627439307500357]; previous? out next? out
   [junit4]   1>  [A=-0.41883204662077844, B=-0.5178244944054781, C=0.7459473907167725, D=0.0, side=1.0]: [X=0.39285411191111597, Y=0.6369575362013932, Z=0.6627439307500357]->[X=-0.44715655239362595, Y=0.8332957749253644, Z=0.3273923501593971]; previous? out next? out
   [junit4]   1>  [A=0.39659926756283254, B=0.5121429060646976, C=-0.7618521278674956, D=0.0, side=1.0]: [X=-0.44715655239362595, Y=0.8332957749253644, Z=0.3273923501593971]->[X=0.33024322515264537, Y=0.6945246730529289, Z=0.6387986432043298]; previous? out next? out
   [junit4]   1>  [A=-0.3812197352639907, B=-0.5210928300537263, C=0.763631963652551, D=0.0, side=1.0]: [X=0.33024322515264537, Y=0.6945246730529289, Z=0.6387986432043298]->[X=-0.1699323603224724, Y=0.8516746480592872, Z=0.4963385521664198]; previous? out next? out
   [junit4]   1>  [A=0.3564935302675921, B=0.5225100222955387, C=-0.7745293018847416, D=0.0, side=1.0]: [X=-0.1699323603224724, Y=0.8516746480592872, Z=0.4963385521664198]->[X=0.2654788898359613, Y=0.7380222309164597, Z=0.6200740473100581]; previous? out next? out
   [junit4]   1>  [A=0.9610409564286931, B=-0.2538849893053205, C=-0.10928262566419222, D=0.0, side=1.0]: [X=0.2654788898359613, Y=0.7380222309164597, Z=0.6200740473100581]->[X=0.17279348371564082, Y=0.24422965662722748, Z=0.9521675605930696]; previous? out next? out
   [junit4] ERROR   0.04s | GeoPolygonTest.testPolygonFactoryCase1 <<<
   [junit4]    > Throwable #1: java.lang.IllegalArgumentException: Polygon is not concave: Point [X=0.39285411191111597, Y=0.6369575362013932, Z=0.6627439307500357] 
      Edge [A=0.9444789194829755, B=-0.31589995244017205, C=-0.09037029766780857, D=0.0, side=1.0]
{code}

What is happening:
(1) All the edges have the correct relationships with their adjoining points.
(2) The planes constructed for GeoConcavePolygon are all consisted, sidedness-wise, with the plane that fails.
(3) The failure is due to a point on one side of the concave polygon that is on the wrong side of the plane across from it.
(4) The implication is that the complement polygon is larger than 180 degrees in at least one direction, even though all its points have a concave relationship with their adjacent edge points.

No solution in mind yet.



was (Author: kwright@metacarta.com):
While adding tests for this ticket, which involve creating random nested polygons, I ran into another problem with polygon construction.  Turns out you can still specify a polygon that cannot be "tiled" using convex and concave polygons -- or, at least, I haven't yet found a way.  Here's the analysis:

   [junit4]   1> Concave polygon points:
   [junit4]   1>  [A=0.9444789194829755, B=-0.31589995244017205, C=-0.09037029766780857, D=0.0, side=1.0]: [X=0.17279348371564082, Y=0.24422965662722748, Z=0.9521675605930696]->[X=-0.30329807815178533, Y=-0.9447434167936289, Z=0.13262941042055737]; previous? out next? out
   [junit4]   1>  [A=-0.37808203585577344, B=-0.008581987948372853, C=-0.9257323174903248, D=0.0, side=1.0]: [X=-0.30329807815178533, Y=-0.9447434167936289, Z=0.13262941042055737]->[X=-0.5367607140926697, Y=0.8179452639396644, Z=0.21163783898691005]; previous? out next? out
   [junit4]   1>  [A=0.45582365981598694, B=0.4911827320867173, C=-0.7422697049265768, D=0.0, side=1.0]: [X=-0.5367607140926697, Y=0.8179452639396644, Z=0.21163783898691005]->[X=0.39285411191111597, Y=0.6369575362013932, Z=0.6627439307500357]; previous? out next? out
   [junit4]   1>  [A=-0.41883204662077844, B=-0.5178244944054781, C=0.7459473907167725, D=0.0, side=1.0]: [X=0.39285411191111597, Y=0.6369575362013932, Z=0.6627439307500357]->[X=-0.44715655239362595, Y=0.8332957749253644, Z=0.3273923501593971]; previous? out next? out
   [junit4]   1>  [A=0.39659926756283254, B=0.5121429060646976, C=-0.7618521278674956, D=0.0, side=1.0]: [X=-0.44715655239362595, Y=0.8332957749253644, Z=0.3273923501593971]->[X=0.33024322515264537, Y=0.6945246730529289, Z=0.6387986432043298]; previous? out next? out
   [junit4]   1>  [A=-0.3812197352639907, B=-0.5210928300537263, C=0.763631963652551, D=0.0, side=1.0]: [X=0.33024322515264537, Y=0.6945246730529289, Z=0.6387986432043298]->[X=-0.1699323603224724, Y=0.8516746480592872, Z=0.4963385521664198]; previous? out next? out
   [junit4]   1>  [A=0.3564935302675921, B=0.5225100222955387, C=-0.7745293018847416, D=0.0, side=1.0]: [X=-0.1699323603224724, Y=0.8516746480592872, Z=0.4963385521664198]->[X=0.2654788898359613, Y=0.7380222309164597, Z=0.6200740473100581]; previous? out next? out
   [junit4]   1>  [A=0.9610409564286931, B=-0.2538849893053205, C=-0.10928262566419222, D=0.0, side=1.0]: [X=0.2654788898359613, Y=0.7380222309164597, Z=0.6200740473100581]->[X=0.17279348371564082, Y=0.24422965662722748, Z=0.9521675605930696]; previous? out next? out
   [junit4] ERROR   0.04s | GeoPolygonTest.testPolygonFactoryCase1 <<<
   [junit4]    > Throwable #1: java.lang.IllegalArgumentException: Polygon is not concave: Point [X=0.39285411191111597, Y=0.6369575362013932, Z=0.6627439307500357] 
      Edge [A=0.9444789194829755, B=-0.31589995244017205, C=-0.09037029766780857, D=0.0, side=1.0]

What is happening:
(1) All the edges have the correct relationships with their adjoining points.
(2) The planes constructed for GeoConcavePolygon are all consisted, sidedness-wise, with the plane that fails.
(3) The failure is due to a point on one side of the concave polygon that is on the wrong side of the plane across from it.
(4) The implication is that the complement polygon is larger than 180 degrees in at least one direction, even though all its points have a concave relationship with their adjacent edge points.

No solution in mind yet.


> Add Polygon... variant of newPolygonQuery() to Geo3DPoint
> ---------------------------------------------------------
>
>                 Key: LUCENE-7173
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7173
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: modules/spatial3d
>    Affects Versions: master
>            Reporter: Karl Wright
>            Assignee: Karl Wright
>             Fix For: master
>
>         Attachments: LUCENE-7173.patch
>
>
> We need to add the Polygon... variant of newPolygonQuery() to Geo3DPoint to support holes and also bring the Geo3DPoint API into agreement with the 2D API's.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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