List of usage examples for javafx.geometry Point2D multiply
public Point2D multiply(double factor)
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 w w w . jav a2 s . c om*/ 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; }