commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (Resolved) (JIRA)" <>
Subject [jira] [Resolved] (MATH-668) Polygon difference function produces erroneous results with certain polygons
Date Fri, 20 Apr 2012 19:20:37 GMT


Luc Maisonobe resolved MATH-668.

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

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:
>             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:,
>   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:!default.jspa
For more information on JIRA, see:


View raw message