code: private static void createShadowPolygons(Collection<Polygon> shadows, Coordinate[] coordinates, double[] shadow, GeometryFactory factory) {
          for (int i = 1; i < coordinates.length; i++) {
              Coordinate startCoord = coordinates[i - 1];
              Coordinate endCoord = coordinates[i];
              Coordinate nextEnd = moveCoordinate(endCoord, shadow);
              Coordinate nextStart = moveCoordinate(startCoord, shadow);
              Polygon polygon = factory.createPolygon(new Coordinate[]{startCoord,
                  endCoord, nextEnd,
                  nextStart, startCoord});
              if (polygon.isValid()) {                
                  shadows.add(polygon);
              }
          }
      }
docs: Create and collect shadow polygons.
  
  @param shadows
  @param coordinates
  @param shadow
  @param factory