kindr icon indicating copy to clipboard operation
kindr copied to clipboard

Backwards assignments

Open mcamurri opened this issue 6 years ago • 1 comments

Apologies for the maybe dumb/replicated question (couldn't find a satisfying reply).

How can I assign an Eigen data structure to a kindr one? I know I can do the opposite by calling the toImplementation() function, but since kindr data structures inherits from Eigen the compiler prevents me from assigning a super class to an inherited one.

Is it legit to do something like the following?:

kindr::Vector3D kindr_v3;
Eigen::Vector3d eigen_v3;
kindr_v3.toImplementation() = eigen_v3;

mcamurri avatar Nov 06 '18 14:11 mcamurri

You could use your suggested code, or something like

kindr::Vector3D kindr_v3;
Eigen::Vector3d eigen_v3;
kindr_v3 = kindr::Vector3D(eigen_v3);

remod avatar Nov 20 '18 13:11 remod