Cone.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2024 CogniPilot Foundation
3  * Copyright 2024 Open Source Robotics Foundation
4  * Copyright 2024 Rudis Laboratories
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19 #ifndef SDF_CONE_HH_
20 #define SDF_CONE_HH_
21 
22 #include <optional>
23 
24 #include <gz/math/Cone.hh>
25 #include <gz/math/Inertial.hh>
26 #include <gz/math/AxisAlignedBox.hh>
27 #include <gz/utils/ImplPtr.hh>
28 #include <sdf/Error.hh>
29 #include <sdf/Element.hh>
30 #include <sdf/sdf_config.h>
31 
32 namespace sdf
33 {
34  // Inline bracket to help doxygen filtering.
35  inline namespace SDF_VERSION_NAMESPACE {
39  {
41  public: Cone();
42 
49  public: Errors Load(ElementPtr _sdf);
50 
53  public: double Radius() const;
54 
57  public: void SetRadius(double _radius);
58 
61  public: double Length() const;
62 
65  public: void SetLength(double _length);
66 
71  public: sdf::ElementPtr Element() const;
72 
75  public: const gz::math::Coned &Shape() const;
76 
79  public: gz::math::Coned &Shape();
80 
86  public: std::optional<gz::math::Inertiald>
87  CalculateInertial(double _density);
88 
92  public: gz::math::AxisAlignedBox AxisAlignedBox() const;
93 
99  public: sdf::ElementPtr ToElement() const;
100 
107  public: sdf::ElementPtr ToElement(sdf::Errors &_errors) const;
108 
110  GZ_UTILS_IMPL_PTR(dataPtr)
111  };
112  }
113 }
114 #endif
Cone represents a cone shape, and is usually accessed through a Geometry.
Definition: Cone.hh:39
double Radius() const
Get the cone's radius in meters.
void SetLength(double _length)
Set the cone's length in meters.
gz::math::Coned & Shape()
Get a mutable Gazebo Math representation of this cone.
Errors Load(ElementPtr _sdf)
Load the cone geometry based on a element pointer.
void SetRadius(double _radius)
Set the cone's radius in meters.
const gz::math::Coned & Shape() const
Get the Gazebo Math representation of this cone.
double Length() const
Get the cone's length in meters.
sdf::ElementPtr ToElement() const
Create and return an SDF element filled with data from this cone.
std::optional< gz::math::Inertiald > CalculateInertial(double _density)
Calculate and return the Inertial values for the cone.
sdf::ElementPtr ToElement(sdf::Errors &_errors) const
Create and return an SDF element filled with data from this cone.
gz::math::AxisAlignedBox AxisAlignedBox() const
Get the Axis-aligned box for this Cone.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:95
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:55
namespace for Simulation Description Format parser
Definition: Actor.hh:35
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:25