All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HeightmapShape.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Nate Koenig
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 /* Desc: Heightmap shape
18  * Author: Nate Koenig, Andrew Howard
19  * Date: 8 May 2003
20  */
21 
22 #ifndef _HEIGHTMAPSHAPE_HH_
23 #define _HEIGHTMAPSHAPE_HH_
24 
25 #include <string>
26 #include <vector>
27 
28 #include "gazebo/common/Image.hh"
29 #include "gazebo/math/Vector3.hh"
31 #include "gazebo/physics/Shape.hh"
32 
33 namespace gazebo
34 {
35  namespace physics
36  {
39 
44  class HeightmapShape : public Shape
45  {
48  public: explicit HeightmapShape(CollisionPtr _parent);
49 
51  public: virtual ~HeightmapShape();
52 
55  public: virtual void Load(sdf::ElementPtr _sdf);
56 
58  public: virtual void Init();
59 
62  public: std::string GetURI() const;
63 
66  public: math::Vector3 GetSize() const;
67 
70  public: math::Vector3 GetPos() const;
71 
76  public: math::Vector2i GetVertexCount() const;
77 
82  public: float GetHeight(int _x, int _y);
83 
86  public: void FillMsg(msgs::Geometry &_msg);
87 
90  public: virtual void ProcessMsg(const msgs::Geometry &_msg);
91 
94  public: float GetMaxHeight() const;
95 
98  public: float GetMinHeight() const;
99 
101  private: void FillHeightMap();
102 
104  protected: std::vector<float> heights;
105 
107  protected: common::Image img;
108 
110  protected: unsigned int vertSize;
111 
113  protected: math::Vector3 scale;
114 
116  protected: int subSampling;
117  };
119  }
120 }
121 #endif