lgmath
lgmath copied to clipboard
Perform check that input point is homogeneous, or take non-homogeneous points as input
Ran into this making an example while sleepy. We should anticipate users doing things wrong.
Code Sample
#include <iostream>
#include <lgmath/lgmath.hpp>
#include <Eigen/Core>
int main() {
// Create a transformation.
Eigen::Matrix<double, 6, 1> transformation_vector;
transformation_vector << 2.0, 0.0, 0.0, 0.0, 0.0, 0.0;
lgmath::se3::Transformation transformation(transformation_vector);
// Try to transform a non-homogeneous point.
Eigen::Vector4d point;
point << 1.0, 2.0, 3.0, 0.0;
std::cout << "Point after transformation:\n" << transformation * point << "\n";
}
Expected Output
Some error message.
Actual Output
Point after transformation:
1
2
3
0
Solution
Could either:
- Throw an exception, or
- Change the interfaces to take Eigen::Vector3d.