Biorbd Release_1.13.0
Loading...
Searching...
No Matches
Mesh.h
1#ifndef BIORBD_RIGIDBODY_MESH_H
2#define BIORBD_RIGIDBODY_MESH_H
3
4#include "biorbdConfig.h"
5
6#include <memory>
7#include <vector>
8
9namespace BIORBD_NAMESPACE {
10namespace utils {
11class Vector3d;
12class RotoTrans;
13class Path;
14} // namespace utils
15
16namespace rigidbody {
17class MeshFace;
18
22class BIORBD_API Mesh {
23 public:
27 Mesh();
28
33 Mesh(const std::vector<utils::Vector3d> &other);
34
40 Mesh(
41 const std::vector<utils::Vector3d> &vertex,
42 const std::vector<MeshFace> &faces);
43
48 Mesh DeepCopy() const;
49
54 void DeepCopy(const Mesh &other);
55
60 void setColor(const utils::Vector3d &color);
61
66 utils::Vector3d &color() const;
67
71 bool hasMesh() const;
72
77 void addPoint(const utils::Vector3d &node);
78
84 const utils::Vector3d &point(size_t idx) const;
85
90 size_t nbVertex() const;
91
96 void rotate(const utils::RotoTrans &rt);
97
103
110 void scale(const utils::Vector3d &scaler);
111
116 utils::Vector3d &getScale() const;
117
122 void addFace(const MeshFace &face);
123
128 void addFace(const std::vector<int> &face);
129
134 const std::vector<MeshFace> &faces() const;
135
141 const MeshFace &face(size_t idx) const;
142
147 size_t nbFaces();
148
153 void setPath(const utils::Path &path);
154
159 utils::Path &path();
160
165 const utils::Path &path() const;
166
167 protected:
168 std::shared_ptr<utils::RotoTrans> m_rotation;
169 std::shared_ptr<std::vector<utils::Vector3d>> m_vertex;
170 std::shared_ptr<std::vector<MeshFace>> m_faces;
171 std::shared_ptr<utils::Path> m_pathFile;
172 std::shared_ptr<utils::Vector3d> m_patchColor;
173 std::shared_ptr<utils::Vector3d> m_scale;
174};
175
176} // namespace rigidbody
177} // namespace BIORBD_NAMESPACE
178
179#endif // BIORBD_RIGIDBODY_MESH_H
utils::RotoTrans & getRotation() const
Get the rotation applied to the vertex.
Definition Mesh.cpp:80
std::shared_ptr< utils::Vector3d > m_scale
The scale.
Definition Mesh.h:173
std::shared_ptr< std::vector< MeshFace > > m_faces
The faces.
Definition Mesh.h:170
void setColor(const utils::Vector3d &color)
Set the patch color.
Definition Mesh.cpp:58
void addFace(const MeshFace &face)
Add a face patch to the mesh.
Definition Mesh.cpp:94
std::shared_ptr< utils::RotoTrans > m_rotation
The rotation.
Definition Mesh.h:168
size_t nbVertex() const
Returns the number of vertex.
Definition Mesh.cpp:71
const utils::Vector3d & point(size_t idx) const
Return the point of a specific index.
Definition Mesh.cpp:68
void addPoint(const utils::Vector3d &node)
Add a point to the mesh.
Definition Mesh.cpp:65
void scale(const utils::Vector3d &scaler)
Scale the vertex wrt to 0, 0, 0. Warnign, this function is applied when called, meaning that if it is...
Definition Mesh.cpp:82
void rotate(const utils::RotoTrans &rt)
rotateVertex Apply the RT to the vertex
Definition Mesh.cpp:73
const MeshFace & face(size_t idx) const
Return the face of the mesh of a specified idx.
Definition Mesh.cpp:103
std::shared_ptr< std::vector< utils::Vector3d > > m_vertex
The vertex.
Definition Mesh.h:169
utils::Vector3d & color() const
Get the patch color.
Definition Mesh.cpp:62
void setPath(const utils::Path &path)
Set the path of the underlying mesh file.
Definition Mesh.cpp:107
std::shared_ptr< utils::Path > m_pathFile
The path to the mesh file.
Definition Mesh.h:171
bool hasMesh() const
Return if there is a mesh.
Definition Mesh.cpp:64
const std::vector< MeshFace > & faces() const
Return the faces of the mesh.
Definition Mesh.cpp:100
utils::Vector3d & getScale() const
Get the scaling applied to the vertex wrt to 0, 0, 0.
Definition Mesh.cpp:91
std::shared_ptr< utils::Vector3d > m_patchColor
The color of faces.
Definition Mesh.h:172
utils::Path & path()
Return the path of the mesh file.
Definition Mesh.cpp:109
size_t nbFaces()
Return the number of faces.
Definition Mesh.cpp:93
Mesh DeepCopy() const
Deep copy of the mesh.
Definition Mesh.cpp:37
Collection of methods to manipulate path.
Definition Path.h:16
Homogenous matrix to describe translations and rotations simultaneously.
Definition RotoTrans.h:33
Wrapper around Eigen Vector3d and attach it to a parent.
Definition Vector3d.h:27