26#ifndef TESSERACT_GEOMETRY_MESH_H
27#define TESSERACT_GEOMETRY_MESH_H
32#include <boost/serialization/access.hpp>
33#include <boost/serialization/export.hpp>
34#include <Eigen/Geometry>
49 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
52 using Ptr = std::shared_ptr<Mesh>;
69 Mesh(std::shared_ptr<const tesseract_common::VectorVector3d> vertices,
70 std::shared_ptr<const Eigen::VectorXi> triangles,
72 const Eigen::Vector3d&
scale = Eigen::Vector3d(1, 1, 1),
73 std::shared_ptr<const tesseract_common::VectorVector3d> normals =
nullptr,
74 std::shared_ptr<const tesseract_common::VectorVector4d> vertex_colors =
nullptr,
76 std::shared_ptr<
const std::vector<MeshTexture::Ptr>> mesh_textures =
nullptr)
82 std::move(vertex_colors),
83 std::move(mesh_material),
84 std::move(mesh_textures),
88 std::throw_with_nested(std::runtime_error(
"Mesh is not triangular"));
106 Mesh(std::shared_ptr<const tesseract_common::VectorVector3d> vertices,
107 std::shared_ptr<const Eigen::VectorXi> triangles,
110 const Eigen::Vector3d&
scale = Eigen::Vector3d(1, 1, 1),
111 std::shared_ptr<const tesseract_common::VectorVector3d> normals =
nullptr,
112 std::shared_ptr<const tesseract_common::VectorVector4d> vertex_colors =
nullptr,
114 std::shared_ptr<
const std::vector<MeshTexture::Ptr>> mesh_textures =
nullptr)
116 std::move(triangles),
121 std::move(vertex_colors),
122 std::move(mesh_material),
123 std::move(mesh_textures),
127 std::throw_with_nested(std::runtime_error(
"Mesh is not triangular"));
136 std::shared_ptr<Mesh> ptr;
168 template <
class Archive>
169 void serialize(Archive& ar,
const unsigned int version);
std::shared_ptr< const Resource > ConstPtr
Definition: resource_locator.h:102
std::shared_ptr< Resource > Ptr
Definition: resource_locator.h:101
std::shared_ptr< Geometry > Ptr
Definition: geometry.h:62
std::shared_ptr< MeshMaterial > Ptr
Definition: mesh_material.h:63
void serialize(Archive &ar, const unsigned int version)
Definition: mesh.cpp:47
Geometry::Ptr clone() const override
Create a copy of this shape.
Definition: mesh.h:133
Mesh(std::shared_ptr< const tesseract_common::VectorVector3d > vertices, std::shared_ptr< const Eigen::VectorXi > triangles, tesseract_common::Resource::Ptr 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)
Mesh geometry.
Definition: mesh.h:69
friend class boost::serialization::access
Definition: mesh.h:167
bool operator==(const Mesh &rhs) const
Definition: mesh.cpp:38
Mesh(std::shared_ptr< const tesseract_common::VectorVector3d > vertices, std::shared_ptr< const Eigen::VectorXi > triangles, int triangle_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)
Mesh geometry.
Definition: mesh.h:106
bool operator!=(const Mesh &rhs) const
Definition: mesh.cpp:44
std::shared_ptr< const Mesh > ConstPtr
Definition: mesh.h:53
std::shared_ptr< Mesh > Ptr
Definition: mesh.h:52
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
const std::shared_ptr< const std::vector< MeshTexture::Ptr > > & getTextures() const
Get textures extracted from the mesh file.
Definition: polygon_mesh.h:219
const std::shared_ptr< const tesseract_common::VectorVector4d > & getVertexColors() const
Get the vertex colors.
Definition: polygon_mesh.h:197
MeshMaterial::ConstPtr getMaterial() const
Get material data extracted from the mesh file.
Definition: polygon_mesh.h:207
const std::shared_ptr< const tesseract_common::VectorVector3d > & getNormals() const
Get the vertex normal vectors.
Definition: polygon_mesh.h:188
double scale
Definition: collision_margin_data_unit.cpp:133
#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
@ MESH
Definition: geometry.h:49
Tesseract Polygon Mesh Geometry.
Locate and retrieve resource data.
Resource::Ptr resource
Definition: resource_locator_unit.cpp:59