I have polygon geometries that represent building footprints in a shapefile and I want to extrude them according to an attribute "height" and turn them 3B objects as polyhedral surfaces via extrusion. For this purpose I am writing an extrusion function. I am using geotools to access and extract geometries and attributes from shapefile. I am creating top and bottom faces of buildings as polygon geometries but I could not generate vertical faces. I could not write a loop that traverse positions and create vertical faces as polygon geometries. I am stuck with it.
Here is the rest of my code after I extract polygons ;
List<Polygon> polygons = bb.getBboxFeature(shapeFilePath);
List<PolyhedralSurface> mesh = new ArrayList<PolyhedralSurface>();
for(Polygon poly : polygons) {
Coordinate[] coords = poly.getCoordinates();
List<Polygon> faces = new ArrayList<Polygon>();
for (int i =0; i<coords.length; i++) {
Double h = 15.00;
GeometryBuilder builder = new GeometryBuilder(DefaultGeographicCRS.WGS84_3D);
List<Position> dpsBottom = new ArrayList<Position>();
List<Position> dpsTop = new ArrayList<Position>();
//bottom positions created using coordinates
dpsBottom.add(builder.createDirectPosition(new double[] {coords[i].x, coords[i].y, 0}));
//top positions created using coordinates
dpsTop.add(builder.createDirectPosition(new double[] {coords[i].x, coords[i].y, h}));
My final purpose is create vertical faces and add them to a polygon list. Then, finaly giving this list to createPolyhedralSurface() function as input and create building as polyhedral geometry.
Is there a more efficient solution for my purpose?