List of usage examples for javafx.geometry Point2D subtract
public Point2D subtract(Point2D point)
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 . j a v a 2 s . c o m if (getPointSideOfLine(point, lineStart, lineStart.add(vecStartToEndRotated)) == PointPosition.LEFT_OF_THE_LINE) { return false; } return true; }
From source file:de.pixida.logtest.designer.automaton.BaseNode.java
protected void processMoveOperation(final Point2D oldPosition, final Point2D newPosition) { final Point2D relativeMovement = newPosition.subtract(oldPosition); this.incomingEdges.forEach(edge -> { edge.onTargetNodeMoved(relativeMovement); });/*ww w . j ava 2 s . c o m*/ this.outgoingEdges.forEach(edge -> { edge.onSourceNodeMoved(relativeMovement); }); this.realignEdgesAfterMoveOrResize(); }
From source file:de.pixida.logtest.designer.automaton.RectangularNode.java
@Override protected Point2D getConcreteDockingPointForConnection(final Point2D otherEnd) { final Point2D sourceToCenter = otherEnd.subtract(this.getCenterPoint()); final List<Intersection> intersections = LineIntersector.calculateIntersections(otherEnd, sourceToCenter, this.getBoundingLines()); if (intersections.isEmpty()) { return this.getCenterPoint(); }//from w ww . j a va 2 s.c om return intersections.get(0).getIntersection(); }