last day (14 days later) » 

13:00
0
A: Rotate vector using transformation matrix, and read some angle

Lee YiyuanCheck out this Wikipedia article on the rotation of vectors in $\mathbb{R}^3$. It describes the transformation matrix used for the rotation of a vector about an arbitrary unit vector by an arbitrary angle. Regarding the computation of the rotation angle, we consider the rotation of an arbitrary ...

I'm rotating using matrix. When I rotate a vector using matrix, I will get new coordinates. But I will not get angle (which that vector was rotated around itself - itself means around axis which this vector now describes).
I've edit my answer to make more explicit the restoration of the rotation angle from the vectors before and after a rotation transform. Do check it out!
I have input vector A. I have rotation matrix which produce output vector B. To insert "physical component" in some 3D app, I need to give an postion, a direction (that produced vector B) and the angle. Everything I havem but not angle :( I must use these 2 inputs (vector A and matrix) to obtain pos, dir and angle :/
I believe you want to write something which allows the user to interact with your model and to rotate it about?
If you have the input vector $\vec{A}$, and the rotation matrix $\textbf{R}$, you could simply compute the output vector $\vec{B}$ by multiplying $\vec{A}$ with $\textbf{R}$, and use the dot product approach mentioned in the amended answer.
I have methods: InsertComponent (position, direction, angle). 1) position = start position, direction = normalized vector which indicates 'head' direction (if dir = (0,0,1) it means human head direction in targeted to sky). And angle means rotation around 'backbone' (0, 0, 1) = Z axis. And input values i have is default direction, and rotation matrix. I can easly produce final direction (matrix*direction), but I cannot get angle.
13:01
Good evening!
Lets move on
srry about my english, I cannot describe my problem properly
it is alright!
let me start again
13:02
sure thing
I have a vector (0, 0, 1), and matrix which rorate this vector around Z axis 40 degrees
so result will be the same vecttor right?
0, 0, 1
and now I need to extract that '40' value
unfortunately it's impossible if you are rotating an axis by itself
if rotation is made on one axis or input vector is placed on X, Y or Z axis this is easy
okay what if I add 1 more vector ?
13:03
because the vector wont have rotated t all
and i will transform it via the same matrix
for example i will add vecotr (1, 0 , 0)
so when i lokk at this vector i will know the angle, but its simple scenario
as long as you are rotating a vector about ANOTHER vector, you will be able to compute the angle
yeah i know
the final vector has to be different from the initial vector, or else one can say that nothing has changed
if you rotate (1, 0, 0) about Z-axis by 40 degrees
yes, but if i add more vector with different direction, maybe the other vectors will tell that angle ?
13:06
yes, it will!
lets take a simpler case
we consider rotating the (1, 0, 0) about (0, 0, 1) by 45 degrees
the result will be (sqrt(2), sqrt(2), 0)
let the rotation angle (45 degrees in this case) be, say, t
we assume that we dont know that t is 45 degrees
13:08
but what we know is that the dot product of the initial vector, A, and the final vector, B, gives
A dot B = |A||B|cos(t)
since |A| = |B| = 1, this simplifies to
sqrt(2) = cos(t)
i have function AngleBetween (vec1, vec2) and it computes angle, so its in my 3d library already
thats awesome
but problem is when i try to rotate about 3 axis
13:11
sorry, the final vector should be (1/sqrt(2), 1/sqrt(2), 0)
feel free to use programming jargon, i'm a programmer as well
but what if we rotate like we did, and also we rotate around different angle? that function anglebetween is useless in this case
look at picutre
wait
so what's the aim of your program?
im converting some stuff from one 3d model to another
to only compute the rotation angle from the initial and final vector, or to rotate a vector about some axis by some angle?
dont understand but imagine:
you need to place 3d component in 3d space
you need to provide: position, direction , and angle
(agnle = rotation aorund direction)
but you have as input: position (OK)
13:16
whats the position, direction and angle for?
direction = local direction + matrix = absolute direction
for method that will insert a component in 3d space
hmm.. alright
imagine a human body in local space
Position is 0,0,0
direction is 0,0,1 (head is targeting sky)
and angle is 0 (standing infront)
and u have transformation amtrix
so u apply
position will remain same 0,0,0
direction will remain same 0,0,1
but human body will not be infront anymore
you will okk at body from back
so i need to receive that 180 deg angle
i think i understand
13:20
the flaw of your positioning system is that it does not have enough parameters
see this
basically, you need 4 parameters instead of just 3
1 for 3d cartesian coordinates (the position)
yeah
the other 3 (euler angles) for orientation. its in the link i gave.
okay
and i will find everything at this wikipedia atricle ?
for describing 3d orientation, yes
but the link in my answer in the man thread has some goodies on rotation transforms in 3ds
inn 3d*
in* 3d*
that is, if you ever need it^^
ok thanks, will try to do this damn vectors stuff. see you, answer accepted.
13:30
vectors are fun! I've recently completed a high school project whereby we have to write an interactive 3D sphere. You really learn a lot from it. Thanks and see you too!

last day (14 days later) »