Search in sources :

Example 16 with Line

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());
}
Also used : Line(net.sf.latexdraw.model.api.shape.Line) Point(net.sf.latexdraw.model.api.shape.Point) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 17 with Line

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());
}
Also used : Line(net.sf.latexdraw.model.api.shape.Line) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 18 with Line

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());
}
Also used : Line(net.sf.latexdraw.model.api.shape.Line) Test(org.junit.Test)

Example 19 with Line

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());
}
Also used : Line(net.sf.latexdraw.model.api.shape.Line) Theory(org.junit.experimental.theories.Theory)

Example 20 with Line

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());
}
Also used : Line(net.sf.latexdraw.model.api.shape.Line) Theory(org.junit.experimental.theories.Theory)

Aggregations

Line (net.sf.latexdraw.model.api.shape.Line)21 Test (org.junit.Test)12 Point (net.sf.latexdraw.model.api.shape.Point)10 HelperTest (net.sf.latexdraw.HelperTest)7 Theory (org.junit.experimental.theories.Theory)4 Rotate (javafx.scene.transform.Rotate)1 SVGMarkerElement (net.sf.latexdraw.parser.svg.SVGMarkerElement)1