I'm trying to figure out what the angle of rotation (sign included) is when you take one 3D vector and rotate it into another 3D vector specifically when the axis of rotation is specified.
The image below shows what I'm trying to do (sorry for my rudimentary hand drawing). The angle theta is what I'd like to calculate.
Say there's a 3D vector v that defines the axis of rotation. Imagine a plane that includes both vector v and point p1, then we rotate this plane about the axis v until it hits point p2. The rotation of this plane forms the angle theta which is what I'm trying to compute. Note that vector v is not necessarily parallel to the cross product of p1 and p2. The origin o in my case is just (0,0,0)

Ended up finding the solution myself, so wanted to post what I came up with. Turned out to be a little more simple than I realized.
First compute a normal vector to the plane formed by
v and p1and also the plane formed byv and p2Then I can take these two vectors and compute the angle between them by doing
This gives me the absolute value of the angle I'm searching for
To get the sign of the rotation I need to compute the cross product of
n1 with n2and
dotit withvsign = 1if positive rotation andsign = -1for negative rotationNote: Some final logic is needed to take care in the special situation's of
theta = 0 or 180Here's a simple Matlab script that does the math. Messing around with the
zvalue ofp2doesn't change the computed angle, which is what I was looking for.