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

Karl Wright commented on LUCENE-8133:
-------------------------------------

Hmm.

There is code in Vector which is supposed to prevent that kind of thing from 
happening:

{code}
  public Vector(final Vector A, final Vector B) {
    // x = u2v3 - u3v2
    // y = u3v1 - u1v3
    // z = u1v2 - u2v1
    final double thisX = A.y * B.z - A.z * B.y;
    final double thisY = A.z * B.x - A.x * B.z;
    final double thisZ = A.x * B.y - A.y * B.x;
    final double magnitude = magnitude(thisX, thisY, thisZ);
    if (Math.abs(magnitude) < MINIMUM_RESOLUTION) {
      throw new IllegalArgumentException("Degenerate/parallel vector 
constructed");
    }
    final double inverseMagnitude = 1.0 / magnitude;
    this.x = thisX * inverseMagnitude;
    this.y = thisY * inverseMagnitude;
    this.z = thisZ * inverseMagnitude;
  }

  /** Compute a magnitude of an x,y,z value.
   */
  public static double magnitude(final double x, final double y, final double 
z) {
    return Math.sqrt(x*x + y*y + z*z);
  }
{code}

There is also code further up in GeoPolygonFactory which merges points that are 
too close together.  Both of these checks have to somehow not do the right 
thing for the situation in question to develop.  I'll research.

> Small polygon fails with misleading error:  Convex polygon has a side that is 
> more than 180 degrees
> ---------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-8133
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8133
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/spatial3d
>            Reporter: Ignacio Vera
>            Assignee: Karl Wright
>            Priority: Major
>         Attachments: LUCENE-8133.patch, LUCENE-8133.patch, 
> image-2018-01-22-12-52-21-656.png, image-2018-01-22-12-55-17-096.png
>
>
> Hi [~karl wright],
> I am trying to create a polygon that is valid but I am getting an error which 
> is probably incorrect. I think it is a problem with precision.
> I will attach a test.
>  



--
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