Skip to content

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

@cglwn

Description

@cglwn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions