I have looked at the way the bridging direction works and I think this should be done differently:
Imagine a hollow cube (or a rectangular tube) with a rectangual cut-out on one of its sides.
A layer within this cut-out would look like somwhat like a (ectangular)"C". The first layer on top of the cut-out would then be a (rectangular) "O".
Now, as far as I understand it, the bridging direction algo looks at the last layer being a "C" and finds that it's only one "part". So, the bridging direction is set to -1, leading to "normal" alternating infill directions.
If you have the cut-out on both sides, the bridging direction is correct. because the algo sees two parts below and finds that their centers of gravity are in the direction of each other that I would expect to be the bridging direction.
Generally, I think having the bridging direction as member of a layer "part" is not so good. Imagine having a cut out on the right side and another one on the top side. Which direction should be used on that "O" shaped "part"?
I have looked into the code only shortly, but Looking at the output, I see (and indeed it's clear) that the engine is able to detect the area where there has to be a solid infill. So what about this idea: Remove this "bridge direction" member of the whole layer part. Instead, after having calculated the bottom infill area, make an intersection of this area with the whole layer below. In the example above (with one cut-out on the right side) the result would be two rectangular polygons (because of the overlap of the bridging area). Now take the centers of gravity of them, and you have your direction.
On the same part, there may be the above mentioned cut-out on the top side. Here you do the same, and you have again the correct angle.
As I said, I havent looked very closely at the code. Maybe there is something that I am missing which makes this impossible.
Starting somewhere in February (this month I am very busy) I would be happy to take a closer look at it and maybe try to implement this (it doesn't seem to be very complicated to me). But I just wanted to ask you what you think about it first.