You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Luc Maisonobe (Resolved) (JIRA)" <ji...@apache.org> on 2012/04/20 21:20:37 UTC

[jira] [Resolved] (MATH-668) Polygon difference function produces erroneous results with certain polygons

     [ https://issues.apache.org/jira/browse/MATH-668?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luc Maisonobe resolved MATH-668.
--------------------------------

       Resolution: Not A Problem
    Fix Version/s:     (was: 3.1)
                   3.0

I agree with Thomas analyses.

Concerning the difference2 case, the two points are explained by the vertical line at x = 5.0 which comes from the outer shape. The internal representation is a BSP tree and one of this part of the outer boundary creates an hyperplane that splits the inner triangle. When the boundary representation is rebuilt, the two segments are glued together and the points appear there. There is no post-processing that simplifies the representation afterwards.

Concerning the circle test, I guess you mixed the arrays. What is really in the code is that the vertices2 array is build first from outer circle and the vertices1 array is built afterwards from inner circle. So you are really subtracting a big disk from a smaller one. As Thomas explained, computing set2 minus set1 give the expected two boundaries. Another possible change is to build the circles clockwise instead of counter-clockwise, and in this case the two regions are infinite wich a whole at the center, then subtracting set2 from set1 returns a disk with a hole.
                
> Polygon difference function produces erroneous results with certain polygons
> ----------------------------------------------------------------------------
>
>                 Key: MATH-668
>                 URL: https://issues.apache.org/jira/browse/MATH-668
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>            Reporter: Curtis Jensen
>            Assignee: Luc Maisonobe
>              Labels: difference, math,, polygon,
>             Fix For: 3.0
>
>         Attachments: PolygonsSetCircleTest.java, PolygonsSetTest.java
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> For some polygons, the difference function produces erroneous results.  This appears to happen when one polygon is completely encompassed in another, and the outer has multiple concave sections.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira