mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-02 04:37:54 +08:00
spelling: squared
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
This commit is contained in:
@@ -66,7 +66,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL bool intersectRaySphere(
|
||||
genType const& rayStarting, genType const& rayNormalizedDirection,
|
||||
genType const& sphereCenter, typename genType::value_type const sphereRadiusSquered,
|
||||
genType const& sphereCenter, typename genType::value_type const sphereRadiusSquared,
|
||||
typename genType::value_type & intersectionDistance);
|
||||
|
||||
//! Compute the intersection of a ray and a sphere.
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER bool intersectRaySphere
|
||||
(
|
||||
genType const& rayStarting, genType const& rayNormalizedDirection,
|
||||
genType const& sphereCenter, const typename genType::value_type sphereRadiusSquered,
|
||||
genType const& sphereCenter, const typename genType::value_type sphereRadiusSquared,
|
||||
typename genType::value_type & intersectionDistance
|
||||
)
|
||||
{
|
||||
@@ -140,11 +140,11 @@ namespace glm
|
||||
genType diff = sphereCenter - rayStarting;
|
||||
typename genType::value_type t0 = dot(diff, rayNormalizedDirection);
|
||||
typename genType::value_type dSquared = dot(diff, diff) - t0 * t0;
|
||||
if( dSquared > sphereRadiusSquered )
|
||||
if( dSquared > sphereRadiusSquared )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
typename genType::value_type t1 = sqrt( sphereRadiusSquered - dSquared );
|
||||
typename genType::value_type t1 = sqrt( sphereRadiusSquared - dSquared );
|
||||
intersectionDistance = t0 > t1 + Epsilon ? t0 - t1 : t0 + t1;
|
||||
return intersectionDistance > Epsilon;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user