* @param n number of points to consider in the array
* @param i index of the point to check (must be between 0 and n-1)
* @return true if the point is exactly between its neighbors
*/
private boolean pointIsBetween(final Vector2D[] loop, final int n, final int i) {
final Vector2D previous = loop[(i + n - 1) % n];
final Vector2D current = loop[i];
final Vector2D next = loop[(i + 1) % n];
final double dx1 = current.getX() - previous.getX();
final double dy1 = current.getY() - previous.getY();
final double dx2 = next.getX() - current.getX();
final double dy2 = next.getY() - current.getY();
final double cross = dx1 * dy2 - dx2 * dy1;
final double dot = dx1 * dx2 + dy1 * dy2;
final double d1d2 = FastMath.sqrt((dx1 * dx1 + dy1 * dy1) * (dx2 * dx2 + dy2 * dy2));
return (FastMath.abs(cross) <= (1.0e-6 * d1d2)) && (dot >= 0.0);
}