Eigen Scaling with vector input returns an unexpected scaling.

Summary

Calling Eigen::Scaling(Eigen::Vector) returns an unexpected result where the scale is always [1,0,0]. I'm not quite sure if I don't understand the documentation or if this is incorrect behavior, but it isn't what I would expect to happen.

Environment

  • Operating System : Linux
  • Architecture : x86_64
  • Eigen Version : 3.4
  • Compiler Version : g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

Minimal Example

I experienced this bug when trying to scale an affine transform and thought I would keep it in to show the example code in use.

    auto translation = Eigen::Translation<double, 3>(1,2,3);
    auto quaternion = Eigen::Quaternion<double>(1.0, 0.0, 0.0, 0.0);
    Eigen::Transform<double, 3, Eigen::Affine> obj;
    
    auto scaling_vec = Eigen::Scaling(Eigen::Vector3d(3.0,4.0,5.0));
    obj = translation * quaternion * scaling_vec;
    std::cerr << obj.matrix() << std::endl << std::endl;
    std::cerr << scaling_vec.diagonal() << std::endl << std::endl;
    
    auto scaling_direct = Eigen::Scaling(1.0,1.0,1.0);
    obj = translation * quaternion * scaling_direct;
    std::cerr << obj.matrix() << std::endl;

Expected results:

1 0 0 1
0 1 0 2
0 0 1 3
0 0 0 1

1
1
1

1 0 0 1
0 1 0 2
0 0 1 3
0 0 0 1

Actual results:

1 0 0 1
0 0 0 2
0 0 0 3
0 0 0 1

1
0
0

1 0 0 1
0 1 0 2
0 0 1 3
0 0 0 1
Edited by Aspen Eyers