From 2214106be639bcb09f16ea7f2261daffae84dfc8 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Fri, 6 Jan 2023 20:30:13 -0800 Subject: [PATCH] Remove redundant, fake, function in CPlane Former-commit-id: 5fcb595f2b473ea5c0ac7d9983a3518fe2109583 --- include/Kyoto/Math/CPlane.hpp | 4 +--- src/Collision/CollisionUtil.cpp | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/include/Kyoto/Math/CPlane.hpp b/include/Kyoto/Math/CPlane.hpp index 0252b9c3..b847a926 100644 --- a/include/Kyoto/Math/CPlane.hpp +++ b/include/Kyoto/Math/CPlane.hpp @@ -21,9 +21,7 @@ public: } // IsFacing__6CPlaneCFRC9CVector3f float ClipLineSegment(const CVector3f& start, const CVector3f& end) const; - - float PointToPlaneDist(const CVector3f& pos) const { return CVector3f::Dot(GetNormal(), pos) - xc_constant; } - + private: CUnitVector3f x0_normal; float xc_constant; diff --git a/src/Collision/CollisionUtil.cpp b/src/Collision/CollisionUtil.cpp index acccbd4e..3ed91c1d 100644 --- a/src/Collision/CollisionUtil.cpp +++ b/src/Collision/CollisionUtil.cpp @@ -13,7 +13,7 @@ bool RayPlaneIntersection(const CVector3f& from, const CVector3f& to, const CPla return false; } - float tmp = -plane.PointToPlaneDist(from) / CUnitVector3f::Dot(delta, planeNorm); + float tmp = -plane.GetHeight(from) / CUnitVector3f::Dot(delta, planeNorm); if (tmp < -0.f || tmp > 1.0001f) { return false; @@ -34,8 +34,7 @@ bool RaySphereIntersection(const CSphere& sphere, const CVector3f& pos, const CV if (dirDot < 0.f && magSq > radSq) { return false; } - intersectSq -= magSq; - intersectSq -= radSq; + intersectSq = radSq - (magSq - intersectSq); if (intersectSq < 0.f) { return false;