11 using namespace vrecko;
13 namespace APSpacePartitioning {
16 #define SNCH_LMD_F_INTERSECTION 0x00000001
18 #define SNCH_LMD_F_NEGATIVE_DISTANCE 0x00000002
39 #define SNCH_FLOAT_SMALL_NUM 0.00000001f
41 #define SNCH_FLOAT_TOLERANCE SNCH_FLOAT_SMALL_NUM
45 #define SP_OBJECT_INTERFACE_ID__SNCH 20
56 virtual void preInitialize(
void);
66 unsigned long obj1ID,
unsigned long obj2ID);
71 unsigned long faces[2];
72 osg::Vec3 pointsTrans[2];
75 unsigned short closeFeatures[2];
84 typedef std::vector<LocalMinimumDistance>
LMDvector;
88 LMDStore() { active_LMD = 0; bLMDValid[0] = bLMDValid[1] =
false; }
116 inline LMD_HASH calcLMDHash(
unsigned long int id1,
unsigned long int id2)
119 LMDStore* getLMDStore(LMD_HASH hash);
136 osg::Matrix *transf1, osg::Matrix *transf2);
146 inline void reset() { planeNormal.x() = FLT_MAX; planeD = FLT_MAX; };
149 if (planeNormal.x() == FLT_MAX) {
150 planeNormal = (v[1].pos - v[0].pos) ^ (v[2].pos - v[0].pos);
151 float len = planeNormal.length();
162 if (planeD == FLT_MAX)
163 planeD = -(v[0].pos.x() * planeNormal.x() + v[0].pos.y() * planeNormal.y() + v[0].pos.z() * planeNormal.z());
178 } ProjectionIntersectionResult;
180 ProjectionIntersectionResult triProjectionIntersection(
183 osg::Vec3 *outIntersectionPoint0 = NULL,
184 osg::Vec3 *outIntersectionPoint1 = NULL,
186 bool bPerformPretests =
true
200 bool triIntersects(OneTri *points0, OneTri *points1, osg::Vec3 *outPoint0Trans = NULL, osg::Vec3 *outPoint1Trans = NULL,
201 osg::Vec3 *outPoint0Tri0Cross = NULL, osg::Vec3 *outPoint1Tri0Cross = NULL,
bool *bOutPointsTriCrossValid = NULL);
212 float triDistance(OneTri *points0, OneTri *points1, osg::Vec3 *outPoint1Trans = NULL, osg::Vec3 *outPoint2Trans = NULL,
213 unsigned short *closeFeature0 = NULL,
unsigned short *closeFeature1 = NULL);
222 osg::Vec3 point[2][7],
unsigned long *index1,
unsigned long *index2);