@Test
public void testGetIntersectionSegmentHoriz() {
ILine line2 = ShapeFactory.createLine(0, 0, 1, 0);
line.setLine(0, -10, 0, 10);
line.updateAandB();
IPoint pt = line2.getIntersectionSegment(line);
assertNotNull(pt);
assertEquals(0., pt.getX(), 0.1);
assertEquals(0., pt.getY(), 0.1);
line2 = ShapeFactory.createLine(0.01, 0, 1, 0);
line.setLine(0, -10, 0, 10);
line.updateAandB();
pt = line2.getIntersectionSegment(line);
assertNull(pt);
line2 = ShapeFactory.createLine(-0.01, 0, -1, 0);
line.setLine(0, -10, 0, 10);
line.updateAandB();
pt = line2.getIntersectionSegment(line);
assertNull(pt);
line2 = ShapeFactory.createLine(0, 10.01, 1, 11);
line.setLine(0, -10, 0, 10);
line.updateAandB();
pt = line2.getIntersectionSegment(line);
assertNull(pt);
line2 = ShapeFactory.createLine(0, -10.01, 1, -11);
line.setLine(0, -10, 0, 10);
line.updateAandB();
pt = line2.getIntersectionSegment(line);
assertNull(pt);
line2 = ShapeFactory.createLine(0, 0, 1, 0);
line.setLine(1, -10, 1, 10);
line.updateAandB();
pt = line2.getIntersectionSegment(line);
assertNotNull(pt);
assertEquals(1., pt.getX(), 0.1);
assertEquals(0., pt.getY(), 0.1);
line2 = ShapeFactory.createLine(1, 2, -1, 0);
line.setLine(0., -10, 0., 10);
line.updateAandB();
pt = line2.getIntersectionSegment(line);
assertNotNull(pt);
assertEquals(0., pt.getX(), 0.1);
assertEquals(1., pt.getY(), 0.1);
}