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/utils/ImplPtr.hh>
27 #include <sdf/Error.hh>
28 #include <sdf/Element.hh>
29 #include <sdf/sdf_config.h>
30 
31 namespace sdf
32 {
33  // Inline bracket to help doxygen filtering.
34  inline namespace SDF_VERSION_NAMESPACE {
38  {
40  public: Cone();
41 
48  public: Errors Load(ElementPtr _sdf);
49 
52  public: double Radius() const;
53 
56  public: void SetRadius(double _radius);
57 
60  public: double Length() const;
61 
64  public: void SetLength(double _length);
65 
70  public: sdf::ElementPtr Element() const;
71 
74  public: const gz::math::Coned &Shape() const;
75 
78  public: gz::math::Coned &Shape();
79 
85  public: std::optional<gz::math::Inertiald>
86  CalculateInertial(double _density);
87 
93  public: sdf::ElementPtr ToElement() const;
94 
101  public: sdf::ElementPtr ToElement(sdf::Errors &_errors) const;
102 
104  GZ_UTILS_IMPL_PTR(dataPtr)
105  };
106  }
107 }
108 #endif
Cone represents a cone shape, and is usually accessed through a Geometry.
Definition: Cone.hh:38
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.
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