summaryrefslogtreecommitdiffhomepage
path: root/Opcode/OPC_RayAABBOverlap.h
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-01-30 17:44:05 +0100
committerAki <please@ignore.pl>2022-01-30 17:44:05 +0100
commitc01469dddabe404506ef3a64542e8423f9e11f2c (patch)
tree740f6e0e0811227a6e40aac51ba48057f1166b41 /Opcode/OPC_RayAABBOverlap.h
parent51657e10769faa2617d546a06c42e4c62a19bb50 (diff)
downloadstarshatter-c01469dddabe404506ef3a64542e8423f9e11f2c.zip
starshatter-c01469dddabe404506ef3a64542e8423f9e11f2c.tar.gz
starshatter-c01469dddabe404506ef3a64542e8423f9e11f2c.tar.bz2
Converted Opcode and Ice into unix newlines format
Diffstat (limited to 'Opcode/OPC_RayAABBOverlap.h')
-rw-r--r--Opcode/OPC_RayAABBOverlap.h126
1 files changed, 63 insertions, 63 deletions
diff --git a/Opcode/OPC_RayAABBOverlap.h b/Opcode/OPC_RayAABBOverlap.h
index f9f6834..cd2bdfb 100644
--- a/Opcode/OPC_RayAABBOverlap.h
+++ b/Opcode/OPC_RayAABBOverlap.h
@@ -1,63 +1,63 @@
-// Opcode 1.1: ray-AABB overlap tests based on Woo's code
-// Opcode 1.2: ray-AABB overlap tests based on the separating axis theorem
-//
-// The IcePoint of intersection is not computed anymore. The distance to impact is not needed anymore
-// since we now have two different queries for segments or rays.
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Computes a segment-AABB overlap test using the separating axis theorem. IceSegment is cached within the class.
- * \param center [in] AABB center
- * \param extents [in] AABB extents
- * \return true on overlap
- */
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-inline_ BOOL RayCollider::SegmentAABBOverlap(const IcePoint& center, const IcePoint& extents)
-{
- // Stats
- mNbRayBVTests++;
-
- float Dx = mData2.x - center.x; if(fabsf(Dx) > extents.x + mFDir.x) return FALSE;
- float Dy = mData2.y - center.y; if(fabsf(Dy) > extents.y + mFDir.y) return FALSE;
- float Dz = mData2.z - center.z; if(fabsf(Dz) > extents.z + mFDir.z) return FALSE;
-
- float f;
- f = mData.y * Dz - mData.z * Dy; if(fabsf(f) > extents.y*mFDir.z + extents.z*mFDir.y) return FALSE;
- f = mData.z * Dx - mData.x * Dz; if(fabsf(f) > extents.x*mFDir.z + extents.z*mFDir.x) return FALSE;
- f = mData.x * Dy - mData.y * Dx; if(fabsf(f) > extents.x*mFDir.y + extents.y*mFDir.x) return FALSE;
-
- return TRUE;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Computes a ray-AABB overlap test using the separating axis theorem. Ray is cached within the class.
- * \param center [in] AABB center
- * \param extents [in] AABB extents
- * \return true on overlap
- */
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-inline_ BOOL RayCollider::RayAABBOverlap(const IcePoint& center, const IcePoint& extents)
-{
- // Stats
- mNbRayBVTests++;
-
-// float Dx = mOrigin.x - center.x; if(fabsf(Dx) > extents.x && Dx*mDir.x>=0.0f) return FALSE;
-// float Dy = mOrigin.y - center.y; if(fabsf(Dy) > extents.y && Dy*mDir.y>=0.0f) return FALSE;
-// float Dz = mOrigin.z - center.z; if(fabsf(Dz) > extents.z && Dz*mDir.z>=0.0f) return FALSE;
-
- float Dx = mOrigin.x - center.x; if(GREATER(Dx, extents.x) && Dx*mDir.x>=0.0f) return FALSE;
- float Dy = mOrigin.y - center.y; if(GREATER(Dy, extents.y) && Dy*mDir.y>=0.0f) return FALSE;
- float Dz = mOrigin.z - center.z; if(GREATER(Dz, extents.z) && Dz*mDir.z>=0.0f) return FALSE;
-
-// float Dx = mOrigin.x - center.x; if(GREATER(Dx, extents.x) && ((SIR(Dx)-1)^SIR(mDir.x))>=0.0f) return FALSE;
-// float Dy = mOrigin.y - center.y; if(GREATER(Dy, extents.y) && ((SIR(Dy)-1)^SIR(mDir.y))>=0.0f) return FALSE;
-// float Dz = mOrigin.z - center.z; if(GREATER(Dz, extents.z) && ((SIR(Dz)-1)^SIR(mDir.z))>=0.0f) return FALSE;
-
- float f;
- f = mDir.y * Dz - mDir.z * Dy; if(fabsf(f) > extents.y*mFDir.z + extents.z*mFDir.y) return FALSE;
- f = mDir.z * Dx - mDir.x * Dz; if(fabsf(f) > extents.x*mFDir.z + extents.z*mFDir.x) return FALSE;
- f = mDir.x * Dy - mDir.y * Dx; if(fabsf(f) > extents.x*mFDir.y + extents.y*mFDir.x) return FALSE;
-
- return TRUE;
-}
+// Opcode 1.1: ray-AABB overlap tests based on Woo's code
+// Opcode 1.2: ray-AABB overlap tests based on the separating axis theorem
+//
+// The IcePoint of intersection is not computed anymore. The distance to impact is not needed anymore
+// since we now have two different queries for segments or rays.
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Computes a segment-AABB overlap test using the separating axis theorem. IceSegment is cached within the class.
+ * \param center [in] AABB center
+ * \param extents [in] AABB extents
+ * \return true on overlap
+ */
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+inline_ BOOL RayCollider::SegmentAABBOverlap(const IcePoint& center, const IcePoint& extents)
+{
+ // Stats
+ mNbRayBVTests++;
+
+ float Dx = mData2.x - center.x; if(fabsf(Dx) > extents.x + mFDir.x) return FALSE;
+ float Dy = mData2.y - center.y; if(fabsf(Dy) > extents.y + mFDir.y) return FALSE;
+ float Dz = mData2.z - center.z; if(fabsf(Dz) > extents.z + mFDir.z) return FALSE;
+
+ float f;
+ f = mData.y * Dz - mData.z * Dy; if(fabsf(f) > extents.y*mFDir.z + extents.z*mFDir.y) return FALSE;
+ f = mData.z * Dx - mData.x * Dz; if(fabsf(f) > extents.x*mFDir.z + extents.z*mFDir.x) return FALSE;
+ f = mData.x * Dy - mData.y * Dx; if(fabsf(f) > extents.x*mFDir.y + extents.y*mFDir.x) return FALSE;
+
+ return TRUE;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Computes a ray-AABB overlap test using the separating axis theorem. Ray is cached within the class.
+ * \param center [in] AABB center
+ * \param extents [in] AABB extents
+ * \return true on overlap
+ */
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+inline_ BOOL RayCollider::RayAABBOverlap(const IcePoint& center, const IcePoint& extents)
+{
+ // Stats
+ mNbRayBVTests++;
+
+// float Dx = mOrigin.x - center.x; if(fabsf(Dx) > extents.x && Dx*mDir.x>=0.0f) return FALSE;
+// float Dy = mOrigin.y - center.y; if(fabsf(Dy) > extents.y && Dy*mDir.y>=0.0f) return FALSE;
+// float Dz = mOrigin.z - center.z; if(fabsf(Dz) > extents.z && Dz*mDir.z>=0.0f) return FALSE;
+
+ float Dx = mOrigin.x - center.x; if(GREATER(Dx, extents.x) && Dx*mDir.x>=0.0f) return FALSE;
+ float Dy = mOrigin.y - center.y; if(GREATER(Dy, extents.y) && Dy*mDir.y>=0.0f) return FALSE;
+ float Dz = mOrigin.z - center.z; if(GREATER(Dz, extents.z) && Dz*mDir.z>=0.0f) return FALSE;
+
+// float Dx = mOrigin.x - center.x; if(GREATER(Dx, extents.x) && ((SIR(Dx)-1)^SIR(mDir.x))>=0.0f) return FALSE;
+// float Dy = mOrigin.y - center.y; if(GREATER(Dy, extents.y) && ((SIR(Dy)-1)^SIR(mDir.y))>=0.0f) return FALSE;
+// float Dz = mOrigin.z - center.z; if(GREATER(Dz, extents.z) && ((SIR(Dz)-1)^SIR(mDir.z))>=0.0f) return FALSE;
+
+ float f;
+ f = mDir.y * Dz - mDir.z * Dy; if(fabsf(f) > extents.y*mFDir.z + extents.z*mFDir.y) return FALSE;
+ f = mDir.z * Dx - mDir.x * Dz; if(fabsf(f) > extents.x*mFDir.z + extents.z*mFDir.x) return FALSE;
+ f = mDir.x * Dy - mDir.y * Dx; if(fabsf(f) > extents.x*mFDir.y + extents.y*mFDir.x) return FALSE;
+
+ return TRUE;
+}