I have a bunch of x, y and z points and have a bit of code that creates a triangular mesh.
I am now trying to get the triangles from this mesh
However, I get a crash when I get to the line where I'm creating the PoMeshFilled object.
2022-04-01_09-09-37.png
What is going wrong? I am using Open Inventor 9.8 and associated MeshViz version.
Thanks
Lisa
Code:
auto meshDataNode = new PoTriangleMesh2D(); meshDataNode->setGeometry(numPoints, x, y); meshDataNode->addValuesSet(0, z);
Code:
auto mesh = meshDataNode->mesh.getValue(); int numVals, numTris; const float* xVals = nullptr; // Not used const float* yVals = nullptr; // Not used const float* zVals = nullptr; // Not used const int32_t* indices = nullptr; mesh.getGeometry(numVals, xVals, yVals, zVals, numTris, indices); std::cout << numTris << " triangles created\n"; // Set the mesh data again, this time with Z coords and triangle indices int32_t* triIndices = new int32_t[numTris * 3]; memcpy(triIndices, indices, sizeof(int32_t) * numTris * 3); meshDataNode = new PoTriangleMesh2D(); meshDataNode->setGeometry(numVals, xvals, yvals, zvals, numTris, triIndices); m_scene->addChild(meshDataNode); // Finally create a node to render the mesh. auto meshDrawNode = new PoMeshFilled(); m_scene->addChild(meshDrawNode);
2022-04-01_09-09-37.png
What is going wrong? I am using Open Inventor 9.8 and associated MeshViz version.
Thanks
Lisa
Comment