private static boolean isStraightLine(double @NotNull [] xPoints, double @NotNull [] yPoints, int nLine, int nPoints) {
    double x1 = xPoints[nLine % nPoints];
    double y1 = yPoints[nLine % nPoints];
    double x2 = xPoints[(nLine + 1) % nPoints];
    double y2 = yPoints[(nLine + 1) % nPoints];
    return x1 == x2 || y1 == y2;
  }
private static boolean isStraightLine(double @NotNull [] xPoints, double @NotNull [] yPoints, int nLine, int nPoints)