Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50094

How to write a macro that calculates the change in orientation vector

$
0
0
Hello,

I have a situation that which I cannot solve, which is a problem in both the macro and (a bit) the math side. Can anybody help me?

I have a unit vector pointing in a certain direction in a 3d axis (x,y,z). Let's say that the direction is along the x axis (so the vector is (1,0,0)). We will call it vector_original.

That unit vector has now a direction and points towards the y axis (so it is now (0,1,0). Let's call it vector_current.

How do I calculate (using a macro) what the vector is that shows the change in orientation?


I know I have to start with calculating a rotation matrix, by multiplying vector_current with the inverse of vector_original. How do I get the inverse of the original vector? How do I multiply the matrices?

It might be easy with (1,0,0) and (0,1,0), but it should also work with (-0.655654,-0.56291,0.503239) and (1,0,0), and the result should always be a unit vector by itself.

I've been trying to figure this out for days now and I'm a bit desperate.

Please, Help! :)


P.S. -
Unit Vector: SQRT(x2+y2+z2)=1

Viewing all articles
Browse latest Browse all 50094

Trending Articles