Luc Maisonobe created MATH-1266: ----------------------------------- Summary: split and side methods may be inconsistent in BSP trees Key: MATH-1266 URL: https://issues.apache.org/jira/browse/MATH-1266 Project: Commons Math Issue Type: Bug Affects Versions: 3.5 Reporter: Luc Maisonobe Assignee: Luc Maisonobe
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, -0.7357230887208355), tolerance); SubCircle sub = new SubCircle(new Circle(new Vector3D(2.1793884139073498E-4, 0.9790647032675541, -0.20354915700704285), tolerance), new ArcsSet(4.7121441684170700, 4.7125386635004760, tolerance)); SplitSubHyperplane<Sphere2D> split = sub.split(hyperplane); Assert.assertNotNull(split.getMinus()); Assert.assertNull(split.getPlus()); Assert.assertEquals(Side.MINUS, sub.side(hyperplane)); } {code} 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 (v6.3.4#6332)