Gazebo Physics

API Reference

7.4.0
EllipsoidShape.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_ELLIPSOIDSHAPE_HH_
19 #define GZ_PHYSICS_ELLIPSOIDSHAPE_HH_
20 
21 #include <string>
22 
24 #include <gz/physics/Geometry.hh>
25 
26 namespace gz
27 {
28  namespace physics
29  {
30  GZ_PHYSICS_DECLARE_SHAPE_TYPE(EllipsoidShape)
31 
32  class GZ_PHYSICS_VISIBLE GetEllipsoidShapeProperties
33  : public virtual FeatureWithRequirements<EllipsoidShapeCast>
34  {
35  public: template <typename PolicyT, typename FeaturesT>
36  class EllipsoidShape : public virtual Entity<PolicyT, FeaturesT>
37  {
38  public: using Dimensions =
39  typename FromPolicy<PolicyT>::template Use<LinearVector>;
40 
43  public: Dimensions GetRadii() const;
44  };
45 
46  public: template <typename PolicyT>
47  class Implementation : public virtual Feature::Implementation<PolicyT>
48  {
49  public: using Dimensions =
50  typename FromPolicy<PolicyT>::template Use<LinearVector>;
51 
52  public: virtual Dimensions GetEllipsoidShapeRadii(
53  const Identity &_ellipsoidID) const = 0;
54  };
55  };
56 
60  class GZ_PHYSICS_VISIBLE SetEllipsoidShapeProperties
61  : public virtual FeatureWithRequirements<EllipsoidShapeCast>
62  {
63  public: template <typename PolicyT, typename FeaturesT>
64  class EllipsoidShape : public virtual Entity<PolicyT, FeaturesT>
65  {
66  public: using Dimensions =
67  typename FromPolicy<PolicyT>::template Use<LinearVector>;
68 
72  public: void SetRadii(const Dimensions &_radii);
73  };
74 
75  public: template <typename PolicyT>
76  class Implementation : public virtual Feature::Implementation<PolicyT>
77  {
78  public: using Dimensions =
79  typename FromPolicy<PolicyT>::template Use<LinearVector>;
80 
81  public: virtual void SetEllipsoidShapeRadii(
82  const Identity &_ellipsoidID, const Dimensions &_radii) = 0;
83  };
84  };
85 
90  class GZ_PHYSICS_VISIBLE AttachEllipsoidShapeFeature
91  : public virtual FeatureWithRequirements<EllipsoidShapeCast>
92  {
93  public: template <typename PolicyT, typename FeaturesT>
94  class Link : public virtual Feature::Link<PolicyT, FeaturesT>
95  {
96  public: using Dimensions =
97  typename FromPolicy<PolicyT>::template Use<LinearVector>;
98 
99  public: using PoseType =
100  typename FromPolicy<PolicyT>::template Use<Pose>;
101 
102  public: using ShapePtrType = EllipsoidShapePtr<PolicyT, FeaturesT>;
103 
111  const std::string &_name = "ellipsoid",
112  const Dimensions &_radii = Dimensions::Constant(1.0),
113  const PoseType &_pose = PoseType::Identity());
114  };
115 
116  public: template <typename PolicyT>
117  class Implementation : public virtual Feature::Implementation<PolicyT>
118  {
119  public: using Dimensions =
120  typename FromPolicy<PolicyT>::template Use<LinearVector>;
121 
122  public: using PoseType =
123  typename FromPolicy<PolicyT>::template Use<Pose>;
124 
125  public: virtual Identity AttachEllipsoidShape(
126  const Identity &_linkID,
127  const std::string &_name,
128  const Dimensions &_radii,
129  const PoseType &_pose) = 0;
130  };
131  };
132  }
133 }
134 
135 #include <gz/physics/detail/EllipsoidShape.hh>
136 
137 #endif