AreaOfInterest extends GraphicalContext<BorderPane> { static int orientation(final Point2D p1, final Point2D p2, final Point2D p3) { final int val = (int) ((p2.getY() - p1.getY()) * (p3.getX() - p2.getX()) - (p2.getX() - p1.getX()) * (p3.getY() - p2.getY())); if (val == 0) { return 0; } return (val > 0) ? 1 : -1; } AreaOfInterest(final GazePlay gazePlay, final Stats stats); @Override ObservableList<Node> getChildren();  }
@Test void shouldCalculateOrientation() { assertEquals(0, AreaOfInterest.orientation( new Point2D(0, 0), new Point2D(1, 1), new Point2D(2, 2) )); assertEquals(1, AreaOfInterest.orientation( new Point2D(2, 5), new Point2D(1, 2), new Point2D(0, 0) )); assertEquals(-1, AreaOfInterest.orientation( new Point2D(0, 0), new Point2D(1, 2), new Point2D(2, 5) )); }