Gazebo Physics

API Reference

7.4.0
MeshShape.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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_MESH_MESHSHAPE_HH_
19 #define GZ_PHYSICS_MESH_MESHSHAPE_HH_
20 
21 #include <string>
22 
23 #include <gz/common/Mesh.hh>
24 
26 #include <gz/physics/Geometry.hh>
27 
28 namespace gz
29 {
30 namespace physics
31 {
32 namespace mesh
33 {
35 
36 
37  class GetMeshShapeProperties
38  : public virtual FeatureWithRequirements<MeshShapeCast>
39  {
40  public: template <typename PolicyT, typename FeaturesT>
41  class MeshShape : public virtual Entity<PolicyT, FeaturesT>
42  {
43  public: using Dimensions =
44  typename FromPolicy<PolicyT>::template Use<LinearVector>;
45 
48  public: Dimensions GetSize() const;
49 
52  public: Dimensions GetScale() const;
53  };
54 
55  public: template <typename PolicyT>
56  class Implementation : public virtual Feature::Implementation<PolicyT>
57  {
58  public: using Dimensions =
59  typename FromPolicy<PolicyT>::template Use<LinearVector>;
60 
61  public: virtual Dimensions GetMeshShapeSize(
62  const Identity &_meshID) const = 0;
63 
64  public: virtual Dimensions GetMeshShapeScale(
65  const Identity &_meshID) const = 0;
66  };
67  };
68 
71  : public virtual FeatureWithRequirements<MeshShapeCast>
72  {
73  public: template <typename PolicyT, typename FeaturesT>
74  class MeshShape : public virtual Entity<PolicyT, FeaturesT>
75  {
76  public: using Dimensions =
77  typename FromPolicy<PolicyT>::template Use<LinearVector>;
78 
79  public: void SetScale(const Dimensions &_dimensions);
80  };
81 
82  public: template <typename PolicyT>
83  class Implementation : public virtual Feature::Implementation<PolicyT>
84  {
85  public: using Dimensions =
86  typename FromPolicy<PolicyT>::template Use<LinearVector>;
87 
88  public: void SetMeshShapeScale(
89  const Identity &_meshID,
90  const Dimensions &_dimensions) = 0;
91  };
92  };
93 
96  : public virtual FeatureWithRequirements<MeshShapeCast>
97  {
98  public: template <typename PolicyT, typename FeaturesT>
99  class Link : public virtual Feature::Link<PolicyT, FeaturesT>
100  {
101  public: using PoseType =
102  typename FromPolicy<PolicyT>::template Use<Pose>;
103 
104  public: using Dimensions =
105  typename FromPolicy<PolicyT>::template Use<LinearVector>;
106 
107  public: using ShapePtrType = MeshShapePtr<PolicyT, FeaturesT>;
108 
110  const std::string &_name,
111  const gz::common::Mesh &_mesh,
112  const PoseType &_pose = PoseType::Identity(),
113  const Dimensions &_scale = Dimensions::Ones());
114  };
115 
116  public: template <typename PolicyT>
117  class Implementation : public virtual Feature::Implementation<PolicyT>
118  {
119  public: using PoseType =
120  typename FromPolicy<PolicyT>::template Use<Pose>;
121 
122  public: using Dimensions =
123  typename FromPolicy<PolicyT>::template Use<LinearVector>;
124 
125  public: virtual Identity AttachMeshShape(
126  const Identity &_linkID,
127  const std::string &_name,
128  const gz::common::Mesh &_mesh,
129  const PoseType &_pose,
130  const Dimensions &_scale) = 0;
131  };
132  };
133 }
134 }
135 }
136 
137 #include <gz/physics/mesh/detail/MeshShape.hh>
138 
139 #endif // GZ_PHYSICS_MESH_MESHSHAPE_HH_