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

Karl Wright commented on LUCENE-8171:
-------------------------------------

The code in question does call the improved two-vector cross-product Vector 
constructor, but it makes no attempt to optimize the numerically best choice of 
vectors (there are in fact two choices for how those are chosen):

{code}
  /** Construct a sided plane from three points.
   */
  public static SidedPlane constructNormalizedThreePointSidedPlane(final Vector 
insidePoint,
    final Vector point1, final Vector point2, final Vector point3) {
    try {
      final Vector planeNormal = new Vector(
        new Vector(point1.x - point2.x, point1.y - point2.y, point1.z - 
point2.z),
        new Vector(point2.x - point3.x, point2.y - point3.y, point2.z - 
point3.z));
      return new SidedPlane(insidePoint, planeNormal, 
-planeNormal.dotProduct(point2));
    } catch (IllegalArgumentException e) {
      return null;
    }
  }
{code}

The obvious improvement is to try the other one if the first try doesn't work.


> Geo3dShapeWGS84ModelRectRelationTest test failure
> -------------------------------------------------
>
>                 Key: LUCENE-8171
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8171
>             Project: Lucene - Core
>          Issue Type: Test
>            Reporter: Adrien Grand
>            Assignee: Karl Wright
>            Priority: Major
>         Attachments: LUCENE-8171.patch
>
>
> It reproduces with {{ant test  
> -Dtestcase=Geo3dShapeWGS84ModelRectRelationTest 
> -Dtests.method=testGeoPathRect -Dtests.seed=1257A8E5FDB03055 
> -Dtests.slow=true -Dtests.locale=sq -Dtests.timezone=America/Monterrey 
> -Dtests.asserts=true -Dtests.file.encoding=ISO-8859-1}}:
> {noformat}
>    [junit4] Suite: 
> org.apache.lucene.spatial.spatial4j.Geo3dShapeWGS84ModelRectRelationTest
>    [junit4]   2> NOTE: reproduce with: ant test  
> -Dtestcase=Geo3dShapeWGS84ModelRectRelationTest 
> -Dtests.method=testGeoPathRect -Dtests.seed=1257A8E5FDB03055 
> -Dtests.slow=true -Dtests.locale=sq -Dtests.timezone=America/Monterrey 
> -Dtests.asserts=true -Dtests.file.encoding=ISO-8859-1
>    [junit4] ERROR   0.69s | 
> Geo3dShapeWGS84ModelRectRelationTest.testGeoPathRect <<<
>    [junit4]    > Throwable #1: java.lang.RuntimeException: Couldn't come up 
> with a plane through three points that included the fourth
>    [junit4]    >      at 
> __randomizedtesting.SeedInfo.seed([1257A8E5FDB03055:5B0183E4DD0431E2]:0)
>    [junit4]    >      at 
> org.apache.lucene.spatial3d.geom.GeoStandardPath$SegmentEndpoint.<init>(GeoStandardPath.java:603)
>    [junit4]    >      at 
> org.apache.lucene.spatial3d.geom.GeoStandardPath.done(GeoStandardPath.java:186)
>    [junit4]    >      at 
> org.apache.lucene.spatial3d.geom.GeoStandardPath.<init>(GeoStandardPath.java:68)
>    [junit4]    >      at 
> org.apache.lucene.spatial3d.geom.GeoPathFactory.makeGeoPath(GeoPathFactory.java:39)
>    [junit4]    >      at 
> org.apache.lucene.spatial.spatial4j.Geo3dShapeFactory$Geo3dLineStringBuilder.build(Geo3dShapeFactory.java:285)
>    [junit4]    >      at 
> org.apache.lucene.spatial.spatial4j.ShapeRectRelationTestCase$4.generateRandomShape(ShapeRectRelationTestCase.java:179)
>    [junit4]    >      at 
> org.locationtech.spatial4j.shape.RectIntersectionTestHelper.testRelateWithRectangle(RectIntersectionTestHelper.java:98)
>    [junit4]    >      at 
> org.apache.lucene.spatial.spatial4j.ShapeRectRelationTestCase.testGeoPathRect(ShapeRectRelationTestCase.java:199)
>    [junit4]    >      at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    [junit4]    >      at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>    [junit4]    >      at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>    [junit4]    >      at 
> java.base/java.lang.reflect.Method.invoke(Method.java:564)
>    [junit4]    >      at java.base/java.lang.Thread.run(Thread.java:844)
>    [junit4]   2> NOTE: test params are: codec=Lucene70, 
> sim=Asserting(org.apache.lucene.search.similarities.AssertingSimilarity@3595d2c2),
>  locale=sq, timezone=America/Monterrey
>    [junit4]   2> NOTE: Linux 4.4.0-104-generic amd64/Oracle Corporation 9.0.1 
> (64-bit)/cpus=12,threads=1,free=134432384,total=260046848
>    [junit4]   2> NOTE: All tests run in this JVM: 
> [Geo3dShapeWGS84ModelRectRelationTest]
>    [junit4] Completed [1/1 (1!)] in 0.86s, 1 test, 1 error <<< FAILURES!
> {noformat}



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

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

Reply via email to