List of usage examples for javafx.scene.shape Line getEndX
public final double getEndX()
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; }/*w w w .j a va 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; }//from w w w .ja v a2 s. c o 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 . java2 s . c om*/ Line line = new Line(); line.setStartX(0.0f); line.setStartY(0.0f); line.setEndX(100.0f); line.setEndY(100.0f); System.out.println(line.getEndX()); box.getChildren().add(line); stage.setScene(scene); stage.show(); }
From source file:view.FXApplicationController.java
private void calculatePercentageKComplex() { double percentageSum = 0.0; RangeSet<Double> rangeset = TreeRangeSet.create(); for (int i = 0; i < lines.size(); i++) { Line line = lines.get(i); double lengthOfLine; Range r = Range.closed(// ww w .j a v a 2 s .c om Math.min(line.getLayoutX(), line.getEndX() + line.getLayoutX()) / xAxis.getWidth() * 100. - 1e-9, Math.max(line.getLayoutX(), line.getEndX() + line.getLayoutX()) / xAxis.getWidth() * 100. + 1e-9); rangeset.add(r); } percentageSum = rangeset.asRanges().stream().mapToDouble(e -> (e.upperEndpoint() - e.lowerEndpoint())) .sum(); kComplexLabel.setText("K-Complex: " + Math.round(percentageSum) + "%"); }