21 #ifndef SURGSIM_MATH_MESHSHAPE_H
22 #define SURGSIM_MATH_MESHSHAPE_H
62 template <
class VertexData,
class EdgeData,
class TriangleData>
72 std::shared_ptr<SurgSim::DataStructures::TriangleMesh>
getInitialMesh();
76 std::shared_ptr<SurgSim::DataStructures::TriangleMesh>
getMesh();
81 virtual double getVolume()
const override;
103 std::shared_ptr<SurgSim::DataStructures::AabbTree>
getAabbTree();
111 virtual bool doLoad(
const std::string& filePath)
override;
128 std::shared_ptr<SurgSim::DataStructures::TriangleMesh>
m_mesh;
134 std::shared_ptr<SurgSim::DataStructures::AabbTree>
m_aabbTree;
142 #endif // SURGSIM_MATH_MESHSHAPE_H
virtual Matrix33d getSecondMomentOfVolume() const override
Get the second central moment of the volume, commonly used to calculate the moment of inertia matrix...
Definition: MeshShape.cpp:86
Definition: DriveElementFromInputBehavior.cpp:27
This class is used to facilitate file loading.
Definition: Asset.h:33
std::shared_ptr< SurgSim::DataStructures::TriangleMesh > m_initialMesh
The initial triangle mesh contained by this shape.
Definition: MeshShape.h:131
bool isValid() const
Check if this shape contains a valid mesh.
Definition: MeshShape.cpp:37
SURGSIM_STATIC_REGISTRATION(BoxShape)
virtual int getType() override
Definition: MeshShape.cpp:32
::SurgSim::Math::Vector3d Vector3d
Definition: Shape.h:62
Mesh shape: shape made of a triangle mesh The triangle mesh needs to be watertight to produce valid v...
Definition: MeshShape.h:53
std::shared_ptr< SurgSim::DataStructures::AabbTree > getAabbTree()
Get the AabbTree.
Definition: MeshShape.cpp:192
double m_volume
Volume (in m^-3)
Definition: MeshShape.h:122
void updateAabbTree()
Update the AabbTree, which is an axis-aligned bounding box r-tree used to accelerate spatial searches...
Definition: MeshShape.cpp:197
void setPose(const SurgSim::Math::RigidTransform3d &pose)
Set the object's global pose.
Definition: MeshShape.cpp:186
std::shared_ptr< SurgSim::DataStructures::TriangleMesh > m_mesh
The triangle mesh contained by this shape.
Definition: MeshShape.h:128
std::shared_ptr< SurgSim::DataStructures::TriangleMesh > getInitialMesh()
Gets the initial mesh.
Definition: MeshShape.cpp:56
std::shared_ptr< SurgSim::DataStructures::AabbTree > m_aabbTree
The aabb tree used to accelerate collision detection against the mesh.
Definition: MeshShape.h:134
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
std::shared_ptr< SurgSim::DataStructures::TriangleMesh > getMesh()
Get mesh.
Definition: MeshShape.cpp:61
Basic class for storing Triangle Meshes, handling basic vertex, edge, and triangle functionality...
Definition: TriangleMeshBase.h:58
SURGSIM_CLASSNAME(SurgSim::Math::MeshShape)
virtual Vector3d getCenter() const override
Get the volumetric center of the shape.
Definition: MeshShape.cpp:76
SurgSim::Math::Matrix33d m_secondMomentOfVolume
Second moment of volume.
Definition: MeshShape.h:125
virtual double getVolume() const override
Get the volume of the shape.
Definition: MeshShape.cpp:66
MeshShape()
Constructor.
Definition: MeshShape.cpp:27
virtual bool doLoad(const std::string &filePath) override
Derived classes will overwrite this method to do actual loading.
Definition: MeshShape.cpp:42
::SurgSim::Math::Matrix33d Matrix33d
Definition: Shape.h:63
SurgSim::Math::Vector3d m_center
Center (considering a uniform distribution in the mesh volume)
Definition: MeshShape.h:119
void computeVolumeIntegrals()
Compute useful volume integrals based on the triangle mesh, which are used to get the volume ...
Definition: MeshShape.cpp:116
Eigen::Matrix< double, 3, 3, Eigen::RowMajor > Matrix33d
A 3x3 matrix of doubles.
Definition: Matrix.h:51
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:56
Generic rigid shape class defining a shape.
Definition: Shape.h:59