Jolt Physics
A multi core friendly Game Physics Engine
|
#include <Jolt/Math/FindRoot.h>
Go to the source code of this file.
JPH_NAMESPACE_BEGIN JPH_INLINE float RaySphere | ( | Vec3Arg | inRayOrigin, |
Vec3Arg | inRayDirection, | ||
Vec3Arg | inSphereCenter, | ||
float | inSphereRadius ) |
Tests a ray starting at inRayOrigin and extending infinitely in inRayDirection against a sphere,
inRayOrigin | Ray origin. If the ray starts inside the sphere, the returned fraction will be 0. |
inRayDirection | Ray direction. Does not need to be normalized. |
inSphereCenter | Position of the center of the sphere |
inSphereRadius | Radius of the sphere |
JPH_INLINE int RaySphere | ( | Vec3Arg | inRayOrigin, |
Vec3Arg | inRayDirection, | ||
Vec3Arg | inSphereCenter, | ||
float | inSphereRadius, | ||
float & | outMinFraction, | ||
float & | outMaxFraction ) |
Tests a ray starting at inRayOrigin and extending infinitely in inRayDirection against a sphere. Outputs entry and exit points (outMinFraction and outMaxFraction) along the ray (which could be negative if the hit point is before the start of the ray).
inRayOrigin | Ray origin. If the ray starts inside the sphere, the returned fraction will be 0. |
inRayDirection | Ray direction. Does not need to be normalized. |
inSphereCenter | Position of the center of the sphere. |
inSphereRadius | Radius of the sphere. |
outMinFraction | Returned lowest intersection fraction |
outMaxFraction | Returned highest intersection fraction |