@Test public void testIntersectionOfLineWithLineSegmentWhereIntersectionIsNotPartOfLineSegment() { Point3D p2 = new Point3D(8, 2, 6); Point3D p3 = new Point3D(0, 9, 1); Point3D p4 = new Point3D(5, 7, 2); Point3D intersect; Line3D l1 = new Line3D(p2, p3); Line3D l2 = new Line3D(p2, p4); Line3DSegment ls1 = new Line3DSegment(l2.getPoint(0.01), p4); intersect = Geometry3DUtils.intersectionOfTwoLines(l1, ls1); assertEquals(null, intersect); }
@Test public void testIntersectionOfLineWithLineSegmentWhereIntersectionsExists() { Point3D p1 = new Point3D(3, 4, 5); Point3D p2 = new Point3D(8, 2, 6); Point3D p3 = new Point3D(0, 9, 1); Point3D intersect; Line3D l1 = new Line3D(p2, p3); Line3D l2 = new Line3D(p1, p2); Line3DSegment ls1 = new Line3DSegment(p1, l2.getPoint(3)); intersect = Geometry3DUtils.intersectionOfTwoLines(l1, ls1); assertEquals(p2, intersect); }