Hi, I'm working with PolyhedronsSets. To get a basic understanding I set up a cube and tried to intersect it diagonally. (apache.commons.math 3.6.1) When debugging the following test, it looks to me, that Vector(0,0,0) is ignored, since it is on the border. Hmm, any ideas. Regards. Sven
class PolyhedronsSetTest { public static final double DEFAULT_TOLERANCE = 1.0e-10; private PolyhedronsSet cube; @BeforeEach void setup() { Vector3D[] verts = new Vector3D[8]; // setting up a cube. length edge 1 verts[0] = new Vector3D( 1, 0, 0 ); verts[1] = new Vector3D( 1, 1, 0 ); verts[2] = new Vector3D( 1, 1, 1 ); verts[3] = new Vector3D( 1, 0, 1 ); verts[4] = new Vector3D( 0, 0, 0 ); verts[5] = new Vector3D( 0, 1, 0 ); verts[6] = new Vector3D( 0, 1, 1 ); verts[7] = new Vector3D( 0, 0, 1 ); int[][] faces = new int[6][]; faces[0] = new int[] { 0, 4, 5, 1 }; // bottom faces[1] = new int[] { 3, 2, 6, 7 }; // top faces[2] = new int[] { 1, 5, 6, 2 }; // right faces[3] = new int[] { 5, 4, 7, 6 }; // back faces[4] = new int[] { 0, 3, 7, 4 }; // left faces[5] = new int[] { 0, 1, 2, 3 }; // front cube = new PolyhedronsSet( Arrays.asList( verts ), Arrays.asList( faces ), DEFAULT_TOLERANCE ); } @Test void intersectCubeDiagonally() { Vector3D start = new Vector3D( -1, -1, -1 ); Vector3D end = new Vector3D( 1, 1, 1 ); Line line = new Line( start, end, DEFAULT_TOLERANCE ); Vector3D origin = new Vector3D( 0.0, 0.0, 0.0 ); SubHyperplane< Euclidean3D > r = cube.firstIntersection( start, line ); assertTrue( r != null ); Plane plane = (Plane) r.getHyperplane(); Vector3D firstIntersection = plane.intersection( line ); assertVectorEquals( origin, firstIntersection ); } public void assertVectorEquals( Vector3D lhs, Vector3D rhs ) { assertEquals( lhs.getX(), rhs.getX(), DEFAULT_TOLERANCE ); assertEquals( lhs.getY(), rhs.getY(), DEFAULT_TOLERANCE ); assertEquals( lhs.getZ(), rhs.getZ(), DEFAULT_TOLERANCE ); } } --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org