Skip to content

Perhaps bugs when converting axisangle to rotation matrix #7

@kyang-06

Description

@kyang-06

Very impressive and elegant theory to push this field forward!

But I notice there may exist a bug.

axis, theta = normalize_vector(rod, return_mag=True)
sin = torch.sin(theta)
qw = torch.cos(theta)
qx = axis[:,0]*sin
qy = axis[:,1]*sin
qz = axis[:,2]*sin

theta = torch.tanh(axisAngle[:,0])*np.pi #[-180, 180]
sin = torch.sin(theta)
axis = normalize_vector(axisAngle[:,1:4]) #batch*3
qw = torch.cos(theta)
qx = axis[:,0]*sin
qy = axis[:,1]*sin
qz = axis[:,2]*sin

Code above are the function converting axisangle/rodrigues to rotation matrix.
The θ passed to torch.sin and torch.cos is the identity but should be θ/2 instead, referring to Maths - AxisAngle to Quaternion
I've hand-written a toy case (rotate y axis by 90 degrees around x axis) and only θ/2 is correct.

I wonder if it is a bug, and if so, does it influence other conversion functions and further influence result of experiments?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions