Implement quaternion fitting from the todo list

Submitted by Charles Karney

Assigned to Nobody

Link to original bugzilla bug (#771)
Version: 3.2

Description

Created attachment 438
Implement qMethod

I've implemented quaternion fitting, the q-method, of corresponding sets
of 3d points in Eigen, see attached file qMethod.h. Of course, the
umeyama method is more general (applying to points in arbitrary
dimensions). Reasons for including the q-method are:

  • possibly more efficient

  • allows weights to be assigned to the points

  • returns a Transform instead of Matrix

  • by including 1/sqrt(c) in the residual, the inverse transformation is
    returned if the source and destination sets are interchanged.

  • As of Eigen 3.2.1, there's a bug in umeyama() which causes it to
    return incorrect results with with_scaling = false unless the residual
    is zero (see separate bug report).

An expert in Eigen internals should look at the implementation I provide
here. In particular,

  • use static asserts to verify the dimensions of the input

  • optimize the type of the 3xn matrices in the version of the function
    with weights.

Attachment 438, "Implement qMethod":
qMethod.h

Blocking

#1608

Edited by Eigen Bugzilla