Tesseract 0.28.4
Loading...
Searching...
No Matches
tesseract::geometry::PolygonMesh Class Reference
Inheritance diagram for tesseract::geometry::PolygonMesh:

Public Types

using Ptr = std::shared_ptr<PolygonMesh>
using ConstPtr = std::shared_ptr<const PolygonMesh>
Public Types inherited from tesseract::geometry::Geometry
using Ptr = std::shared_ptr<Geometry>
using ConstPtr = std::shared_ptr<const Geometry>

Public Member Functions

 PolygonMesh (std::shared_ptr< const tesseract::common::VectorVector3d > vertices, std::shared_ptr< const Eigen::VectorXi > faces, std::shared_ptr< const tesseract::common::Resource > 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, std::shared_ptr< MeshMaterial > mesh_material=nullptr, std::shared_ptr< const std::vector< std::shared_ptr< MeshTexture > > > mesh_textures=nullptr, GeometryType type=GeometryType::POLYGON_MESH)
 Polygon Mesh geometry.
 PolygonMesh (std::shared_ptr< const tesseract::common::VectorVector3d > vertices, std::shared_ptr< const Eigen::VectorXi > faces, int face_count, std::shared_ptr< const tesseract::common::Resource > 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, std::shared_ptr< MeshMaterial > mesh_material=nullptr, std::shared_ptr< const std::vector< std::shared_ptr< MeshTexture > > > mesh_textures=nullptr, GeometryType type=GeometryType::POLYGON_MESH)
 Polygon Mesh geometry.
const std::shared_ptr< const tesseract::common::VectorVector3d > & getVertices () const
 Get Polygon mesh vertices.
const std::shared_ptr< const Eigen::VectorXi > & getFaces () const
 Get Polygon mesh faces.
int getVertexCount () const
 Get vertex count.
int getFaceCount () const
 Get face count.
std::shared_ptr< const tesseract::common::Resource > getResource () const
 Get the path to file used to generate the mesh.
const Eigen::Vector3d & getScale () const
 Get the scale applied to file used to generate the mesh.
const std::shared_ptr< const tesseract::common::VectorVector3d > & getNormals () const
 Get the vertex normal vectors.
const std::shared_ptr< const tesseract::common::VectorVector4d > & getVertexColors () const
 Get the vertex colors.
std::shared_ptr< const MeshMaterial > getMaterial () const
 Get material data extracted from the mesh file.
const std::shared_ptr< const std::vector< std::shared_ptr< MeshTexture > > > & getTextures () const
 Get textures extracted from the mesh file.
Geometry::Ptr clone () const override
 Create a copy of this shape.
bool operator== (const PolygonMesh &rhs) const
bool operator!= (const PolygonMesh &rhs) const
Public Member Functions inherited from tesseract::geometry::Geometry
 Geometry (GeometryType type=GeometryType::UNINITIALIZED)
 Geometry (const Geometry &)=default
Geometry & operator= (const Geometry &)=default
 Geometry (Geometry &&)=default
Geometry & operator= (Geometry &&)=default
GeometryType getType () const
 Get the geometry type.
void setUUID (const boost::uuids::uuid &uuid)
 Set the geometry UUID.
const boost::uuids::uuid & getUUID () const
 Get the geometry UUID.
bool operator== (const Geometry &rhs) const
bool operator!= (const Geometry &rhs) const

Protected Member Functions

std::shared_ptr< MeshMaterial > cloneMaterial () const
 Deep copy of the mesh material, or nullptr when there is none.

Friends

template<class Archive>
friend void::tesseract::geometry::serialize (Archive &ar, PolygonMesh &obj)

Constructor & Destructor Documentation

◆ PolygonMesh() [1/2]

tesseract::geometry::PolygonMesh::PolygonMesh ( std::shared_ptr< const tesseract::common::VectorVector3d > vertices,
std::shared_ptr< const Eigen::VectorXi > faces,
std::shared_ptr< const tesseract::common::Resource > 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,
std::shared_ptr< MeshMaterial > mesh_material = nullptr,
std::shared_ptr< const std::vector< std::shared_ptr< MeshTexture > > > mesh_textures = nullptr,
GeometryType type = GeometryType::POLYGON_MESH )

Polygon Mesh geometry.

Parameters
verticesA vector of vertices associated with the mesh
facesA vector of face indices, where the first number indicates the number of vertices associated with the face, followed by the vertex index in parameter vertices. For example, a triangle has three vertices, so there should be four inputs, where the first should be 3, indicating there are three vertices that define this face, followed by three indices.
resourceA resource locator for locating resource
scaleScale the mesh
normalsA vector of normals for the vertices (optional)
vertex_colorsA vector of colors (RGBA) for the vertices (optional)
mesh_materialA MeshMaterial describing the color and material properties of the mesh (optional)
mesh_texturesA vector of MeshTexture to apply to the mesh (optional)

