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

Matt Juntunen commented on GEOMETRY-71:
---------------------------------------

I just added a follow-up pull request: 
https://github.com/apache/commons-geometry/pull/57.

I was able to remove nearly all usages of the {{BARYCENTER_EPS}} value in the 
tests, with two exceptions in {{RegionBSPTree2STest}}: one in the computation 
of the barycenter of France and the other in the circle test with the very 
small radius (0.0001). However, I was able to lower the epsilon value from 1e-2 
to 1e-5 so we have a considerably higher level of precision now.

I also updated the barycenter computation in {{RegionBSPTree1S}} to use the 
same weighted-barycenter approach as {{RegionBSPTree2S}}. They both now return 
null when no _unique_ barycenter exists.

Any objections to closing this issue after this PR is merged?

> Investigate Spherical Barycenter Accuracy
> -----------------------------------------
>
>                 Key: GEOMETRY-71
>                 URL: https://issues.apache.org/jira/browse/GEOMETRY-71
>             Project: Apache Commons Geometry
>          Issue Type: Bug
>            Reporter: Matt Juntunen
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> The current code for computing spherical barycenters in 
> {{ConvexArea2S.getBarycenter()}} seems to suffer from floating point accuracy 
> issues. The {{ConvexArea2STest.checkBarycenterConsistency()}} method checks 
> the consistency of the barycenter computation of a region by splitting the 
> region into two sections, computing the area and barycenter of each section, 
> and then computing the combined barycenter of the sections by adding the 
> barycenter of each scaled by its corresponding area. It is expected that the 
> combined barycenter computed in this way should equal the barycenter computed 
> for the region as a whole. However, in practice, a large epsilon value is 
> needed in the comparison in order for the tests to pass. We need to 
> investigate why this is the case.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to