code: static Turn[] turns(Point2d[] points) {
  
          final Turn[] turns = new Turn[points.length];
  
          // cycle of size 6 is [1,2,3,4,5,6] not closed
          for (int i = 1; i <= points.length; i++) {
              Point2d prevXy = points[i - 1];
              Point2d currXy = points[i % points.length];
              Point2d nextXy = points[(i + 1) % points.length];
              int parity = (int) Math.signum(det(prevXy.x, prevXy.y,
                                                 currXy.x, currXy.y,
                                                 nextXy.x, nextXy.y));
              if (parity == 0) return null;
              turns[i % points.length] = parity < 0 ? Right : Turn.Left;
          }
  
          return turns;
      }
docs: Determine the turns in the polygon formed of the provided coordinates.
  
  @param points polygon points
  @return array of turns (left, right) or null if a parallel line was found