code: public static Geometry drapeMultiPolygon(MultiPolygon polygons, Geometry triangles, STRtree sTRtree) {
          GeometryFactory factory = polygons.getFactory();         
          //Split the triangles in lines to perform all intersections
          Geometry triangleLines = LinearComponentExtracter.getGeometry(triangles, true);
          int nbPolygons = polygons.getNumGeometries();
          Polygon[] polygonsDiff = new Polygon[nbPolygons];
          for (int i = 0; i < nbPolygons; i++) {
              polygonsDiff[i] = processPolygon((Polygon) polygons.getGeometryN(i), triangleLines, factory);
          }
          Geometry diffExt = factory.createMultiPolygon(polygonsDiff);
          CoordinateSequenceFilter drapeFilter = new DrapeFilter(sTRtree);
          diffExt.apply(drapeFilter);
          return diffExt;
      }
docs: Drape a multilinestring to a set of triangles
  @param polygons
  @param triangles
  @param sTRtree
  @return