◆ PolygonMesh() [2/2]

tesseract::geometry::PolygonMesh::PolygonMesh ( std::shared_ptr< const tesseract::common::VectorVector3d > vertices,
std::shared_ptr< const Eigen::VectorXi > faces,
int face_count,
std::shared_ptr< const tesseract::common::Resource > 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,
std::shared_ptr< MeshMaterial > mesh_material = nullptr,
std::shared_ptr< const std::vector< std::shared_ptr< MeshTexture > > > mesh_textures = nullptr,
GeometryType type = GeometryType::POLYGON_MESH )

Polygon Mesh geometry.

Parameters
verticesA vector of vertices associated with the mesh
facesA vector of face indices, where the first number indicates the number of vertices associated with the face, followed by the vertex index in parameter vertices. For example, a triangle has three vertices, so there should be four inputs, where the first should be 3, indicating there are three vertices that define this face, followed by three indices.
face_countProvide the number of faces. This is faster because it does not need to loop over the faces.
resourceA resource locator for locating resource
scaleScale the mesh
normalsA vector of normals for the vertices (optional)
vertex_colorsA vector of colors (RGBA) for the vertices (optional)
mesh_materialDescribes the color and material properties of the mesh (optional)
mesh_texturesA vector of MeshTexture to apply to the mesh (optional)

Member Function Documentation

◆ getVertices()

const std::shared_ptr< const tesseract::common::VectorVector3d > & tesseract::geometry::PolygonMesh::getVertices ( ) const

Get Polygon mesh vertices.

Returns
A vector of vertices

◆ getFaces()

const std::shared_ptr< const Eigen::VectorXi > & tesseract::geometry::PolygonMesh::getFaces ( ) const

Get Polygon mesh faces.

Returns
A vector of face indices

◆ getVertexCount()

int tesseract::geometry::PolygonMesh::getVertexCount ( ) const

Get vertex count.

Returns
Number of vertices

◆ getFaceCount()

int tesseract::geometry::PolygonMesh::getFaceCount ( ) const

Get face count.

Returns
Number of faces

◆ getResource()

tesseract::common::Resource::ConstPtr tesseract::geometry::PolygonMesh::getResource ( ) const

Get the path to file used to generate the mesh.

Note: If empty, assume it was manually generated.

Returns
Absolute path to the mesh file

◆ getScale()

const Eigen::Vector3d & tesseract::geometry::PolygonMesh::getScale ( ) const

Get the scale applied to file used to generate the mesh.

Returns
The scale x, y, z

◆ getNormals()

const std::shared_ptr< const tesseract::common::VectorVector3d > & tesseract::geometry::PolygonMesh::getNormals ( ) const

Get the vertex normal vectors.

Optional, may be nullptr

Returns
The vertex normal vector

◆ getVertexColors()

const std::shared_ptr< const tesseract::common::VectorVector4d > & tesseract::geometry::PolygonMesh::getVertexColors ( ) const

Get the vertex colors.

Optional, may be nullptr

Returns
Vertex colors

◆ getMaterial()

MeshMaterial::ConstPtr tesseract::geometry::PolygonMesh::getMaterial ( ) const

Get material data extracted from the mesh file.

Mesh files contain material information. The mesh parser will extract the material information and store it in a MeshMaterial structure.

Returns
The MeshMaterial data extracted from mesh file

◆ getTextures()

const std::shared_ptr< const std::vector< MeshTexture::Ptr > > & tesseract::geometry::PolygonMesh::getTextures ( ) const

Get textures extracted from the mesh file.

Mesh files contain (or reference) image files that form textures on the surface of the mesh. UV coordinates specify how the image is applied to the mesh. The MeshTexture structure contains a resource to the image, and the UV coordinates. Currently only jpg and png image formats are supported.

Returns
Vector of mesh textures

◆ clone()

Geometry::Ptr tesseract::geometry::PolygonMesh::clone ( ) const
overridevirtual

Create a copy of this shape.

Implements tesseract::geometry::Geometry.

◆ operator==()

bool tesseract::geometry::PolygonMesh::operator== ( const PolygonMesh & rhs) const
Todo
Compare resource, normals and vertex colors

◆ cloneMaterial()

MeshMaterial::Ptr tesseract::geometry::PolygonMesh::cloneMaterial ( ) const
protected

Deep copy of the mesh material, or nullptr when there is none.

Used by clone() so a cloned mesh shares no mutable material state with its original