lgmath icon indicating copy to clipboard operation
lgmath copied to clipboard

Perform check that input point is homogeneous, or take non-homogeneous points as input

Open cglwn opened this issue 8 years ago • 0 comments

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:

  1. Throw an exception, or
  2. Change the interfaces to take Eigen::Vector3d.

cglwn avatar Jan 27 '17 22:01 cglwn