Gazebo Math

API Reference

6.15.1
gz/math/Material.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 #ifndef GZ_MATH_MATERIAL_HH_
18 #define GZ_MATH_MATERIAL_HH_
19 
20 #include <limits>
21 #include <map>
22 #include <string>
23 #include <gz/math/Export.hh>
24 #include <gz/math/config.hh>
25 #include <gz/math/MaterialType.hh>
26 
27 namespace ignition
28 {
29  namespace math
30  {
31  // Inline bracket to help doxygen filtering.
32  inline namespace IGNITION_MATH_VERSION_NAMESPACE {
33  // Forward declarations
34  class MaterialPrivate;
35 
65  class IGNITION_MATH_VISIBLE Material
66  {
68  public: Material();
69 
72  public: explicit Material(const MaterialType _type);
73 
77  public: explicit Material(const std::string &_typename);
78 
81  public: explicit Material(const double _density);
82 
85  public: Material(const Material &_material);
86 
90  public: Material(Material &&_material);
91 
93  public: ~Material();
94 
98  public: static const std::map<MaterialType, Material> &Predefined();
99 
106  public: void SetToNearestDensity(
107  const double _value,
108  const double _epsilon = std::numeric_limits<double>::max());
109 
113  public: Material &operator=(const Material &_material);
114 
119  public: Material &operator=(Material &&_material);
120 
124  public: bool operator==(const Material &_material) const;
125 
129  public: bool operator!=(const Material &_material) const;
130 
133  public: MaterialType Type() const;
134 
138  public: void SetType(const MaterialType _type);
139 
145  public: std::string Name() const;
146 
150  public: void SetName(const std::string &_name);
151 
154  public: double Density() const;
155 
158  public: void SetDensity(const double _density);
159 
161  private: MaterialPrivate *dataPtr = nullptr;
162  };
163  }
164  }
165 }
166 #endif
void SetToNearestDensity(const double _value, const double _epsilon=std::numeric_limits< double >::max())
Set this Material to the built-in Material with the nearest density value within _epsilon....
Definition: gz/math/AdditivelySeparableScalarField3.hh:27
STL class.
Contains information about a single material.
Definition: gz/math/Material.hh:65
void SetName(const std::string &_name)
Set the name of the material.
std::string Name() const
Get the name of the material. This will match the enum type names used in MaterialType,...
Material & operator=(const Material &_material)
Copy operator.
double Density() const
Get the density value of the material in kg/m^3.
STL class.
void SetType(const MaterialType _type)
Set the material's type. This will only set the type value. Other properties, such as density,...
bool operator==(const Material &_material) const
Equality operator. This compares type and density values.
bool operator!=(const Material &_material) const
Inequality operator. This compares type and density values.
MaterialType
This enum lists the supported material types. A value can be used to create a Material instance....
Definition: gz/math/MaterialType.hh:37
MaterialType Type() const
Get the material's type.
void SetDensity(const double _density)
Set the density value of the material in kg/m^3.
static const std::map< MaterialType, Material > & Predefined()
Get all the built-in materials.