95 pps[0] = base + pDist;
96 pps[1] = base +
CPose3D(0, 0, 0, 0, -
M_PI / 2, 0) + pDist;
97 pps[2] = base +
CPose3D(0, 0, 0, -
M_PI / 2, 0, 0) + pDist;
98 pps[3] = base +
CPose3D(0, 0, 0,
M_PI / 2, 0, 0) + pDist;
99 for (
size_t i = 0; i < 4; i++)
101 base.
x(), base.
y(), base.z(), pps[i].
x(), pps[i].
y(), pps[i].z());
102 lines->setLineWidth(5);
103 lines->setColor(0, 0, 1);
110 CDisk::Ptr dsk = mrpt::make_aligned_shared<CDisk>();
124 for (
size_t i = 0; i < 5; i++)
127 CPolyhedron::CreateRandomPolyhedron(
MYRANDG(2, 2));
139 for (
size_t i = 0; i < 3; i++) md(i, i) =
MYRANDG(8.0, 1.0);
140 for (
size_t i = 0; i < 3; i++)
142 size_t ii = (i + 1) % 3;
143 md(i, ii) = md(ii, i) =
MYRANDG(sqrt(md(i, i) * md(ii, ii)));
145 ell->setCovMatrix(md);
146 configRandom(std::dynamic_pointer_cast<CRenderizable>(ell));
153 window.setPos(10, 10);
154 std::this_thread::sleep_for(20ms);
158 mrpt::make_aligned_shared<CGridPlaneXY>(-20, 20, -20, 20, 0, 1);
160 scene1->insert(plane1);
162 mrpt::make_aligned_shared<CAxis>(-5, -5, -5, 5, 5, 5, 2.5, 3,
true));
165 scene1->insert(world);
168 mrpt::make_aligned_shared<CAngularObservationMesh>();
171 CAngularObservationMesh::trace2DSetOfRays(
172 scene1, basePose, aom,
173 CAngularObservationMesh::TDoubleRange::CreateFromAmount(
175 CAngularObservationMesh::TDoubleRange::CreateFromAperture(
177 cout <<
"Elapsed time: " <<
t.Tac() <<
" seconds.\n";
178 aom->setColor(0, 1, 0);
179 aom->setWireframe(
true);
183 aom->getTracedRays(traced);
184 traced->setLineWidth(1.5);
185 traced->setColor(1, 0, 0);
187 scene1->insert(traced);
188 scene1->insert(guides);
198 CSphere::Ptr point = mrpt::make_aligned_shared<CSphere>(0.2);
199 point->setColor(0, 1, 0);
200 point->setPose(basePose);
201 scene1->insert(point);
203 window2.setPos(660, 10);
204 std::this_thread::sleep_for(20ms);
205 window.get3DSceneAndLock() = scene1;
206 window.unlockAccess3DScene();
207 window.setCameraElevationDeg(25.0f);
211 mrpt::make_aligned_shared<CGridPlaneXY>(-20, 20, -20, 20, 0, 1);
213 scene2->insert(plane2);
215 mrpt::make_aligned_shared<CAxis>(-5, -5, -5, 5, 5, 5, 2.5, 3,
true));
216 window2.unlockAccess3DScene();
217 window2.setCameraElevationDeg(25.0f);
230 catch (
const exception& e)
232 cout <<
"Error: " << e.what() <<
'.' << endl;
238 cout <<
"Unknown Error.\n";
A namespace of pseudo-random numbers generators of diferent distributions.
double drawUniform(const double Min, const double Max)
Generate a uniformly distributed pseudo-random number using the MT19937 algorithm, scaled to the selected range.
double x() const
Common members of all points & poses classes.
A mesh built from a set of 2D laser scan observations.
const float RANDOM_POSE_DISTANCE
double MYRANDG(double scale, double shift=0)
GLenum GLenum GLenum GLenum GLenum scale
void configRandom(const CRenderizable::Ptr &obj)
Call configRandom given the address of an object and assign random pose and color to it...
void randomize(const uint32_t seed)
Initialize the PRNG from the given random seed.
void guideLines(const CPose3D &base, CSetOfLines::Ptr &lines, float dist)
A high-performance stopwatch, with typical resolution of nanoseconds.
void generateObjects(CSetOfObjects::Ptr &world)
GLsizei GLsizei GLuint * obj
This base provides a set of functions for maths stuff.
CMatrixTemplateNumeric< double > CMatrixDouble
Declares a matrix of double numbers (non serializable).
A class used to store a 3D point.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
void pause(const std::string &msg=std::string("Press any key to continue...")) noexcept
Shows the message "Press any key to continue" (or other custom message) to the current standard outpu...
const size_t HOW_MANY_YAWS
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
The namespace for 3D scene representation and rendering.
double MYRAND1(size_t prec=64)
Classes for creating GUI windows for 2D and 3D visualization.
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
const size_t HOW_MANY_PITCHS
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.