Complex Folding mechanism in Grasshopper

Hey all,

i tried so hard but didn’t get so far - hopefully you can help me fix my problem :slight_smile:

I am creating a pavillion with a folding mechansim to open the lower part.
as you can see i have curve, seperated in two parts and 3 points we should be the joints.

Point on is immobile, point 3 should follow the rail and point 2 should be the result of the length from the two curve segements and im struggeling to construct point 2 :frowning:
I tryed a lot with vectors and rotations but probably im missing a commen Component and could get the result i want.

the whole Script should work for mutiple folding parts at once like you can see below.

additionally my Rhino and Grasshopper File
GH Problem Folding Mechanism.3dm (301.3 KB)

GH Problem Folding (144.2 KB)

Thanks in regards!!!