a few more changes to ubode

This commit is contained in:
UbitUmarov
2022-07-17 23:10:22 +01:00
parent 4b7ffc20c0
commit 4056aace24
5 changed files with 69 additions and 19 deletions
@@ -274,24 +274,25 @@ inline_ BOOL AABBCollider::TriBoxOverlap()
// First, test overlap in the {x,y,z}-directions
// find min, max of the triangle in x-direction, and test for overlap in X
if(FCMin3(v0.x, v1.x, v2.x)>extents.x) return FALSE;
if(FCMax3(v0.x, v1.x, v2.x)<-extents.x) return FALSE;
if (!inExtent(v0.x, v1.x, v2.x, extents.x))
return FALSE;
// same for Y
v0.y = mLeafVerts[0].y - center.y;
v1.y = mLeafVerts[1].y - center.y;
v2.y = mLeafVerts[2].y - center.y;
if(FCMin3(v0.y, v1.y, v2.y)>extents.y) return FALSE;
if(FCMax3(v0.y, v1.y, v2.y)<-extents.y) return FALSE;
if (!inExtent(v0.y, v1.y, v2.y, extents.y))
return FALSE;
// same for Z
v0.z = mLeafVerts[0].z - center.z;
v1.z = mLeafVerts[1].z - center.z;
v2.z = mLeafVerts[2].z - center.z;
if(FCMin3(v0.z, v1.z, v2.z)>extents.z) return FALSE;
if(FCMax3(v0.z, v1.z, v2.z)<-extents.z) return FALSE;
if (!inExtent(v0.z, v1.z, v2.z, extents.z))
return FALSE;
// 2) Test if the box intersects the plane of the triangle
// compute plane equation of triangle: normal*x+d=0
// ### could be precomputed since we use the same leaf triangle several times
+1 -1
View File
@@ -1,5 +1,5 @@
dnl AC_INIT does not take a macro as a version nr: set it separately! - Bram
AC_INIT([UBODE],[0.13.4],[ubode@opensimulator.org])
AC_INIT([UBODE],[0.13.4],[opensim-dev@opensimulator.org])
ODE_VERSION=OS0.13.4
AC_SUBST(ODE_VERSION)
@@ -34,9 +34,16 @@
#define dTRIMESH_16BIT_INDICES 0
/*
#define dOU_ENABLED 1
#define dATOMICS_ENABLED 1
#define dTLS_ENABLED 1
*/
#define dOU_ENABLED 0
#define dATOMICS_ENABLED 0
#define dTLS_ENABLED 0
#define dTHREADING_INTF_DISABLED 1
/* #define dBUILTIN_THREADING_IMPL_ENABLED 1 */
@@ -48,7 +48,19 @@ dContactGeom::g1 and dContactGeom::g2.
static void make_sure_plane_normal_has_unit_length (dxPlane *g)
{
dSafeNormalize3(g->p);
dReal *p = g->p;
dReal l = dCalcVectorLengthSquare3(p);
if (l > dEpsilon)
{
dScaleVector4(p, dRecipSqrt(l));
}
else
{
p[0] = 1;
p[1] = 0;
p[2] = 0;
p[3] = 0;
}
}
@@ -59,7 +71,19 @@ dxGeom (space,0)
p[0] = a;
p[1] = b;
p[2] = c;
p[3] = dSafeNormalize3(p) ? d : 0;
p[3] = d;
dReal l = dCalcVectorLengthSquare3(p);
if (l > dEpsilon)
{
dScaleVector4(p, dRecipSqrt(l));
}
else
{
p[0] = 1;
p[1] = 0;
p[2] = 0;
p[3] = 0;
}
}
void dxPlane::computeAABB()
@@ -144,10 +168,25 @@ dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d)
void dGeomPlaneSetParams (dGeomID g, dReal a, dReal b, dReal c, dReal d)
{
dUASSERT (g && g->type == dPlaneClass,"argument not a plane");
((dxPlane*)g)->p[0] = a;
((dxPlane*)g)->p[1] = b;
((dxPlane*)g)->p[2] = c;
((dxPlane*)g)->p[3] = dSafeNormalize3(((dxPlane*)g)->p) ? d : 0;
dReal* p = ((dxPlane*)g)->p;
p[0] = a;
p[1] = b;
p[2] = c;
p[3] = d;
dReal l = dCalcVectorLengthSquare3(p);
if (l > dEpsilon)
{
dScaleVector4(p, dRecipSqrt(l));
}
else
{
p[0] = 1;
p[1] = 0;
p[2] = 0;
p[3] = 0;
}
dGeomMoved (g);
}
@@ -120,24 +120,27 @@ void dGeomRaySet (dGeomID g, dReal px, dReal py, dReal pz,
{
dUASSERT (g && g->type == dRayClass,"argument not a ray");
dxPosR *rayPosR = g->GetRecomputePosR();
dReal* pos = rayPosR->pos;
pos[0] = px;
pos[1] = py;
pos[2] = pz;
dVector3 n;
n[0] = dx;
n[1] = dy;
n[2] = dz;
dNormalize3(n);
dReal* R = g->final_posr->R;
dReal* R = rayPosR->R;
R[2] = n[0];
R[6] = n[1];
R[10] = n[2];
dReal* pos = g->final_posr->pos;
pos[0] = px;
pos[1] = py;
pos[2] = pz;
dGeomMoved (g);
}
void dGeomRayGet (dGeomID g, dVector3 start, dVector3 dir)
{
dUASSERT (g && g->type == dRayClass,"argument not a ray");