Example usage for javafx.geometry Point2D distance

List of usage examples for javafx.geometry Point2D distance

Introduction

In this page you can find the example usage for javafx.geometry Point2D distance.

Prototype

public double distance(Point2D point) 

Source Link

Document

Computes the distance between this point and the specified point .

Usage

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

static List<Intersection> calculateIntersections(final Point2D point, final Point2D vec,
        final List<Line> lines) {
    Validate.notNull(point);/*from  w  ww . ja v a 2  s . c  o m*/
    Validate.notNull(vec);
    Validate.notNull(lines);

    final List<Intersection> results = new ArrayList<>();
    for (final Line line : lines) {
        final Point2D intersection = calculateIntersection(point, vec, line);
        if (intersection == null) {
            continue;
        }

        if (!checkIfPointIsOnTheLine(intersection, line)) {
            continue;
        }

        results.add(new Intersection(intersection, line, point.distance(intersection)));
    }

    Collections.sort(results, (r0, r1) -> Double.compare(r0.getDistance(), r1.getDistance()));

    return results;
}