10 #include <mrpt/core/exceptions.h>    11 #include <mrpt/maps/CSimplePointsMap.h>    22 using namespace mvsim;
    28         double thickness = 0.10;
    43         float pt1Dist = std::numeric_limits<float>::max(),
    44                   pt2Dist = std::numeric_limits<float>::max();
    54         const bool end1move = pt1Dist < mrpt::square(1.1 * wp.
thickness);
    55         const bool end2move = pt2Dist < mrpt::square(1.1 * wp.
thickness);
    57         const auto vec12 = rawEnd2 - rawEnd1;
    59         const auto u12 = vec12.unitarize();
    64         const auto end1 = end1move ? (rawEnd1 + u12 * t) : rawEnd1;
    65         const auto end2 = end2move ? (rawEnd2 + u12 * (-t)) : rawEnd2;
    67         const auto ptCenter = (end1 + end2) * 0.5;
    68         const double wallLineAngle = std::atan2(vec12.y, vec12.x);
    74         b->setPose({ptCenter.x, ptCenter.y, 0, wallLineAngle, 0, 0});
    78                 const double l_hf = 0.5 * (end2 - end1).
norm();
    87                 p.emplace_back(bbmin.x, bbmin.y);
    88                 p.emplace_back(bbmin.x, bbmax.y);
    89                 p.emplace_back(bbmax.x, bbmax.y);
    90                 p.emplace_back(bbmax.x, bbmin.y);
    99         b->ground_friction(1e5);
   106         b->setIsStatic(
true);
   108         if (
auto bb = b->b2d_body(); bb != 
nullptr)
   111                 const auto q = b->getPose();
   113                 bb->SetTransform(
b2Vec2(
q.x, 
q.y), 
q.yaw);
   115                 bb->SetLinearVelocity({0, 0});
   116                 bb->SetAngularVelocity(0);
   129         std::string wallModelFileName;
   130         std::string sTransformation;
   132         mrpt::img::TColor wallColor{0xff323232};
   136         params[
"model_uri"] = 
TParamEntry(
"%s", &wallModelFileName);
   137         params[
"transformation"] = 
TParamEntry(
"%s", &sTransformation);
   141         params[
"color"] = 
TParamEntry(
"%color", &wallColor);
   146         ASSERT_(!wallModelFileName.empty());
   147         const std::string localFileName = xmlPathToActualPath(wallModelFileName);
   151         auto HM = mrpt::math::CMatrixDouble44::Identity();
   152         if (!sTransformation.empty())
   154                 std::stringstream ssError;
   155                 bool ok = HM.fromMatlabStringFormat(sTransformation, ssError);
   158                                 "Error parsing 'transformation=\"%s\"' parameter of walls:\n%s",
   159                                 sTransformation.c_str(), ssError.str().c_str());
   165                 "Loading walls definition model from: " << localFileName);
   167         auto glModel = mrpt::opengl::CAssimpModel::Create();
   168         glModel->loadScene(localFileName);
   170         const auto& 
points = glModel->shaderWireframeVertexPointBuffer();
   174         std::vector<mrpt::math::TPoint3Df> tfPts;
   175         tfPts.reserve(
points.size());
   176         for (
const auto& pt : 
points) tfPts.emplace_back(tf.composePoint(pt));
   182         ASSERT_(tfPts.size() % 2 == 0);
   183         for (
size_t i = 0; i < tfPts.size() / 2; i++)
   185                 const auto& pt1 = tfPts[i * 2 + 0];
   186                 const auto& pt2 = tfPts[i * 2 + 1];
   188                 block->block_color(wallColor);
 
This file contains rapidxml parser and DOM implementation. 
GLenum GLenum GLenum GLenum GLenum scale
std::map< std::string, TParamEntry > TParameterDefinitions
void parse_xmlnode_children_as_param(const rapidxml::xml_node< char > &xml_node, const TParameterDefinitions ¶ms, const std::map< std::string, std::string > &variableNamesValues={}, const char *functionNameContext="")
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
std::unique_ptr< b2World > & getBox2DWorld()
std::shared_ptr< Block > Ptr
#define MRPT_LOG_DEBUG_STREAM(__CONTENTS)
GLuint GLenum GLsizei GLsizei GLboolean void * points
static Block::Ptr create_wall_segment(World *parent, const mrpt::math::TPoint3D &rawEnd1, const mrpt::math::TPoint3D &rawEnd2, const WallProperties &wp, mrpt::maps::CSimplePointsMap &allPts)
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
GLint GLint GLint GLint GLint GLint GLsizei GLsizei height
size_t kdTreeClosestPoint2D(float x0, float y0, float &out_x, float &out_y, float &out_dist_sqr) const
void insertPoint(float x, float y, float z=0)
#define ASSERT_FILE_EXISTS_(FIL)
This file contains rapidxml printer implementation. 
GLdouble GLdouble GLdouble b
GLdouble GLdouble GLdouble GLdouble q
void process_load_walls(const rapidxml::xml_node< char > &node)
CONTAINER::Scalar norm(const CONTAINER &v)