00001 /*+-------------------------------------------------------------------------+ 00002 | MultiVehicle simulator (libmvsim) | 00003 | | 00004 | Copyright (C) 2014 Jose Luis Blanco Claraco (University of Almeria) | 00005 | Copyright (C) 2017 Borys Tymchenko (Odessa Polytechnic University) | 00006 | Distributed under GNU General Public License version 3 | 00007 | See <http://www.gnu.org/licenses/> | 00008 +-------------------------------------------------------------------------+ */ 00009 00010 #pragma once 00011 00012 #include <mvsim/WorldElements/WorldElementBase.h> 00013 #include <mrpt/opengl/CMesh.h> 00014 #include <mrpt/utils/TMatchingPair.h> 00015 #include <mrpt/poses/CPose3D.h> 00016 00017 namespace mvsim 00018 { 00019 class ElevationMap : public WorldElementBase 00020 { 00021 DECLARES_REGISTER_WORLD_ELEMENT(ElevationMap) 00022 public: 00023 ElevationMap(World* parent, const rapidxml::xml_node<char>* root); 00024 virtual ~ElevationMap(); 00025 00026 virtual void loadConfigFrom( 00027 const rapidxml::xml_node<char>* root); 00028 virtual void gui_update( 00029 mrpt::opengl::COpenGLScene& scene); 00030 00031 virtual void simul_pre_timestep( 00032 const TSimulContext& context); 00033 virtual void simul_post_timestep( 00034 const TSimulContext& context); 00035 00036 bool getElevationAt( 00037 double x, double y, float& z) const; 00038 00039 protected: 00042 mrpt::opengl::CMesh::Ptr m_gl_mesh; 00043 bool m_first_scene_rendering; 00044 double m_resolution; 00045 mrpt::math::CMatrixFloat m_mesh_z_cache; 00046 00047 00048 00049 private: 00050 // temp vars (declared here to avoid reallocs): 00051 mrpt::utils::TMatchingPairList corrs; 00052 mrpt::poses::CPose3D m_optimal_transf; 00053 }; 00054 }