Gazebo Physics

API Reference

5.3.2
gz/physics/PlaneShape.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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_PLANESHAPE_HH_
19 #define GZ_PHYSICS_PLANESHAPE_HH_
20 
21 #include <string>
22 
24 #include <gz/physics/Geometry.hh>
25 
26 namespace ignition
27 {
28 namespace physics
29 {
31 
32 
33  class GetPlaneShapeProperties
34  : public virtual FeatureWithRequirements<PlaneShapeCast>
35  {
36  public: template <typename PolicyT, typename FeaturesT>
37  class PlaneShape : public virtual Entity<PolicyT, FeaturesT>
38  {
39  public: using Normal =
40  typename FromPolicy<PolicyT>::template Use<LinearVector>;
41 
42  public: using Point =
43  typename FromPolicy<PolicyT>::template Use<LinearVector>;
44 
47  public: Normal GetNormal() const;
48 
51  public: Point GetPoint() const;
52  };
53 
54  public: template <typename PolicyT>
55  class Implementation : public virtual Feature::Implementation<PolicyT>
56  {
57  public: using Normal =
58  typename FromPolicy<PolicyT>::template Use<LinearVector>;
59 
60  public: using Point =
61  typename FromPolicy<PolicyT>::template Use<LinearVector>;
62 
63  // See PlaneShape::GetNormal()
64  public: virtual Normal GetPlaneShapeNormal(
65  const Identity &_planeID) const = 0;
66 
67  // See PlaneShape::GetPoint()
68  public: virtual Point GetPlaneShapePoint(
69  const Identity &_planeID) const = 0;
70  };
71  };
72 
75  : public virtual FeatureWithRequirements<PlaneShapeCast>
76  {
77  public: template <typename PolicyT, typename FeaturesT>
78  class PlaneShape : public virtual Entity<PolicyT, FeaturesT>
79  {
80  public: using Normal =
81  typename FromPolicy<PolicyT>::template Use<LinearVector>;
82 
83  public: using Point =
84  typename FromPolicy<PolicyT>::template Use<LinearVector>;
85 
89  public: void SetNormal(const Normal &_normal);
90 
95  public: void SetPoint(const Point &_point);
96  };
97 
98  public: template <typename PolicyT>
99  class Implementation : public virtual Feature::Implementation<PolicyT>
100  {
101  public: using Normal =
102  typename FromPolicy<PolicyT>::template Use<LinearVector>;
103 
104  public: using Point =
105  typename FromPolicy<PolicyT>::template Use<LinearVector>;
106 
107  public: virtual void SetPlaneShapeNormal(
108  const Identity &_planeID,
109  const Normal &_normal) = 0;
110 
111  public: virtual void SetPlaneShapePoint(
112  const Identity &_planeID,
113  const Point &_point) = 0;
114  };
115  };
116 
122  : public virtual FeatureWithRequirements<PlaneShapeCast>
123  {
124  public: template <typename PolicyT, typename FeaturesT>
125  class Link : public virtual Feature::Link<PolicyT, FeaturesT>
126  {
127  public: using Normal =
128  typename FromPolicy<PolicyT>::template Use<LinearVector>;
129 
130  public: using Point =
131  typename FromPolicy<PolicyT>::template Use<LinearVector>;
132 
141  public: PlaneShapePtr<PolicyT, FeaturesT> AttachPlaneShape(
142  const std::string &_name,
143  const Normal &_normal,
144  const Point &_point = Point::Zero());
145  };
146 
147  public: template <typename PolicyT>
148  class Implementation : public virtual Feature::Implementation<PolicyT>
149  {
150  public: using Normal =
151  typename FromPolicy<PolicyT>::template Use<LinearVector>;
152 
153  public: using Point =
154  typename FromPolicy<PolicyT>::template Use<LinearVector>;
155 
156  public: virtual Identity AttachPlaneShape(
157  const Identity &_linkID,
158  const std::string &_name,
159  const Normal &_normal,
160  const Point &_point) = 0;
161  };
162  };
163 }
164 }
165 
166 #include <gz/physics/detail/PlaneShape.hh>
167 
168 #endif // GZ_PHYSICS_PLANESHAPE_HH_
This is the base class of all "proxy objects". The "proxy objects" are essentially interfaces into th...
Definition: gz/physics/Entity.hh:216
typename FromPolicy< PolicyT >::template Use< LinearVector > Point
Definition: gz/physics/PlaneShape.hh:154
If your feature is known to require any other features, then you should have your feature class inher...
Definition: gz/physics/FeatureList.hh:118
STL class.
This struct is used to conveniently convert from a policy to a geometric type. Example usage:
Definition: gz/physics/Geometry.hh:77
Definition: gz/physics/PlaneShape.hh:78
typename FromPolicy< PolicyT >::template Use< LinearVector > Point
Definition: gz/physics/PlaneShape.hh:84
virtual void SetPlaneShapeNormal(const Identity &_planeID, const Normal &_normal)=0
void SetPoint(const Point &_point)
Specify a point on this plane. The normal vector will remain fixed.
void SetNormal(const Normal &_normal)
Set the normal vector of this plane.
Definition: gz/physics/PlaneShape.hh:148
typename FromPolicy< PolicyT >::template Use< LinearVector > Normal
Definition: gz/physics/PlaneShape.hh:81
virtual void SetPlaneShapePoint(const Identity &_planeID, const Point &_point)=0
virtual Identity AttachPlaneShape(const Identity &_linkID, const std::string &_name, const Normal &_normal, const Point &_point)=0
#define IGN_PHYSICS_DECLARE_SHAPE_TYPE(CustomShapeType)
Given a shape type named CustomShapeType, this macro creates the following classes:
Definition: gz/physics/DeclareShapeType.hh:52
Definition: gz/physics/Feature.hh:92
Definition: gz/physics/PlaneShape.hh:74
typename FromPolicy< PolicyT >::template Use< LinearVector > Normal
Definition: gz/physics/PlaneShape.hh:151
typename FromPolicy< PolicyT >::template Use< LinearVector > Point
Definition: gz/physics/PlaneShape.hh:105
Definition: gz/physics/PlaneShape.hh:99
This feature constructs a new plane shape and attaches the desired point, which the plane passes thor...
Definition: gz/physics/PlaneShape.hh:121
typename FromPolicy< PolicyT >::template Use< LinearVector > Normal
Definition: gz/physics/PlaneShape.hh:102