private static MultiPolygonList2d applyWindowsEnd(MultiPolygonList2d mPoly, BuildingNodeElement be, Point2d segmentStart,
Vector2d segmentDirection, double nodeDisplacement, CatchFaceFactory catchFaceFactory,
BuildingElementsTextureManager textureMenager, boolean counterClockwise) {
if (be instanceof SquareHoleElement) {
SquareHoleElement she = (SquareHoleElement) be;
Point2d lbp = new Point2d(nodeDisplacement - she.getWidth() / 2.0, she.getMinHeight());
Point2d mbp = new Point2d(nodeDisplacement, she.getMinHeight());
Point2d mtp = new Point2d(nodeDisplacement, she.getMaxHeight());
Point2d ltp = new Point2d(nodeDisplacement - she.getWidth() / 2.0, she.getMaxHeight());
mPoly = PolygonSplitHelper.unionOfLeftSideOfMultipleCuts(mPoly, new LinePoints2d(lbp, ltp),
new LinePoints2d(ltp, mtp), new LinePoints2d(mbp, lbp));
TextureData td = findWindowTextureData(be, textureMenager);
MeshFactory mesh = catchFaceFactory.createOrGetMeshFactory(td.getTex0());
FaceFactory face = mesh.addFace(FaceType.QUADS);
Vector3d n = new Vector3d(-segmentDirection.y, 0, -segmentDirection.x);
n.negate();
int iN = mesh.addNormal(n);
int imbTc = mesh.addTextCoord(new TextCoord(0.5, 0));
int imtTc = mesh.addTextCoord(new TextCoord(0.5, 1));
int ilbTc = mesh.addTextCoord(new TextCoord(0, 0));
int iltTc = mesh.addTextCoord(new TextCoord(0, 1));
face.addVert(segmentPointToVertex3dIndex(lbp, segmentStart, segmentDirection, mesh), ilbTc, iN);
face.addVert(segmentPointToVertex3dIndex(mbp, segmentStart, segmentDirection, mesh), imbTc, iN);
face.addVert(segmentPointToVertex3dIndex(mtp, segmentStart, segmentDirection, mesh), imtTc, iN);
face.addVert(segmentPointToVertex3dIndex(ltp, segmentStart, segmentDirection, mesh), iltTc, iN);
}
return mPoly;
}