code: public static Geometry drapePolygon(Polygon p, Geometry triangles, STRtree sTRtree) {
          GeometryFactory factory = p.getFactory();
          //Split the triangles in lines to perform all intersections
          Geometry triangleLines = LinearComponentExtracter.getGeometry(triangles, true);        
          Polygon splittedP = processPolygon(p, triangleLines, factory);
          CoordinateSequenceFilter drapeFilter = new DrapeFilter(sTRtree);
          splittedP.apply(drapeFilter);
          return splittedP;
      }
docs: Drape a polygon on a set of triangles
  @param p
  @param triangles
  @param sTRtree
  @return