Math help - Rotation in direction.

Hello, I am trying to create a rotation in a certain direction, is the best way I can describe it…
I think the best way to explain it is by using an armature… though note that its not an actual object that receives the rotation.
All in world space.

I have a float curve which should determine the rotation: (side view)
armdeg.png

And the reason I find this difficult is that the rotation should depend on a direction vector (normalized): (each arm represents a direction)
armdeg.png

This is how the direction vector is set:

armdir.png

And in the below picture:
X is the desired distance to set the object in the direction of a vector depending on the Z value (the float curve).
Of course, in that picture it only rotates in world Y axis. I just don’t know how to math it together with the direction vector.

Any help is appreciated.