#ifndef XJOSGCOMMON_H #define XJOSGCOMMON_H #include #include #include #include #include class Point3D; #define OSG_TOL 0.001 #define OSG_PI 3.14159265358979324 bool isbig(float a, float b, float tol = OSG_TOL); bool issma(float a, float b, float tol = OSG_TOL); bool isequ(float a, float b, float tol = OSG_TOL); int cmp(float a, float b, float tol); bool isVec3Equal(osg::Vec3 &a, osg::Vec3 &b, float tol = OSG_TOL); bool isVec4Equal(osg::Vec4 &a, osg::Vec4 &b, float tol = OSG_TOL); bool isZero(float a); bool isZero(osg::Vec3 &a); bool isZero(osg::Vec4 &a); osg::Vec3 VectorCross(const osg::Vec3& a, const osg::Vec3& b); //osg::vec3ת»¯Îªpoint3D Point3D Vec3ToPoint3D(const osg::Vec3& value); osg::Vec3 Point3DToVec3(const Point3D& value); template int OSGFind(T &v, std::vector &vv) { for(int i = 0; i < (int)vv.size(); i++) { if(vv[i] == v) return i; } return -1; } osg::Node* FindNodeByName(osg::Group* pgroup, const char* name); #endif