A first approximation to modeling "distorted" flaps with connected trailing edges.
Used the ends of the flaps to create five foil shaped curves (four flaps, five end curves). Then added a fifth "channel" to my earlier Grasshopper code and re-assigned their geometries to these new curves instead of the flap surfaces. Then lofted the five curves and used "loft options" to approximate what you might get if done properly.
"Properly:" This is NOT THE SAME as one would get by smoothly rotating ten or twenty cross section frames per flap (40..80 frames total) on their respective axis (one of four), which would also ensure that the NACA foil sections at every point along the wing are preserved. Surface "skin" stretching or sliding slightly on the frames might complete the "distortion" needed to close the gaps between the flaps trailing edges? Not trivial in CAD!
By collecting the "edge curves" and "flap axes" as lists, a single rotation component can be used instead of five. Much better! This does exactly the same thing as earlier code: