3 #include <SimoxUtility/shapes/AxisAlignedBoundingBox.h>
5 #include <VirtualRobot/ManipulationObject.h>
6 #include <VirtualRobot/math/Helpers.h>
7 #include <VirtualRobot/Visualization/TriMeshModel.h>
16 const std::string& objectClassName)
18 , objectClassName(objectClassName)
23 return object->getGlobalPosition();
30 object->setGlobalPose(pose);
42 object->setGlobalPose(pose);
47 VirtualRobot::TriMeshModelPtr triMesh =
object->getCollisionModel()->getTriMeshModel();
49 std::vector<VirtualRobot::MathTools::TriangleFace>
const& faces = triMesh->faces;
50 std::vector<Eigen::Vector3f>
const& vertices = triMesh->vertices;
53 semrel::TriMesh result;
55 for (VirtualRobot::MathTools::TriangleFace
const& face : faces)
57 Eigen::Vector3f v0 = vertices.at(face.id1);
58 Eigen::Vector3f v1 = vertices.at(face.id2);
59 Eigen::Vector3f v2 = vertices.at(face.id3);
61 Eigen::Vector3f normal = face.normal;
63 semrel::TriMesh::Triangle triangle;
64 triangle.v0 = result.numVertices();
66 triangle.v1 = result.numVertices();
68 triangle.v2 = result.numVertices();
71 int n = result.numNormals();
75 result.addNormal(normal);
77 result.addTriangle(triangle);
86 const VirtualRobot::BoundingBox& bb =
object->getCollisionModel()->getTriMeshModel()->boundingBox;
87 return { bb.getMin(), bb.getMax() };
93 const std::vector<Eigen::Vector3f> vertices =
object->getCollisionModel()->getModelVeticesGlobal();
96 for (Eigen::Vector3f
v : vertices)
101 return { aabb.limits() };
118 return object->getName();