summaryrefslogtreecommitdiffhomepage
path: root/contrib/Opcode/OPC_SphereAABBOverlap.h
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-03-12 22:07:03 +0100
committerAki <please@ignore.pl>2024-03-12 22:07:36 +0100
commit81bb6873f1c0291fecbf6e429ad15ac3db66a4c0 (patch)
treefd7552ecabeeffb45a1fbe3730ab62bc7a64dd85 /contrib/Opcode/OPC_SphereAABBOverlap.h
parentf43d32d6d2cc7ecd04f4f06f20d5a6fc2c87c9ae (diff)
downloadstarshatter-81bb6873f1c0291fecbf6e429ad15ac3db66a4c0.zip
starshatter-81bb6873f1c0291fecbf6e429ad15ac3db66a4c0.tar.gz
starshatter-81bb6873f1c0291fecbf6e429ad15ac3db66a4c0.tar.bz2
Legal notices updated
Rename contrib -> third-party intendes to express the origin and purpose of that part of the code better. I plan to readd contrib/ again but with more in-project things like bash-completions, dev workflow scripts etc.
Diffstat (limited to 'contrib/Opcode/OPC_SphereAABBOverlap.h')
-rw-r--r--contrib/Opcode/OPC_SphereAABBOverlap.h128
1 files changed, 0 insertions, 128 deletions
diff --git a/contrib/Opcode/OPC_SphereAABBOverlap.h b/contrib/Opcode/OPC_SphereAABBOverlap.h
deleted file mode 100644
index b7b4376..0000000
--- a/contrib/Opcode/OPC_SphereAABBOverlap.h
+++ /dev/null
@@ -1,128 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Sphere-AABB overlap test, based on Jim Arvo's code.
- * \param center [in] box center
- * \param extents [in] box extents
- * \return TRUE on overlap
- */
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-inline_ BOOL SphereCollider::SphereAABBOverlap(const IcePoint& center, const IcePoint& extents)
-{
- // Stats
- mNbVolumeBVTests++;
-
- float d = 0.0f;
-
- //find the square of the distance
- //from the sphere to the box
-#ifdef OLDIES
- for(udword i=0;i<3;i++)
- {
- float tmp = mCenter[i] - center[i];
- float s = tmp + extents[i];
-
- if(s<0.0f) d += s*s;
- else
- {
- s = tmp - extents[i];
- if(s>0.0f) d += s*s;
- }
- }
-#endif
-
-//#ifdef NEW_TEST
-
-// float tmp = mCenter.x - center.x;
-// float s = tmp + extents.x;
-
- float tmp,s;
-
- tmp = mCenter.x - center.x;
- s = tmp + extents.x;
-
- if(s<0.0f)
- {
- d += s*s;
- if(d>mRadius2) return FALSE;
- }
- else
- {
- s = tmp - extents.x;
- if(s>0.0f)
- {
- d += s*s;
- if(d>mRadius2) return FALSE;
- }
- }
-
- tmp = mCenter.y - center.y;
- s = tmp + extents.y;
-
- if(s<0.0f)
- {
- d += s*s;
- if(d>mRadius2) return FALSE;
- }
- else
- {
- s = tmp - extents.y;
- if(s>0.0f)
- {
- d += s*s;
- if(d>mRadius2) return FALSE;
- }
- }
-
- tmp = mCenter.z - center.z;
- s = tmp + extents.z;
-
- if(s<0.0f)
- {
- d += s*s;
- if(d>mRadius2) return FALSE;
- }
- else
- {
- s = tmp - extents.z;
- if(s>0.0f)
- {
- d += s*s;
- if(d>mRadius2) return FALSE;
- }
- }
-//#endif
-
-#ifdef OLDIES
-// IcePoint Min = center - extents;
-// IcePoint Max = center + extents;
-
- float d = 0.0f;
-
- //find the square of the distance
- //from the sphere to the box
- for(udword i=0;i<3;i++)
- {
-float Min = center[i] - extents[i];
-
-// if(mCenter[i]<Min[i])
- if(mCenter[i]<Min)
- {
-// float s = mCenter[i] - Min[i];
- float s = mCenter[i] - Min;
- d += s*s;
- }
- else
- {
-float Max = center[i] + extents[i];
-
-// if(mCenter[i]>Max[i])
- if(mCenter[i]>Max)
- {
- float s = mCenter[i] - Max;
- d += s*s;
- }
- }
- }
-#endif
- return d <= mRadius2;
-}