Tesseract
Motion Planning Environment
Loading...
Searching...
No Matches
convex_mesh.h
Go to the documentation of this file.
1
26#ifndef TESSERACT_GEOMETRY_CONVEX_MESH_H
27#define TESSERACT_GEOMETRY_CONVEX_MESH_H
28
31#include <boost/serialization/access.hpp>
32#include <boost/serialization/export.hpp>
33#include <Eigen/Geometry>
34#include <memory>
36
40
41namespace tesseract_geometry
42{
43class ConvexMesh : public PolygonMesh
44{
45public:
46 // LCOV_EXCL_START
47 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
48 // LCOV_EXCL_STOP
49
50 using Ptr = std::shared_ptr<ConvexMesh>;
51 using ConstPtr = std::shared_ptr<const ConvexMesh>;
52
54 {
58 };
59
75 ConvexMesh(std::shared_ptr<const tesseract_common::VectorVector3d> vertices,
76 std::shared_ptr<const Eigen::VectorXi> faces,
78 const Eigen::Vector3d& scale = Eigen::Vector3d(1, 1, 1),
79 std::shared_ptr<const tesseract_common::VectorVector3d> normals = nullptr,
80 std::shared_ptr<const tesseract_common::VectorVector4d> vertex_colors = nullptr,
81 MeshMaterial::Ptr mesh_material = nullptr,
82 std::shared_ptr<const std::vector<MeshTexture::Ptr>> mesh_textures = nullptr)
83 : PolygonMesh(std::move(vertices),
84 std::move(faces),
85 std::move(resource),
86 scale,
87 std::move(normals),
88 std::move(vertex_colors),
89 std::move(mesh_material),
90 std::move(mesh_textures),
92 {
93 }
94
112 ConvexMesh(std::shared_ptr<const tesseract_common::VectorVector3d> vertices,
113 std::shared_ptr<const Eigen::VectorXi> faces,
114 int face_count,
116 const Eigen::Vector3d& scale = Eigen::Vector3d(1, 1, 1),
117 std::shared_ptr<const tesseract_common::VectorVector3d> normals = nullptr,
118 std::shared_ptr<const tesseract_common::VectorVector4d> vertex_colors = nullptr,
119 MeshMaterial::Ptr mesh_material = nullptr,
120 std::shared_ptr<const std::vector<MeshTexture::Ptr>> mesh_textures = nullptr)
121 : PolygonMesh(std::move(vertices),
122 std::move(faces),
123 face_count,
124 std::move(resource),
125 scale,
126 std::move(normals),
127 std::move(vertex_colors),
128 std::move(mesh_material),
129 std::move(mesh_textures),
131 {
132 }
133
134 ConvexMesh() = default;
135 ~ConvexMesh() override = default;
136
143
150
151 Geometry::Ptr clone() const override
152 {
153 return std::make_shared<ConvexMesh>(getVertices(), getFaces(), getFaceCount(), getResource(), getScale());
154 }
155 bool operator==(const ConvexMesh& rhs) const;
156 bool operator!=(const ConvexMesh& rhs) const;
157
158private:
160
162 template <class Archive>
163 void serialize(Archive& ar, const unsigned int version); // NOLINT
164};
165} // namespace tesseract_geometry
166
167BOOST_CLASS_EXPORT_KEY2(tesseract_geometry::ConvexMesh, "ConvexMesh")
168#endif
std::shared_ptr< const Resource > ConstPtr
Definition: resource_locator.h:102
Definition: convex_mesh.h:44
void setCreationMethod(CreationMethod method)
Set the method used to create the convex mesh.
Definition: convex_mesh.h:149
~ConvexMesh() override=default
void serialize(Archive &ar, const unsigned int version)
Definition: convex_mesh.cpp:48
Geometry::Ptr clone() const override
Create a copy of this shape.
Definition: convex_mesh.h:151
std::shared_ptr< const ConvexMesh > ConstPtr
Definition: convex_mesh.h:51
ConvexMesh(std::shared_ptr< const tesseract_common::VectorVector3d > vertices, std::shared_ptr< const Eigen::VectorXi > faces, int face_count, tesseract_common::Resource::ConstPtr resource=nullptr, const Eigen::Vector3d &scale=Eigen::Vector3d(1, 1, 1), std::shared_ptr< const tesseract_common::VectorVector3d > normals=nullptr, std::shared_ptr< const tesseract_common::VectorVector4d > vertex_colors=nullptr, MeshMaterial::Ptr mesh_material=nullptr, std::shared_ptr< const std::vector< MeshTexture::Ptr > > mesh_textures=nullptr)
Convex Mesh geometry.
Definition: convex_mesh.h:112
bool operator!=(const ConvexMesh &rhs) const
Definition: convex_mesh.cpp:45
CreationMethod
Definition: convex_mesh.h:54
@ CONVERTED
Definition: convex_mesh.h:57
@ DEFAULT
Definition: convex_mesh.h:55
@ MESH
Definition: convex_mesh.h:56
ConvexMesh(std::shared_ptr< const tesseract_common::VectorVector3d > vertices, std::shared_ptr< const Eigen::VectorXi > faces, tesseract_common::Resource::ConstPtr resource=nullptr, const Eigen::Vector3d &scale=Eigen::Vector3d(1, 1, 1), std::shared_ptr< const tesseract_common::VectorVector3d > normals=nullptr, std::shared_ptr< const tesseract_common::VectorVector4d > vertex_colors=nullptr, MeshMaterial::Ptr mesh_material=nullptr, std::shared_ptr< const std::vector< MeshTexture::Ptr > > mesh_textures=nullptr)
Convex Mesh geometry.
Definition: convex_mesh.h:75
CreationMethod getCreationMethod() const
Get how the convex hull was created.
Definition: convex_mesh.h:142
friend class boost::serialization::access
Definition: convex_mesh.h:161
bool operator==(const ConvexMesh &rhs) const
Definition: convex_mesh.cpp:38
std::shared_ptr< ConvexMesh > Ptr
Definition: convex_mesh.h:50
CreationMethod creation_method_
Definition: convex_mesh.h:159
std::shared_ptr< Geometry > Ptr
Definition: geometry.h:62
std::shared_ptr< MeshMaterial > Ptr
Definition: mesh_material.h:63
Definition: polygon_mesh.h:46
const std::shared_ptr< const Eigen::VectorXi > & getFaces() const
Get Polygon mesh faces.
Definition: polygon_mesh.h:152
int getFaceCount() const
Get face count.
Definition: polygon_mesh.h:164
tesseract_common::Resource::ConstPtr getResource() const
Get the path to file used to generate the mesh.
Definition: polygon_mesh.h:173
const std::shared_ptr< const tesseract_common::VectorVector3d > & getVertices() const
Get Polygon mesh vertices.
Definition: polygon_mesh.h:146
const Eigen::Vector3d & getScale() const
Get the scale applied to file used to generate the mesh.
Definition: polygon_mesh.h:179
double scale
Definition: collision_margin_data_unit.cpp:133
Common Tesseract Macros.
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
Tesseract Mesh Material read from a mesh file.
Definition: create_convex_hull.cpp:36
Definition: geometry.h:39
GeometryType
Definition: geometry.h:41
@ CONVEX_MESH
Definition: geometry.h:50
Tesseract Polygon Mesh Geometry.
Resource::Ptr resource
Definition: resource_locator_unit.cpp:59
Tesseract Geometries.
std::shared_ptr< const Eigen::VectorXi > faces
Definition: tesseract_geometry_unit.cpp:16