Example usage for javafx.scene.shape Line getEndY

List of usage examples for javafx.scene.shape Line getEndY

Introduction

In this page you can find the example usage for javafx.scene.shape Line getEndY.

Prototype

public final double getEndY() 

Source Link

Usage

From source file:de.pixida.logtest.designer.automaton.LineIntersector.java

static Point2D calculateIntersection(final Point2D point, final Point2D vec, final Line line) {
    final Point2D q = new Point2D(line.getStartX(), line.getStartY());
    final Point2D w = new Point2D(line.getEndX(), line.getEndY()).subtract(q);

    // q + t1 * w = point + t2 * vec => q - point = (vec w) (t2 -t1)^T
    final double det = det2x2LineWiseDefined(vec.getX(), w.getX(), vec.getY(), w.getY());
    final double epsilon = 1E-5;
    if (Math.abs(det) < epsilon) {
        return null;
    }//from  ww  w  . ja  v  a 2 s. com
    final double detInv = 1.0 / det;
    final double t2 = det2x2LineWiseDefined(q.getX() - point.getX(), w.getX(), q.getY() - point.getY(),
            w.getY()) * detInv;

    final Point2D intersection = vec.multiply(t2).add(point);
    return intersection;
}

From source file:de.pixida.logtest.designer.automaton.LineIntersector.java

static boolean checkIfPointIsOnTheLine(final Point2D point, final Line line) {
    final Point2D lineStart = new Point2D(line.getStartX(), line.getStartY());
    final Point2D lineEnd = new Point2D(line.getEndX(), line.getEndY());
    final Point2D vecEndToStart = lineEnd.subtract(lineStart);
    final Point2D vecStartToEnd = lineStart.subtract(lineEnd);
    final Point2D vecEndToStartRotated = ROATE_90_DEGREES_COUNTERCLOCKWISE.transform(vecEndToStart);
    final Point2D vecStartToEndRotated = ROATE_90_DEGREES_COUNTERCLOCKWISE.transform(vecStartToEnd);
    if (getPointSideOfLine(point, lineEnd,
            lineEnd.add(vecEndToStartRotated)) == PointPosition.LEFT_OF_THE_LINE) {
        return false;
    }//  w w w. jav a  2  s.co m
    if (getPointSideOfLine(point, lineStart,
            lineStart.add(vecStartToEndRotated)) == PointPosition.LEFT_OF_THE_LINE) {
        return false;
    }
    return true;
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox box = new VBox();
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);//from  ww  w .  j a va2  s.  c  o m

    Line line = new Line();
    line.setStartX(0.0f);
    line.setStartY(0.0f);
    line.setEndX(100.0f);
    line.setEndY(100.0f);

    System.out.println(line.getEndY());

    box.getChildren().add(line);

    stage.setScene(scene);
    stage.show();
}