void SofaBusiness::moveMesh(std::string idMesh, int x, int y, int z, float rx, float ry, float rz) { GNode *souris = groot; MechanicalObjectRigid3f *mechanical = (MechanicalObjectRigid3f*) (souris->getObject(sofa::core::objectmodel::TClassInfo<MechanicalObjectRigid3f>::get(), idMesh)); std::string name = mechanical->getName(); VecCoordRigid3f& coord = *mechanical->getX(); coord[0][0] = x; coord[0][1] = y; coord[0][2] = z; }
/** * @brief Bring OglModel of Sofa * * @param node : scene root of Sofa * @param model : OglModel vector at fill */ void SofaBusiness::fillOglModelVector(GNode *node, std::vector<OglModel*> *model) { sofa::helper::vector<sofa::core::objectmodel::BaseNode*> gchild = node->getChildren(); for (unsigned int i=0; i<gchild.size(); i++) { GNode *children = node->getChild(gchild[i]->getName()); OglModel *visu = (OglModel*) (children->getObject(sofa::core::objectmodel::TClassInfo<OglModel>::get(), "")); if (visu != NULL) { model->push_back(visu); } fillOglModelVector(children, model); } }
/** * @brief Bring SpringForceField of Sofa * * @param node : scene root of Sofa * @param model : SpringForceField map at fill */ void SofaBusiness::fillSpringForceField(GNode *node, std::map<std::string, StiffSpringForceField3*> *springs) { sofa::helper::vector<sofa::core::objectmodel::BaseNode*> gchild = node->getChildren(); for (unsigned int i=0; i<gchild.size(); i++) { GNode *children = node->getChild(gchild[i]->getName()); StiffSpringForceField3 *spring = (StiffSpringForceField3*) (children->getObject(sofa::core::objectmodel::TClassInfo<StiffSpringForceField3>::get(), "")); if (spring != NULL) { std::string name = spring->getName(); (*springs)[name] = spring; } fillSpringForceField(children, springs); } }