We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi forums :)
I'm new to 3D and can't get my head around this very basic 3D logic problem. Say I have two 3D vectors, and I want to draw an elongated box or rod connecting the two. How? In 2D it's easy - get the angle with simple trigonometry, push matrix, rotate, draw, pop matrix.
I understand that in 3D two angles are needed, and I've come across some different ways of calculating them. I can't get any reasonable results though - I think because the first rotation rotates the entire system and makes that second angle I calculated invalid.
Another way of wording it - how can I align the matrix's rotation with a specific unit vector?
What I get:
What I want:
(images stolen from here: https://forum.openframeworks.cc/t/rotate-3d-object-to-align-to-vector/5085 , this guy had the same problem but that environment could be asked to rotate along an arbitrary axis which doesn't seem possible in processing)