Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
RayAABox.h File Reference

Go to the source code of this file.

Classes

class  RayInvDirection
 Helper structure holding the reciprocal of a ray for Ray vs AABox testing. More...
 

Functions

JPH_INLINE float RayAABox (Vec3Arg inOrigin, const RayInvDirection &inInvDirection, Vec3Arg inBoundsMin, Vec3Arg inBoundsMax)
 
JPH_INLINE Vec4 RayAABox4 (Vec3Arg inOrigin, const RayInvDirection &inInvDirection, Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ)
 
JPH_INLINE void RayAABox (Vec3Arg inOrigin, const RayInvDirection &inInvDirection, Vec3Arg inBoundsMin, Vec3Arg inBoundsMax, float &outMin, float &outMax)
 
JPH_INLINE bool RayAABoxHits (Vec3Arg inOrigin, const RayInvDirection &inInvDirection, Vec3Arg inBoundsMin, Vec3Arg inBoundsMax, float inClosest)
 Intersect AABB with ray, returns true if there is a hit closer than inClosest. More...
 
JPH_INLINE bool RayAABoxHits (Vec3Arg inOrigin, Vec3Arg inDirection, Vec3Arg inBoundsMin, Vec3Arg inBoundsMax)
 

Function Documentation

◆ RayAABox() [1/2]

JPH_INLINE float RayAABox ( Vec3Arg  inOrigin,
const RayInvDirection inInvDirection,
Vec3Arg  inBoundsMin,
Vec3Arg  inBoundsMax 
)

Intersect AABB with ray, returns minimal distance along ray or FLT_MAX if no hit Note: Can return negative value if ray starts in box

◆ RayAABox() [2/2]

JPH_INLINE void RayAABox ( Vec3Arg  inOrigin,
const RayInvDirection inInvDirection,
Vec3Arg  inBoundsMin,
Vec3Arg  inBoundsMax,
float &  outMin,
float &  outMax 
)

Intersect AABB with ray, returns minimal and maximal distance along ray or FLT_MAX, -FLT_MAX if no hit Note: Can return negative value for outMin if ray starts in box

◆ RayAABox4()

JPH_INLINE Vec4 RayAABox4 ( Vec3Arg  inOrigin,
const RayInvDirection inInvDirection,
Vec4Arg  inBoundsMinX,
Vec4Arg  inBoundsMinY,
Vec4Arg  inBoundsMinZ,
Vec4Arg  inBoundsMaxX,
Vec4Arg  inBoundsMaxY,
Vec4Arg  inBoundsMaxZ 
)

Intersect 4 AABBs with ray, returns minimal distance along ray or FLT_MAX if no hit Note: Can return negative value if ray starts in box

◆ RayAABoxHits() [1/2]

JPH_INLINE bool RayAABoxHits ( Vec3Arg  inOrigin,
const RayInvDirection inInvDirection,
Vec3Arg  inBoundsMin,
Vec3Arg  inBoundsMax,
float  inClosest 
)

Intersect AABB with ray, returns true if there is a hit closer than inClosest.

◆ RayAABoxHits() [2/2]

JPH_INLINE bool RayAABoxHits ( Vec3Arg  inOrigin,
Vec3Arg  inDirection,
Vec3Arg  inBoundsMin,
Vec3Arg  inBoundsMax 
)

Intersect AABB with ray without hit fraction, based on separating axis test

See also
http://www.codercorner.com/RayAABB.cpp