10 #include <mrpt/opengl/CAssimpModel.h> 11 #include <mrpt/opengl/CCylinder.h> 12 #include <mrpt/opengl/CSphere.h> 13 #include <mrpt/system/filesystem.h> 14 #include <mrpt/system/os.h> 23 using namespace mvsim;
28 const float radius = 0.5f;
29 auto glSphere = mrpt::opengl::CSphere::Create(radius);
31 const Shape2p5 shape = csc.get(*glSphere, -radius, +radius, {}, 1.0f);
33 std::cout <<
"Sphere:\n" << shape.
getContour() << std::endl;
40 const float radius = 0.5f, L = 2.0f;
41 auto glCyl = mrpt::opengl::CCylinder::Create(radius, radius, L);
43 const Shape2p5 shape = csc.get(*glCyl, 0, L, {}, 1.0f);
45 std::cout <<
"Cylinder:\n" << shape.
getContour() << std::endl;
52 const float radius = 0.5f, L = 2.0f;
53 auto glCyl = mrpt::opengl::CCylinder::Create(radius, radius, L);
56 *glCyl, 0, L, mrpt::poses::CPose3D::FromTranslation(-0.15, 0, 0), 1.0
f);
59 *glCyl, 0, L, mrpt::poses::CPose3D::FromTranslation(0.15, 0, 0), 1.0
f);
64 std::cout <<
"Cylinder 1:\n" << s1.
getContour() << std::endl;
65 std::cout <<
"Cylinder 2:\n" << s2.
getContour() << std::endl;
66 std::cout <<
"Cylinder 1+2:\n" << s.
getContour() << std::endl;
73 auto glModel = mrpt::opengl::CAssimpModel::Create();
74 glModel->loadScene(mrpt::system::pathJoin(
75 {MVSIM_TEST_DIR,
"../models/simple_camera.dae"}));
77 const Shape2p5 shape = csc.get(*glModel, 0, 1.0, {}, 1.0f);
79 std::cout <<
"SimpleCamera .DAE:\n" << shape.
getContour() << std::endl;
82 int main([[maybe_unused]]
int argc, [[maybe_unused]]
char** argv)
84 std::vector<std::pair<std::function<void(void)>, std::string>> lst = {
93 for (
const auto& kv : lst)
98 printf(
"[%20s] Running...\n", kv.second.c_str());
104 printf(
"[%20s] Success\n", kv.second.c_str());
107 catch (
const std::exception& e)
109 std::cerr << e.what();
111 printf(
"[%20s] FAIL\n", kv.second.c_str());
117 return anyFail ? 1 : 0;
const mrpt::math::TPolygon2D & getContour() const
void setConsoleErrorColor()
static void setConsoleBlueColor()
void shape_test_cylinder()
static CollisionShapeCache & Instance()
void shape_test_simplecamera()
int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv)
void mergeWith(const Shape2p5 &s)
void setConsoleNormalColor()