rotating along directional vector producing unexpected result

This is the scene at hand:
I applied three array modifiers, applied them and then merged vertices by distance.
I would like to instance the edges as cylinders so to speak, therefore I used a Mesh to Points node set to "Edges", which is plugged into Instance on Points node, with a cylinder primitive as instance.

In order to align the cylinders with the direction of the edges I use the *Edge VerticesE node and subtract them to get the directional vector from one vertex of an edge to the other. I then want to align the Z axis of the cylinders with their respective directional vector.

The idea is the following: Let's take the edge between one vertex and one that is above it: $$(0,0,2)$$ difference. The angle between $$(0,0,1)$$ and the directional vector is $$0$$ therefore it should point up.

If the difference was $$(0,2,0)$$ the cylinder should be rotated $$90$$ degrees to match it with the local z axis.

(because the cubes were of size $$2$$: Vertices had the difference of $$2$$).

In the second image I calculate the angle between the $$(0,0,1)$$ vector and the directional vector manually. The reason I chose $$(0,0,1)$$ is because that is the cylinders current Z axis. I basically emulate Align Euler to Vector and I suppose that worked because I get multiples of the same value down to its thousands decimal.

I dont understand why the values produced are multiples of $$1.571$$. I suppose since these aren't angles that the rotation is for that reason unaffected.

Does anyone know what is causing this issue?

• used wireframe and geometrynodes in combination. Dec 10, 2023 at 16:08