28 for (
size_t i = 0; i < N; i++)
48 for (
size_t i = 0; i < N; i++)
50 const double ang = i * 0.01;
51 TPoint3D pp =
p + up * 30 * cos(ang) +
lat * 30 * sin(ang);
52 gl->insertPoint(pp.
x, pp.
y, pp.
z);
61 for (
size_t i = 0; i < N; i++)
82 mrpt::make_aligned_shared<opengl::CPointCloud>();
83 theScene->insert(gl_pointcloud);
85 gl_pointcloud->setPointSize(3.0);
86 gl_pointcloud->enablePointSmooth();
87 gl_pointcloud->enableColorFromZ();
93 cout <<
"Building point cloud...";
96 for (
int XX = -10; XX <= 10; XX++)
98 const double off_x = XX * 2 * L;
100 for (
int YY = -10; YY <= 10; YY++)
102 const double off_y = YY * 2 * L;
105 1e4, gl_pointcloud,
TPoint3D(off_x + 0, off_y + 0, 0),
106 TPoint3D(off_x + L, off_y + 0, 500));
109 1e4, gl_pointcloud,
TPoint3D(off_x + L, off_y + 0, 500),
110 TPoint3D(off_x + L, off_y + L, -500));
113 1e4, gl_pointcloud,
TPoint3D(off_x + L, off_y + L, -500),
114 TPoint3D(off_x + 0, off_y + L, 500));
117 1e4, gl_pointcloud,
TPoint3D(off_x + 0, off_y + L, 500),
125 printf(
"Point count: %e\n", (
double)gl_pointcloud->size());
129 mrpt::make_aligned_shared<mrpt::opengl::CSetOfObjects>();
130 gl_pointcloud->octree_get_graphics_boundingboxes(*gl_bb);
131 theScene->insert(gl_bb);
135 win.setCameraZoom(600);
138 view->setViewportClipDistances(0.1, 1e6);
142 win.unlockAccess3DScene();
145 cout <<
"Close the window or press any key to end.\n";
147 while (
win.isOpen() && !
end)
149 std::this_thread::sleep_for(5ms);
153 switch (
win.getPushedKey())
159 gl_bb->setVisibility(!gl_bb->isVisible());
166 "FPS=%5.02f | Rendered points=%.02e/%.02e (%.02f%%) | "
167 "Visib.oct.nodes: %u/%u",
168 win.getRenderingFPS(), (
double)gl_pointcloud->getActuallyRendered(),
169 (
double)gl_pointcloud->size(),
170 100 *
double(gl_pointcloud->getActuallyRendered()) /
171 double(gl_pointcloud->size()),
172 (
unsigned int)gl_pointcloud->octree_get_visible_nodes(),
173 (
unsigned int)gl_pointcloud->octree_get_node_count());
175 win.get3DSceneAndLock();
179 5, 35,
"'b': switch bounding-boxes visible, 'q': quit",
181 win.unlockAccess3DScene();
195 std::this_thread::sleep_for(500ms);
199 catch (std::exception& e)
201 std::cout <<
"MRPT exception caught: " << e.what() << std::endl;
206 printf(
"Untyped exception!!");