You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.0 KiB
C

1 month ago
#ifndef XJOSGCOMMON_H
#define XJOSGCOMMON_H
#include <osg/Vec3>
#include <osg/Vec4>
#include <osg/Geode>
#include <vector>
#include <map>
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ת<33><D7AA>Ϊpoint3D
Point3D Vec3ToPoint3D(const osg::Vec3& value);
osg::Vec3 Point3DToVec3(const Point3D& value);
template<class T> int OSGFind(T &v, std::vector<T> &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