polygon_mesh.h
Go to the documentation of this file.
1 
26 #ifndef TESSERACT_GEOMETRY_POLYGON_MESH_H
27 #define TESSERACT_GEOMETRY_POLYGON_MESH_H
28 
31 #include <boost/serialization/export.hpp>
32 #include <Eigen/Geometry>
33 #include <memory>
35 
36 #include <tesseract_common/fwd.h>
38 
40 
41 namespace boost::serialization
42 {
43 class access;
44 }
45 
46 namespace tesseract_geometry
47 {
48 class MeshMaterial;
49 class MeshTexture;
50 
51 class PolygonMesh : public Geometry
52 {
53 public:
54  // LCOV_EXCL_START
55  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
56  // LCOV_EXCL_STOP
57 
58  using Ptr = std::shared_ptr<PolygonMesh>;
59  using ConstPtr = std::shared_ptr<const PolygonMesh>;
60 
76  PolygonMesh(std::shared_ptr<const tesseract_common::VectorVector3d> vertices,
77  std::shared_ptr<const Eigen::VectorXi> faces,
78  std::shared_ptr<const tesseract_common::Resource> resource = nullptr,
79  const Eigen::Vector3d& scale = Eigen::Vector3d(1, 1, 1), // NOLINT
80  std::shared_ptr<const tesseract_common::VectorVector3d> normals = nullptr,
81  std::shared_ptr<const tesseract_common::VectorVector4d> vertex_colors = nullptr,
82  std::shared_ptr<MeshMaterial> mesh_material = nullptr,
83  std::shared_ptr<const std::vector<std::shared_ptr<MeshTexture>>> mesh_textures = nullptr,
85 
103  PolygonMesh(std::shared_ptr<const tesseract_common::VectorVector3d> vertices,
104  std::shared_ptr<const Eigen::VectorXi> faces,
105  int face_count,
106  std::shared_ptr<const tesseract_common::Resource> resource = nullptr,
107  const Eigen::Vector3d& scale = Eigen::Vector3d(1, 1, 1), // NOLINT
108  std::shared_ptr<const tesseract_common::VectorVector3d> normals = nullptr,
109  std::shared_ptr<const tesseract_common::VectorVector4d> vertex_colors = nullptr,
110  std::shared_ptr<MeshMaterial> mesh_material = nullptr,
111  std::shared_ptr<const std::vector<std::shared_ptr<MeshTexture>>> mesh_textures = nullptr,
113 
114  PolygonMesh() = default;
115  ~PolygonMesh() override = default;
116 
121  const std::shared_ptr<const tesseract_common::VectorVector3d>& getVertices() const;
122 
127  const std::shared_ptr<const Eigen::VectorXi>& getFaces() const;
128 
133  int getVertexCount() const;
134 
139  int getFaceCount() const;
140 
148  std::shared_ptr<const tesseract_common::Resource> getResource() const;
149 
154  const Eigen::Vector3d& getScale() const;
155 
163  const std::shared_ptr<const tesseract_common::VectorVector3d>& getNormals() const;
164 
172  const std::shared_ptr<const tesseract_common::VectorVector4d>& getVertexColors() const;
173 
182  std::shared_ptr<const MeshMaterial> getMaterial() const;
183 
194  const std::shared_ptr<const std::vector<std::shared_ptr<MeshTexture>>>& getTextures() const;
195 
196  Geometry::Ptr clone() const override;
197 
198  bool operator==(const PolygonMesh& rhs) const;
199  bool operator!=(const PolygonMesh& rhs) const;
200 
201 private:
202  std::shared_ptr<const tesseract_common::VectorVector3d> vertices_;
203  std::shared_ptr<const Eigen::VectorXi> faces_;
204 
205  int vertex_count_{ 0 };
206  int face_count_{ 0 };
207  std::shared_ptr<const tesseract_common::Resource> resource_;
208  Eigen::Vector3d scale_;
209  std::shared_ptr<const tesseract_common::VectorVector3d> normals_;
210  std::shared_ptr<const tesseract_common::VectorVector4d> vertex_colors_;
211  std::shared_ptr<MeshMaterial> mesh_material_;
212  std::shared_ptr<const std::vector<std::shared_ptr<MeshTexture>>> mesh_textures_;
213 
216  template <class Archive>
217  void serialize(Archive& ar, const unsigned int version); // NOLINT
218 };
219 
220 } // namespace tesseract_geometry
221 
222 BOOST_CLASS_EXPORT_KEY(tesseract_geometry::PolygonMesh)
223 #endif // POLYGON_MESH_H
tesseract_geometry::PolygonMesh::mesh_textures_
std::shared_ptr< const std::vector< std::shared_ptr< MeshTexture > > > mesh_textures_
Definition: polygon_mesh.h:212
tesseract_geometry::Geometry::Ptr
std::shared_ptr< Geometry > Ptr
Definition: geometry.h:72
tesseract_geometry::Geometry
Definition: geometry.h:69
tesseract_geometry::PolygonMesh::access
friend class boost::serialization::access
Definition: polygon_mesh.h:214
geometry.h
Tesseract Geometries.
tesseract_geometry::PolygonMesh::getVertexCount
int getVertexCount() const
Get vertex count.
Definition: polygon_mesh.cpp:100
tesseract_geometry::PolygonMesh::clone
Geometry::Ptr clone() const override
Create a copy of this shape.
Definition: polygon_mesh.cpp:119
tesseract_geometry::GeometryType
GeometryType
Definition: geometry.h:48
tesseract_geometry::PolygonMesh::getMaterial
std::shared_ptr< const MeshMaterial > getMaterial() const
Get material data extracted from the mesh file.
Definition: polygon_mesh.cpp:115
tesseract_geometry::PolygonMesh::operator!=
bool operator!=(const PolygonMesh &rhs) const
Definition: polygon_mesh.cpp:134
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
tesseract_geometry::PolygonMesh::getFaces
const std::shared_ptr< const Eigen::VectorXi > & getFaces() const
Get Polygon mesh faces.
Definition: polygon_mesh.cpp:98
tesseract_common::Serialization
tesseract_geometry::PolygonMesh::getNormals
const std::shared_ptr< const tesseract_common::VectorVector3d > & getNormals() const
Get the vertex normal vectors.
Definition: polygon_mesh.cpp:108
tesseract_geometry::PolygonMesh::scale_
Eigen::Vector3d scale_
Definition: polygon_mesh.h:208
tesseract_geometry::PolygonMesh::normals_
std::shared_ptr< const tesseract_common::VectorVector3d > normals_
Definition: polygon_mesh.h:209
tesseract_geometry::PolygonMesh::resource_
std::shared_ptr< const tesseract_common::Resource > resource_
Definition: polygon_mesh.h:207
tesseract_geometry::PolygonMesh::getFaceCount
int getFaceCount() const
Get face count.
Definition: polygon_mesh.cpp:102
tesseract_geometry::PolygonMesh::~PolygonMesh
~PolygonMesh() override=default
boost::serialization
tesseract_geometry::PolygonMesh::faces_
std::shared_ptr< const Eigen::VectorXi > faces_
Definition: polygon_mesh.h:203
tesseract_geometry::PolygonMesh::operator==
bool operator==(const PolygonMesh &rhs) const
Definition: polygon_mesh.cpp:124
tesseract_geometry::PolygonMesh::getScale
const Eigen::Vector3d & getScale() const
Get the scale applied to file used to generate the mesh.
Definition: polygon_mesh.cpp:106
tesseract_geometry::PolygonMesh::getVertexColors
const std::shared_ptr< const tesseract_common::VectorVector4d > & getVertexColors() const
Get the vertex colors.
Definition: polygon_mesh.cpp:110
fwd.h
eigen_types.h
tesseract_geometry::PolygonMesh::vertex_count_
int vertex_count_
Definition: polygon_mesh.h:205
tesseract_geometry::PolygonMesh
Definition: polygon_mesh.h:51
TESSERACT_COMMON_IGNORE_WARNINGS_POP
#define TESSERACT_COMMON_IGNORE_WARNINGS_POP
tesseract_geometry::PolygonMesh::vertex_colors_
std::shared_ptr< const tesseract_common::VectorVector4d > vertex_colors_
Definition: polygon_mesh.h:210
tesseract_geometry
Definition: fwd.h:31
tesseract_geometry::PolygonMesh::serialize
void serialize(Archive &ar, const unsigned int version)
Definition: polygon_mesh.cpp:137
tesseract_geometry::PolygonMesh::getTextures
const std::shared_ptr< const std::vector< std::shared_ptr< MeshTexture > > > & getTextures() const
Get textures extracted from the mesh file.
Definition: polygon_mesh.cpp:117
tesseract_geometry::PolygonMesh::vertices_
std::shared_ptr< const tesseract_common::VectorVector3d > vertices_
Definition: polygon_mesh.h:202
tesseract_geometry::GeometryType::POLYGON_MESH
@ POLYGON_MESH
tesseract_geometry::Geometry::ConstPtr
std::shared_ptr< const Geometry > ConstPtr
Definition: geometry.h:73
tesseract_geometry::PolygonMesh::PolygonMesh
PolygonMesh()=default
macros.h
tesseract_geometry::PolygonMesh::face_count_
int face_count_
Definition: polygon_mesh.h:206
tesseract_geometry::PolygonMesh::getVertices
const std::shared_ptr< const tesseract_common::VectorVector3d > & getVertices() const
Get Polygon mesh vertices.
Definition: polygon_mesh.cpp:96
tesseract_geometry::PolygonMesh::getResource
std::shared_ptr< const tesseract_common::Resource > getResource() const
Get the path to file used to generate the mesh.
Definition: polygon_mesh.cpp:104
tesseract_geometry::PolygonMesh::mesh_material_
std::shared_ptr< MeshMaterial > mesh_material_
Definition: polygon_mesh.h:211


tesseract_geometry
Author(s): Levi Armstrong
autogenerated on Sun May 18 2025 03:01:46