Transformation question

Well I am making progress but I haven’t done this maths for 30 years and I’m struggling. I have reference points in the program that are all a function of z. I am working on a sub program to find points a’, b’, and c’ and I want them to create a transformation to change z to z’ as a new reference point. This only for 2D ie x,y and rotation.

Any tips on writing the script appreciated.