Example usage for javafx.geometry Point2D add

List of usage examples for javafx.geometry Point2D add

Introduction

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

Prototype

public Point2D add(Point2D point) 

Source Link

Document

Returns a point with the coordinates of the specified point added to the coordinates of this point.

Usage

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 ww  w  . j  a  v a2  s  .c  om
    if (getPointSideOfLine(point, lineStart,
            lineStart.add(vecStartToEndRotated)) == PointPosition.LEFT_OF_THE_LINE) {
        return false;
    }
    return true;
}