use of net.sf.latexdraw.model.api.shape.Line in project latexdraw by arnobl.
the class TestLine method testGetIntersection.
@Test
public void testGetIntersection() {
final Line line2 = ShapeFactory.INST.createLine(72, -981, 0, 0);
line.setLine(-237, 17, 13, -82);
line.updateAandB();
final Point pt = line.getIntersection(line2);
assertNotNull(pt);
assertEqualsDouble(5.809358228, pt.getX());
assertEqualsDouble(-79.152505858, pt.getY());
}
use of net.sf.latexdraw.model.api.shape.Line in project latexdraw by arnobl.
the class TestLine method testGetPerpendicularLineDiag.
@Test
public void testGetPerpendicularLineDiag() {
line.setLine(1, 1, 2, 2);
line.updateAandB();
final Line line2 = line.getPerpendicularLine(ShapeFactory.INST.createPoint());
assertNotNull(line2);
assertEqualsDouble(0d, line2.getB());
assertEqualsDouble(-1d, line2.getA());
}
use of net.sf.latexdraw.model.api.shape.Line in project latexdraw by arnobl.
the class TestArrow method testGetArrowLine.
@Test
public void testGetArrowLine() {
final Line line = ShapeFactory.INST.createLine(1d, 2d, 3d, 4d);
when(arrowable.getArrowLine(0)).thenReturn(line);
when(arrowable.getArrowIndex(arrow)).thenReturn(0);
assertEquals(line, arrow.getArrowLine());
}
use of net.sf.latexdraw.model.api.shape.Line in project latexdraw by arnobl.
the class TestCircleArc method testGetArrowLineArrow1StartGreaterEnd.
@Theory
public void testGetArrowLineArrow1StartGreaterEnd(@ArcData final CircleArc shape) {
shape.setPosition(0d, 0d);
shape.setWidth(10d);
shape.setAngleStart(Math.PI * 1.22);
shape.setAngleEnd(Math.PI * 0.98);
shape.setArrowStyle(ArrowStyle.RIGHT_ARROW, 1);
final Line line = shape.getArrowLine(1);
assertTrue(line.getX1() < line.getX2());
assertTrue(line.getY1() < line.getY2());
}
use of net.sf.latexdraw.model.api.shape.Line in project latexdraw by arnobl.
the class TestCircleArc method testGetArrowLineArrow0StartGreaterEnd.
@Theory
public void testGetArrowLineArrow0StartGreaterEnd(@ArcData final CircleArc shape) {
shape.setPosition(0d, 0d);
shape.setWidth(10d);
shape.setAngleStart(Math.PI * 1.22);
shape.setAngleEnd(Math.PI * 0.98);
shape.setArrowStyle(ArrowStyle.RIGHT_ARROW, 0);
final Line line = shape.getArrowLine(0);
assertTrue(line.getX1() < line.getX2());
assertTrue(line.getY1() > line.getY2());
}
Aggregations