diff --git a/cpp/testSimpleCamera.cpp b/cpp/testSimpleCamera.cpp index 070b79258..2f2ac89c2 100644 --- a/cpp/testSimpleCamera.cpp +++ b/cpp/testSimpleCamera.cpp @@ -69,6 +69,23 @@ TEST( SimpleCamera, backproject) CHECK(assert_equal( camera.backproject(Point2( 100, 100), 0.5), point4)); } +/* ************************************************************************* */ +TEST( SimpleCamera, backproject2) +{ + Point3 origin; + Rot3 rot(1., 0., 0., 0., 0., 1., 0., -1., 0.); // a camera looking down + SimpleCamera camera(K, Pose3(rot, origin)); + + + Point3 actual = camera.backproject(Point2(), 1.); + Point3 expected(0., 1., 0.); + pair x = camera.projectSafe(expected); + + CHECK(assert_equal(expected, actual)); + CHECK(assert_equal(Point2(), x.first)); + CHECK(x.second); +} + /* ************************************************************************* */ Point2 project2(const Pose3& pose, const Point3& point) { return project(SimpleCamera(K,pose), point);