Get Rotation from vertices movement / position

Hi, guys
Im developing a AR Virtual tryon Webapp.
i calculated avg pos between 3 points (vertices) so object is moving with face landmarks correctly.
but i want rotate facemesh along with facelandmarks(vertices/points)
how to calculate rotation with moving vertices or landmark positions

please suggest
Thank you

lets say you have point vectors before rotation, after and the offset you have calculated. then you should have: (after - offset) = RotMatrix * before or something like that, right?
now you repeat this for three points, and make 2 matrices using them as columns:

A = [after1 - offset, after2 - offset, after3 - offset]
B = [before1, before2, before3]

and the equation is now

A = RotMatrix * B
or
RotMatrix = A * B^-1

:nerd_face:

1 Like

hi Mac I am not expert in three JS can you explain in detail. What is offset?? Landmarks are not rotating only position is changing

ha ha :slight_smile: no.

Only position is changing there is no rotation is your equation is right

Explaining this is a bit more effort than I want to make, sorry. You will have to make that effort on your side, or seek another advice ¯\_(ツ)_/¯

1 Like

any way thanks for your suggestion i will try to figureout this your equation

im not expert in vector maths can anybody help me please