added unit tests
							parent
							
								
									6c198809af
								
							
						
					
					
						commit
						81b6f5975b
					
				|  | @ -69,6 +69,23 @@ TEST( SimpleCamera, backproject) | ||||||
|   CHECK(assert_equal( camera.backproject(Point2( 100,  100), 0.5),  point4)); |   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<Point2, bool> 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) { | Point2 project2(const Pose3& pose, const Point3& point) { | ||||||
| 	return project(SimpleCamera(K,pose), point); | 	return project(SimpleCamera(K,pose), point); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue