1 #include "test_precomp.hpp"
2
3 using namespace cv;
4 using namespace std;
5
tutorial2()6 void tutorial2()
7 {
8 /// Create a window
9 viz::Viz3d myWindow("Coordinate Frame");
10
11 /// Add coordinate axes
12 myWindow.showWidget("Coordinate Widget", viz::WCoordinateSystem());
13
14 /// Add line to represent (1,1,1) axis
15 viz::WLine axis(Point3f(-1.0, -1.0, -1.0), Point3d(1.0, 1.0, 1.0));
16 axis.setRenderingProperty(viz::LINE_WIDTH, 4.0);
17 myWindow.showWidget("Line Widget", axis);
18
19 /// Construct a cube widget
20 viz::WCube cube_widget(Point3d(0.5, 0.5, 0.0), Point3d(0.0, 0.0, -0.5), true, viz::Color::blue());
21 cube_widget.setRenderingProperty(viz::LINE_WIDTH, 4.0);
22
23 /// Display widget (update if already displayed)
24 myWindow.showWidget("Cube Widget", cube_widget);
25
26 /// Rodrigues vector
27 Vec3d rot_vec = Vec3d::all(0);
28 double translation_phase = 0.0, translation = 0.0;
29 while(!myWindow.wasStopped())
30 {
31 /* Rotation using rodrigues */
32 /// Rotate around (1,1,1)
33 rot_vec[0] += CV_PI * 0.01;
34 rot_vec[1] += CV_PI * 0.01;
35 rot_vec[2] += CV_PI * 0.01;
36
37 /// Shift on (1,1,1)
38 translation_phase += CV_PI * 0.01;
39 translation = sin(translation_phase);
40
41 /// Construct pose
42 Affine3d pose(rot_vec, Vec3d(translation, translation, translation));
43
44 myWindow.setWidgetPose("Cube Widget", pose);
45
46 myWindow.spinOnce(1, true);
47 }
48 }
49
50
TEST(Viz,DISABLED_tutorial2_pose_of_widget)51 TEST(Viz, DISABLED_tutorial2_pose_of_widget)
52 {
53 tutorial2();
54 }
55