use of net.sf.latexdraw.models.interfaces.shape.ILine in project latexdraw by arnobl.
the class ViewArrow method updatePath.
@Override
public void updatePath(final boolean isShadow) {
path.setStrokeLineCap(StrokeLineCap.BUTT);
path.getElements().clear();
path.fillProperty().unbind();
path.strokeWidthProperty().unbind();
path.getTransforms().clear();
ellipse.getTransforms().clear();
arc.getTransforms().clear();
GenericViewArrow.super.updatePath(isShadow);
final ILine line = arrow.getArrowLine();
final double lineAngle = (-line.getLineAngle() + Math.PI * 2d) % (Math.PI * 2d);
if (arrow.getArrowStyle() != ArrowStyle.NONE && !MathUtils.INST.equalsDouble(lineAngle, 0d)) {
final Rotate rotate = new Rotate(Math.toDegrees(lineAngle), 0d, 0d);
path.getTransforms().add(rotate);
ellipse.getTransforms().add(rotate);
arc.getTransforms().add(rotate);
}
}
use of net.sf.latexdraw.models.interfaces.shape.ILine in project latexdraw by arnobl.
the class TestILine method testGetPerpendicularLineVert.
@Test
public void testGetPerpendicularLineVert() {
line.setLine(0, 10, 0, -10);
line.updateAandB();
ILine line2 = line.getPerpendicularLine(ShapeFactory.INST.createPoint());
assertNotNull(line2);
assertEqualsDouble(0d, line2.getY1());
assertEqualsDouble(0d, line2.getY2());
}
use of net.sf.latexdraw.models.interfaces.shape.ILine in project latexdraw by arnobl.
the class TestILine method testGetIntersection.
@Test
public void testGetIntersection() {
ILine line2 = ShapeFactory.INST.createLine(72, -981, 0, 0);
line.setLine(-237, 17, 13, -82);
line.updateAandB();
IPoint pt = line.getIntersection(line2);
assertNotNull(pt);
assertEqualsDouble(5.809358228, pt.getX());
assertEqualsDouble(-79.152505858, pt.getY());
}
use of net.sf.latexdraw.models.interfaces.shape.ILine in project latexdraw by arnobl.
the class TestILine method testGetIntersectionHoriz.
@Test
public void testGetIntersectionHoriz() {
ILine line2 = ShapeFactory.INST.createLine(0, 0, 1, 0);
line.setLine(0, -10, 0, 10);
line.updateAandB();
IPoint pt = line2.getIntersection(line);
assertNotNull(pt);
assertEqualsDouble(0d, pt.getX());
assertEqualsDouble(0d, pt.getY());
}
use of net.sf.latexdraw.models.interfaces.shape.ILine in project latexdraw by arnobl.
the class TestILine method testGetIntersectionSegment.
@Test
public void testGetIntersectionSegment() {
ILine line2 = ShapeFactory.INST.createLine(0, 0, 1, 0);
line.setLine(1, 1, 0, -1);
line.updateAandB();
IPoint pt = line.getIntersectionSegment(line2);
assertNotNull(pt);
assertEqualsDouble(0.5, pt.getX());
assertEqualsDouble(0d, pt.getY());
}
Aggregations