Gazebo Physics

API Reference

7.4.0
HeightmapShape.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Open Source Robotics Foundation
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 
18 #ifndef GZ_PHYSICS_HEIGHTMAP_HEIGHTMAPSHAPE_HH_
19 #define GZ_PHYSICS_HEIGHTMAP_HEIGHTMAPSHAPE_HH_
20 
21 #include <string>
22 
23 #include <gz/common/geospatial/HeightmapData.hh>
24 
26 #include <gz/physics/Geometry.hh>
27 
28 namespace gz
29 {
30 namespace physics
31 {
32 namespace heightmap
33 {
34  GZ_PHYSICS_DECLARE_SHAPE_TYPE(HeightmapShape)
35 
36 
37  class GetHeightmapShapeProperties
38  : public virtual FeatureWithRequirements<HeightmapShapeCast>
39  {
40  public: template <typename PolicyT, typename FeaturesT>
41  class HeightmapShape : public virtual Entity<PolicyT, FeaturesT>
42  {
43  public: using Dimensions =
44  typename FromPolicy<PolicyT>::template Use<LinearVector>;
45 
48  public: Dimensions GetSize() const;
49  };
50 
51  public: template <typename PolicyT>
52  class Implementation : public virtual Feature::Implementation<PolicyT>
53  {
54  public: using Dimensions =
55  typename FromPolicy<PolicyT>::template Use<LinearVector>;
56 
57  public: virtual Dimensions GetHeightmapShapeSize(
58  const Identity &_heightmapID) const = 0;
59  };
60  };
61 
65  : public virtual FeatureWithRequirements<HeightmapShapeCast>
66  {
67  public: template <typename PolicyT, typename FeaturesT>
68  class Link : public virtual Feature::Link<PolicyT, FeaturesT>
69  {
70  public: using PoseType =
71  typename FromPolicy<PolicyT>::template Use<Pose>;
72 
73  public: using Dimensions =
74  typename FromPolicy<PolicyT>::template Use<LinearVector>;
75 
76  public: using ShapePtrType = HeightmapShapePtr<PolicyT, FeaturesT>;
77 
85  const std::string &_name,
86  const common::HeightmapData &_heightmapData,
87  const PoseType &_pose,
88  const Dimensions &_size,
89  int _subSampling = 1);
90  };
91 
92  public: template <typename PolicyT>
93  class Implementation : public virtual Feature::Implementation<PolicyT>
94  {
95  public: using PoseType =
96  typename FromPolicy<PolicyT>::template Use<Pose>;
97 
98  public: using Dimensions =
99  typename FromPolicy<PolicyT>::template Use<LinearVector>;
100 
101  public: virtual Identity AttachHeightmapShape(
102  const Identity &_linkID,
103  const std::string &_name,
104  const common::HeightmapData &_heightmapData,
105  const PoseType &_pose,
106  const Dimensions &_size,
107  int _subSampling) = 0;
108  };
109  };
110 }
111 }
112 }
113 
114 #include <gz/physics/heightmap/detail/HeightmapShape.hh>
115 
116 #endif // GZ_PHYSICS_HEIGHTMAP_HEIGHTMAPSHAPE_HH_