commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (JIRA)" <>
Subject [jira] [Resolved] (MATH-1266) split and side methods may be inconsistent in BSP trees
Date Sun, 06 Sep 2015 18:25:45 GMT


Luc Maisonobe resolved MATH-1266.
       Resolution: Fixed
    Fix Version/s: 3.6

Fixed in git repository (commit 2091cfb for branch master, commit 50c5eae for branch MATH_3_X)

> split and side methods may be inconsistent in BSP trees
> -------------------------------------------------------
>                 Key: MATH-1266
>                 URL:
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.5
>            Reporter: Luc Maisonobe
>            Assignee: Luc Maisonobe
>             Fix For: 4.0, 3.6
> In BSP trees, there are two related methods dealing with the relative position of a sub-hyperplane
and an hyperplane: side and split.
> sub.side(hyperplane) returns an enumerate (PLUS, MINUS, BOTH, HYPER) telling the relative
position of the syb-hyperplane with respect to the hyperplane.
> sub.split(hyperplane) splits the sub-hyperplane in two parts, one on the plus side of
the hyperplane and one on the minus side of the hyperplane.
> These methods should be consistent, i.e. when side returns BOTH, then split should return
two non-null parts. This fails in the following case:
> {code}
>     @Test
>     public void testSideSplitConsistency() {
>         double tolerance = 1.0e-6;
>         Circle hyperplane = new Circle(new Vector3D(9.738804529764676E-5, -0.6772824575010357,
>                                        tolerance);
>         SubCircle sub = new SubCircle(new Circle(new Vector3D(2.1793884139073498E-4,
0.9790647032675541, -0.20354915700704285),
>                                                  tolerance),
>                                       new ArcsSet(4.7121441684170700, 4.7125386635004760,
>         SplitSubHyperplane<Sphere2D> split = sub.split(hyperplane);
>         Assert.assertNotNull(split.getMinus());
>         Assert.assertNull(split.getPlus());
>         Assert.assertEquals(Side.MINUS, sub.side(hyperplane));
>     }
> {code}
> Here, side returns BOTH but the plus part is null. This is due to the plus
> side being smaller than the tolerance (1.0e-6 here) and filtered out in the split methods
whereas it is not filtered out in the side method, which has a slightly different algorithm.
So instead of returning BOTH, side should return MINUS as it should filter out the too small
plus part.
> In fact, it is only one particular case, the same could occur in other spaces (Euclidean
or Spherical, and on various dimensions).

This message was sent by Atlassian JIRA

View raw message