INNER CODE UNIT · C++
bn
mosra/magnum-integration · src/Magnum/DartIntegration/ConvertShapeNode.cpp:349
const dart::dynamics::SoftBodyNode* bn = meshShape->getSoftBodyNode();
/* Prepare vertex data */
struct Vertex {
Vector3 position;
Vector3 normal;
};
Containers::Array<char> vertexData{NoInit,
sizeof(Vertex)*bn->getNumPointMasses()};
auto vertices = Containers::arrayCast<Vertex>(vertexData);
Containers::StridedArrayView1D<Vector3> positions{vertexData,
&vertices[0].position, bn->getNumPointMasses(), sizeof(Vertex)};
Containers::StridedArrayView1D<Vector3> normals{vertexData,
&vertices[0].normal, bn->getNumPointMasses(), sizeof(Vertex)};
/* Get vertex positions from SoftBody */
for(UnsignedInt i = 0; i < bn->getNumPointMasses(); ++i) {
const Eigen::Vector3d& pos = bn->getPointMass(i)->getLocalPosition();