Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MathIllegalStateException on small SphericalPolygonsSet instances #42

jerdmanGH opened this issue Jul 23, 2018 · 1 comment

MathIllegalStateException on small SphericalPolygonsSet instances #42

jerdmanGH opened this issue Jul 23, 2018 · 1 comment


Copy link

@jerdmanGH jerdmanGH commented Jul 23, 2018

It is possible to generate a MathIllegalStateException when using very small SphericalPolygonsSet instances. See code below to reproduce.

        S2Point[] s2pA = new S2Point[]{
                new S2Point(new Vector3D(0.1504230736114679, -0.6603084987333554, 0.7357754993377947)),
                new S2Point(new Vector3D(0.15011191112224423, -0.6603400871954631, 0.7358106980616113)),
                new S2Point(new Vector3D(0.15008035620222715, -0.6605195692153062, 0.7356560238085725)),
                new S2Point(new Vector3D(0.1503914563063968, -0.6604879854490165, 0.7356208472763267))
        final SphericalPolygonsSet spsA = new SphericalPolygonsSet(1E-100, s2pA);
Copy link

@maisonobe maisonobe commented Aug 12, 2018

The test case triggers two different problems here.

  • When the tolerance is set to 1E-100 (like in the example), then the BSP tree built is wrong from the beginning: one of the node that should be an 'outside' leaf node is in fact split into two leaf nodes, one of which being labelled as 'inside' (this can be seen by printing the output of RegionDumper.dump(spsA))
  • When the tolerance is set to slightly below 9.05e-16 (for example 9.0e-16), then the BSP tree is built correctly, but computing the size falis with the MathIllegalStateException.

I have created a branch (issue-42) to work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants