31 aabbMin = aabbMin + expansionMin;
32 aabbMax = aabbMax + expansionMax;
40 overlap = (aabbMin1.
getX() > point.
getX() || aabbMax1.
getX() < point.
getX()) ?
false : overlap;
41 overlap = (aabbMin1.
getZ() > point.
getZ() || aabbMax1.
getZ() < point.
getZ()) ?
false : overlap;
42 overlap = (aabbMin1.
getY() > point.
getY() || aabbMax1.
getY() < point.
getY()) ?
false : overlap;
52 overlap = (aabbMin1.
getX() > aabbMax2.
getX() || aabbMax1.
getX() < aabbMin2.
getX()) ?
false : overlap;
53 overlap = (aabbMin1.
getZ() > aabbMax2.
getZ() || aabbMax1.
getZ() < aabbMin2.
getZ()) ?
false : overlap;
54 overlap = (aabbMin1.
getY() > aabbMax2.
getY() || aabbMax1.
getY() < aabbMin2.
getY()) ?
false : overlap;
66 if (
btMin(
btMin(p1[0], p2[0]), p3[0]) > aabbMax[0])
return false;
67 if (
btMax(
btMax(p1[0], p2[0]), p3[0]) < aabbMin[0])
return false;
69 if (
btMin(
btMin(p1[2], p2[2]), p3[2]) > aabbMax[2])
return false;
70 if (
btMax(
btMax(p1[2], p2[2]), p3[2]) < aabbMin[2])
return false;
72 if (
btMin(
btMin(p1[1], p2[1]), p3[1]) > aabbMax[1])
return false;
73 if (
btMax(
btMax(p1[1], p2[1]), p3[1]) < aabbMin[1])
return false;
80 return (p.
getX() < -halfExtent.
getX() ? 0x01 : 0x0) |
81 (p.
getX() > halfExtent.
getX() ? 0x08 : 0x0) |
82 (p.
getY() < -halfExtent.
getY() ? 0x02 : 0x0) |
83 (p.
getY() > halfExtent.
getY() ? 0x10 : 0x0) |
84 (p.
getZ() < -halfExtent.
getZ() ? 0x4 : 0x0) |
85 (p.
getZ() > halfExtent.
getZ() ? 0x20 : 0x0);
92 const unsigned int raySign[3],
98 btScalar tmax, tymin, tymax, tzmin, tzmax;
99 tmin = (bounds[raySign[0]].
getX() - rayFrom.
getX()) * rayInvDirection.
getX();
100 tmax = (bounds[1-raySign[0]].
getX() - rayFrom.
getX()) * rayInvDirection.
getX();
101 tymin = (bounds[raySign[1]].
getY() - rayFrom.
getY()) * rayInvDirection.
getY();
102 tymax = (bounds[1-raySign[1]].
getY() - rayFrom.
getY()) * rayInvDirection.
getY();
104 if ( (tmin > tymax) || (tymin > tmax) )
113 tzmin = (bounds[raySign[2]].
getZ() - rayFrom.
getZ()) * rayInvDirection.
getZ();
114 tzmax = (bounds[1-raySign[2]].
getZ() - rayFrom.
getZ()) * rayInvDirection.
getZ();
116 if ( (tmin > tzmax) || (tzmin > tmax) )
122 return ( (tmin < lambda_max) && (tmax > lambda_min) );
135 int sourceOutcode =
btOutcode(source,aabbHalfExtent);
136 int targetOutcode =
btOutcode(target,aabbHalfExtent);
137 if ((sourceOutcode & targetOutcode) == 0x0)
147 for (
int j=0;j<2;j++)
149 for (i = 0; i != 3; ++i)
151 if (sourceOutcode & bit)
153 btScalar lambda = (-source[i] - aabbHalfExtent[i]*normSign) / r[i];
154 if (lambda_enter <= lambda)
156 lambda_enter = lambda;
158 hitNormal[i] = normSign;
161 else if (targetOutcode & bit)
163 btScalar lambda = (-source[i] - aabbHalfExtent[i]*normSign) / r[i];
170 if (lambda_enter <= lambda_exit)
172 param = lambda_enter;
187 btVector3 extent = halfExtentsWithMargin.
dot3( abs_b[0], abs_b[1], abs_b[2] );
188 aabbMinOut = center - extent;
189 aabbMaxOut = center + extent;
199 localHalfExtents+=
btVector3(margin,margin,margin);
204 btVector3 extent = localHalfExtents.
dot3( abs_b[0], abs_b[1], abs_b[2] );
205 aabbMinOut = center-extent;
206 aabbMaxOut = center+extent;
209 #define USE_BANCHLESS 1
214 return static_cast<unsigned int>(
btSelect((
unsigned)((aabbMin1[0] <= aabbMax2[0]) & (aabbMax1[0] >= aabbMin2[0])
215 & (aabbMin1[2] <= aabbMax2[2]) & (aabbMax1[2] >= aabbMin2[2])
216 & (aabbMin1[1] <= aabbMax2[1]) & (aabbMax1[1] >= aabbMin2[1])),
223 overlap = (aabbMin1[0] > aabbMax2[0] || aabbMax1[0] < aabbMin2[0]) ?
false : overlap;
224 overlap = (aabbMin1[2] > aabbMax2[2] || aabbMax1[2] < aabbMin2[2]) ?
false : overlap;
225 overlap = (aabbMin1[1] > aabbMax2[1] || aabbMax1[1] < aabbMin2[1]) ?
false : overlap;
228 #endif //USE_BANCHLESS
230 #endif //BT_AABB_UTIL2
unsigned btSelect(unsigned condition, unsigned valueIfConditionNonZero, unsigned valueIfConditionZero)
btSelect avoids branches, which makes performance much better for consoles like Playstation 3 and XBo...
int btOutcode(const btVector3 &p, const btVector3 &halfExtent)
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
#define SIMD_FORCE_INLINE
bool TestAabbAgainstAabb2(const btVector3 &aabbMin1, const btVector3 &aabbMax1, const btVector3 &aabbMin2, const btVector3 &aabbMax2)
conservative test for overlap between two aabbs
const btScalar & getZ() const
Return the z value.
void btSetMin(T &a, const T &b)
void AabbExpand(btVector3 &aabbMin, btVector3 &aabbMax, const btVector3 &expansionMin, const btVector3 &expansionMax)
btMatrix3x3 absolute() const
Return the matrix with all values non negative.
unsigned testQuantizedAabbAgainstQuantizedAabb(const unsigned short int *aabbMin1, const unsigned short int *aabbMax1, const unsigned short int *aabbMin2, const unsigned short int *aabbMax2)
const btScalar & getY() const
Return the y value.
const btScalar & getX() const
Return the x value.
btVector3 can be used to represent 3D points and vectors.
bool TestPointAgainstAabb2(const btVector3 &aabbMin1, const btVector3 &aabbMax1, const btVector3 &point)
conservative test for overlap between two aabbs
const T & btMax(const T &a, const T &b)
btVector3 dot3(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2) const
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
void btTransformAabb(const btVector3 &halfExtents, btScalar margin, const btTransform &t, btVector3 &aabbMinOut, btVector3 &aabbMaxOut)
const T & btMin(const T &a, const T &b)
bool btRayAabb2(const btVector3 &rayFrom, const btVector3 &rayInvDirection, const unsigned int raySign[3], const btVector3 bounds[2], btScalar &tmin, btScalar lambda_min, btScalar lambda_max)
bool btRayAabb(const btVector3 &rayFrom, const btVector3 &rayTo, const btVector3 &aabbMin, const btVector3 &aabbMax, btScalar ¶m, btVector3 &normal)
bool TestTriangleAgainstAabb2(const btVector3 *vertices, const btVector3 &aabbMin, const btVector3 &aabbMax)
conservative test for overlap between triangle and aabb
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
static btDbvtVolume bounds(const tNodeArray &leaves)