#include #ifdef HAS_OPENCV3 #include //Any OPENCV3 code #else #include //Any Opencv2 code #endif using namespace cv; #include #include "geometry.h" class TestChangeCoord : public CxxTest::TestSuite { public: void testOrigin(void) { Point origin = Point(1,2); //the angle here is actually irrelevant Point p = map_point(M_PI/2, origin, origin); TS_ASSERT_EQUALS(p.x, 0); TS_ASSERT_EQUALS(p.y, 0); } void testOnlyTranslation(void) { Point origin = Point(1,2); Point p = map_point(0, origin, Point(0,0)); TS_ASSERT_EQUALS(p.x, -1); TS_ASSERT_EQUALS(p.y, -2); } void testOnlyRotationOrigin(void) { Point origin = Point(0,0); Point p = map_point(M_PI, origin, origin); TS_ASSERT_EQUALS(p.x, 0); TS_ASSERT_EQUALS(p.y, 0); } void testOnlyRotation(void) { Point origin = Point(0,0); Point p = map_point(M_PI, origin, Point(1,2)); TS_ASSERT_EQUALS(p.x, -1); TS_ASSERT_EQUALS(p.y, -2); } };