Using and *Understanding* CFrame:ToAxisAngle( )?

As stated on the wikia: CFrame | Documentation - Roblox Creator Hub ;
"Returns a tuple of a Vector3 and a number which represent the rotation of the CFrame in the axis-angle representation

My question is wouldn’t there be infinite solutions to an arbitrary vector and theta? How then are they picked with the Roblox built in? Should I make my own method because it’s faster and I’d know what’s going on?

The Wikipedia page on the operation lacks context. And the subsequent Rodrigues' rotation formula - Wikipedia is beyond my mathematical capabilities and my hunch tells me it’s not worth learning. There is no introductory materials on the concept concerning Roblox.

From the look it you have your CF, with a dot product theta to the tuple Vector3, which is thus returned. But I am uncertain.

Any help appreciated.
Thanks.

Assuming CFrame:ToAxisAngle is the inverse of CFrame.FromAxisAngle,
CFrame:ToAxisAngle should return the CFrame’s UpVector(?) along with the angle it’s rotated around that vector axis. I’m not positive if it’s the UpVector, RightVector, or LookVector, but it should be one of those. You’d have to run a couple of command bar commands to figure out exactly which one it is.

Sorry for the vague answer, the wiki is not very specific on which axis it actually is. I hope this points you in the right direction.

Well it’s not the LookVector as I’ve figured out, it’s the UpVector. What a great extrapolation.
The alien technology in concerning I’ve been trying to understand:

> local function twistAngle(cf, direction)
>     local axis, theta = cf:ToAxisAngle()
>     local w, v = math.cos(theta/2),  math.sin(theta/2)*axis
> 	local proj = v:Dot(direction)*direction
>     local twist = CFrame.new(0, 0, 0, proj.x, proj.y, proj.z, w)
>     local nAxis, nTheta = twist:ToAxisAngle()
>     return math.sign(v:Dot(direction))*nTheta
> end
2 Likes

Hi, this is really late, but did you ever got to understand what the math of the axis is? I was able to figure out the math behind theta, but I can’t seem to get axis. Thanks!

Super late too, but if you still need it.
The first parameter is a Vector3 for rotation from the world axes.
For example, if an orientation of (0,0,0) is pointing in the same direction as the X axis, an orientation of (0,45,45) would be pointing away from the origin as well as having the equidistant angle from each axis. But it means that you are pointing in the same way as the X axis, then turn 45 degrees towards the Y axis, and then 45 degrees towards the Z (Assuming XYZ order). This is the axis which you rotate about by theta degrees. If you rotate about this like, I’ll call it k, by 90 degrees, you have done the same thing as rotating 45 degrees in the X, 90 degrees in the Y, and 45 degrees in the Z with only one rotation.