00001 00031 #ifndef URDF2INVENTOR_IVHELPERS_H 00032 #define URDF2INVENTOR_IVHELPERS_H 00033 00034 #include <Inventor/nodes/SoTransform.h> 00035 #include <Inventor/nodes/SoSeparator.h> 00036 #include <Inventor/nodes/SoMaterial.h> 00037 00038 #include <Eigen/Core> 00039 #include <Eigen/Geometry> 00040 #include <set> 00041 00042 namespace urdf2inventor 00043 { 00044 00045 typedef Eigen::Transform<double, 3, Eigen::Affine> EigenTransform; 00046 00047 00050 extern void getBoundingBox(SoNode* node, Eigen::Vector3d& minPoint, Eigen::Vector3d& maxPoint); 00051 00052 00053 extern EigenTransform getEigenTransform(const SbMatrix& m); 00054 extern SbMatrix getSbMatrix(const urdf2inventor::EigenTransform& m); 00055 extern std::string printMatrix(const urdf2inventor::EigenTransform& t); 00056 00063 extern bool addSubNode(SoNode * addAsChild, SoNode* parent, 00064 const urdf2inventor::EigenTransform& eTrans, 00065 const char * name = NULL); 00066 00073 extern bool addSubNode(SoNode * addAsChild, SoNode* parent, SoTransform * trans, 00074 const char * transName = NULL); 00075 00081 extern void addSubNode(SoNode * addAsChild, SoSeparator * parent, 00082 const EigenTransform& transform, SoMaterial * mat, 00083 const char * name=NULL); 00084 00085 extern void addSphere(SoSeparator * addToNode, const Eigen::Vector3d& pos, float radius, 00086 float r, float g, float b, float a = 0); 00087 00088 extern void addBox(SoSeparator * addToNode, const EigenTransform& trans, 00089 float width, float height, float depth, 00090 float r, float g, float b, float a = 0); 00091 00099 extern void addCylinder(SoSeparator * addToNode, const Eigen::Vector3d& pos, 00100 const Eigen::Quaterniond& rot, 00101 float radius, float height, 00102 float r, float g, float b, float a = 0, 00103 const char * name = NULL); 00104 00111 extern void addCylinder(SoSeparator * addToNode, 00112 const urdf2inventor::EigenTransform& trans, 00113 float radius, float height, 00114 float r, float g, float b, float a = 0, 00115 const char * name = NULL); 00116 00117 extern void addLocalAxes(SoSeparator * addToNode, float axesRadius, float axesLength); 00118 00123 extern std::set<std::string> getAllTexturePaths(SoNode * root); 00124 00129 extern bool writeInventorFileString(SoNode * node, std::string& result); 00130 00131 00132 00133 } 00134 #endif // URDF2INVENTOR_IVHELPERS_H