Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'extern/bullet2/src/LinearMath/btAabbUtil2.h')
-rw-r--r--extern/bullet2/src/LinearMath/btAabbUtil2.h49
1 files changed, 45 insertions, 4 deletions
diff --git a/extern/bullet2/src/LinearMath/btAabbUtil2.h b/extern/bullet2/src/LinearMath/btAabbUtil2.h
index 429163c8138..8bb6b3af7c3 100644
--- a/extern/bullet2/src/LinearMath/btAabbUtil2.h
+++ b/extern/bullet2/src/LinearMath/btAabbUtil2.h
@@ -18,11 +18,16 @@ subject to the following restrictions:
#define AABB_UTIL2
#include "btVector3.h"
-#include "btSimdMinMax.h"
+#include "btMinMax.h"
-
-#define btMin(a,b) ((a < b ? a : b))
-#define btMax(a,b) ((a > b ? a : b))
+SIMD_FORCE_INLINE void AabbExpand (btVector3& aabbMin,
+ btVector3& aabbMax,
+ const btVector3& expansionMin,
+ const btVector3& expansionMax)
+{
+ aabbMin = aabbMin + expansionMin;
+ aabbMax = aabbMax + expansionMax;
+}
/// conservative test for overlap between two aabbs
@@ -67,6 +72,41 @@ SIMD_FORCE_INLINE int btOutcode(const btVector3& p,const btVector3& halfExtent)
}
+SIMD_FORCE_INLINE 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)
+{
+ btScalar tmax, tymin, tymax, tzmin, tzmax;
+ tmin = (bounds[raySign[0]][0] - rayFrom[0]) * rayInvDirection[0];
+ tmax = (bounds[1-raySign[0]][0] - rayFrom[0]) * rayInvDirection[0];
+ tymin = (bounds[raySign[1]][1] - rayFrom[1]) * rayInvDirection[1];
+ tymax = (bounds[1-raySign[1]][1] - rayFrom[1]) * rayInvDirection[1];
+
+ if ( (tmin > tymax) || (tymin > tmax) )
+ return false;
+
+ if (tymin > tmin)
+ tmin = tymin;
+
+ if (tymax < tmax)
+ tmax = tymax;
+
+ tzmin = (bounds[raySign[2]][2] - rayFrom[2]) * rayInvDirection[2];
+ tzmax = (bounds[1-raySign[2]][2] - rayFrom[2]) * rayInvDirection[2];
+
+ if ( (tmin > tzmax) || (tzmin > tmax) )
+ return false;
+ if (tzmin > tmin)
+ tmin = tzmin;
+ if (tzmax < tmax)
+ tmax = tzmax;
+ return ( (tmin < lambda_max) && (tmax > lambda_min) );
+}
+
SIMD_FORCE_INLINE bool btRayAabb(const btVector3& rayFrom,
const btVector3& rayTo,
const btVector3& aabbMin,
@@ -125,3 +165,4 @@ SIMD_FORCE_INLINE bool btRayAabb(const btVector3& rayFrom,
#endif
+