private IntObjectMap<List<MutableCoordinateSequence>> sliceX(CoordinateSequence segment) {
    double leftLimit = -buffer;
    double rightLimit = 1 + buffer;
    IntObjectMap<List<MutableCoordinateSequence>> newGeoms = Hppc.newIntObjectHashMap();
    IntObjectMap<MutableCoordinateSequence> xSlices = Hppc.newIntObjectHashMap();
    int end = segment.size() - 1;
    for (int i = 0; i < end; i++) {
      double ax = segment.getX(i);
      double ay = segment.getY(i);
      double bx = segment.getX(i + 1);
      double by = segment.getY(i + 1);

      double minX = Math.min(ax, bx);
      double maxX = Math.max(ax, bx);

      int startX = (int) Math.floor(minX - neighborBuffer);
      int endX = (int) Math.floor(maxX + neighborBuffer);

      // for each column this segment crosses
      for (int x = startX; x <= endX; x++) {
        double axTile = ax - x;
        double bxTile = bx - x;
        MutableCoordinateSequence slice = xSlices.get(x);
        if (slice == null) {
          xSlices.put(x, slice = new MutableCoordinateSequence());
          List<MutableCoordinateSequence> newGeom = newGeoms.get(x);
          if (newGeom == null) {
            newGeoms.put(x, newGeom = new ArrayList<>());
          }
          newGeom.add(slice);
        }

        boolean exited = false;

        if (axTile < leftLimit) {
          // ---|-->  | (line enters the clip region from the left)
          if (bxTile > leftLimit) {
            intersectX(slice, axTile, ay, bxTile, by, leftLimit);
          }
        } else if (axTile > rightLimit) {
          // |  <--|--- (line enters the clip region from the right)
          if (bxTile < rightLimit) {
            intersectX(slice, axTile, ay, bxTile, by, rightLimit);
          }
        } else {
          // | --> | (line starts inside)
          slice.addPoint(axTile, ay);
        }
        if (bxTile < leftLimit && axTile >= leftLimit) {
          // <--|---  | or <--|-----|--- (line exits the clip region on the left)
          intersectX(slice, axTile, ay, bxTile, by, leftLimit);
          exited = true;
        }
        if (bxTile > rightLimit && axTile <= rightLimit) {
          // |  ---|--> or ---|-----|--> (line exits the clip region on the right)
          intersectX(slice, axTile, ay, bxTile, by, rightLimit);
          exited = true;
        }

        if (!area && exited) {
          xSlices.remove(x);
        }
      }
    }
    // add the last point
    double ax = segment.getX(segment.size() - 1);
    double ay = segment.getY(segment.size() - 1);
    int startX = (int) Math.floor(ax - neighborBuffer);
    int endX = (int) Math.floor(ax + neighborBuffer);

    for (int x = startX - 1; x <= endX + 1; x++) {
      double axTile = ax - x;
      MutableCoordinateSequence slice = xSlices.get(x);
      if (slice != null && axTile >= leftLimit && axTile <= rightLimit) {
        slice.addPoint(axTile, ay);
      }
    }

    // close the polygons if endpoints are not the same after clipping
    if (area) {
      for (IntObjectCursor<MutableCoordinateSequence> cursor : xSlices) {
        cursor.value.closeRing();
      }
    }
    newGeoms.removeAll((x, value) -> {
      int wrapped = wrapX(x, maxTilesAtThisZoom);
      return !extents.testX(wrapped);
    });
    return newGeoms;
  }
Returns a map from X coordinate to segments of this geometry that cross the vertical column formed by all tiles
where {@code x=x}.
planetiler-core/src/main/java/com/onthegomap/planetiler/render/TiledGeometry.java