MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ overlaps_ray()

bool MayaFlux::Kinesis::BoundingSphere::overlaps_ray ( const Ray &  ray) const
inlinenoexcept

Returns true if the ray passes through or originates inside the sphere.

Parameters
rayWorld-space ray with normalized direction.

Definition at line 161 of file Bounds.hpp.

162 {
163 glm::vec3 oc = ray.origin - center;
164 float b = glm::dot(oc, ray.direction);
165 float c = glm::dot(oc, oc) - radius * radius;
166 const float discriminant = b * b - c;
167 if (discriminant < 0.0F)
168 return false;
169 return -b + std::sqrt(discriminant) >= 0.0F;
170 }
size_t b

References b, center, and radius.