Cleaning up detection sphere implementation

parent 25933f56
......@@ -416,15 +416,14 @@ bool ITAGeoUtils::RayFaceIntersectionTest( const VistaRay& rRay, CITAMesh* pMesh
bool ITAGeoUtils::RayDetectionSphereIntersectionTest(const VistaRay& rRay, std::shared_ptr< ITAGeo::CPropagationAnchor > pDestination, float fDetectionSphereRadius, VistaVector3D& v3DetectionPoint)
{
const VistaVector3D v3RayOrigin2RcvPos = pDestination->v3InteractionPoint - rRay.GetOrigin();
// Nearest Point of ray to detection sphere origin
const auto v3RayOrigin2RcvPos = pDestination->v3InteractionPoint - rRay.GetOrigin();
v3DetectionPoint = rRay.GetDir().Dot(v3RayOrigin2RcvPos) * rRay.GetDir() + rRay.GetOrigin();
const auto v3DetectionOffset = v3DetectionPoint - pDestination->v3InteractionPoint;
const auto fDetectedRadius = v3DetectionOffset.GetLength();
const auto bInsideSphere = fDetectedRadius <= fDetectionSphereRadius;
return ((v3DetectionPoint - pDestination->v3InteractionPoint).GetLength() <= fDetectionSphereRadius);
//float tDeviationAngle = acos(rRay.GetDir().Dot(v3RayOrigin2RcvPos.GetNormalized()));
//return (abs(v3RayOrigin2RcvPos.GetLength() * sin(tDeviationAngle)) < fDetectionSphereRadius);
return bInsideSphere;
}
VistaVector3D ITAGeoUtils::GetReflectedDirection( CITAMesh* pMesh, CITAMesh::FaceHandle hFace, const VistaRay& rRay )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment