Provide helpers for basic analytic intersections.
More...
#include <Intersection.hpp>
|
static bool | sphere (const glm::vec3 &rayOrigin, const glm::vec3 &rayDir, float radius, glm::vec2 &roots) |
|
static bool | box (const Ray &ray, const BoundingBox &box, float mini, float maxi) |
|
Provide helpers for basic analytic intersections.
◆ box()
bool Intersection::box |
( |
const Ray & |
ray, |
|
|
const BoundingBox & |
box, |
|
|
float |
mini, |
|
|
float |
maxi |
|
) |
| |
|
static |
Test a ray and bounding box intersection.
- Parameters
-
ray | the ray |
box | the bounding box |
mini | the minimum allowed distance along the ray |
maxi | the maximum allowed distance along the ray |
- Returns
- a boolean denoting intersection
◆ sphere()
bool Intersection::sphere |
( |
const glm::vec3 & |
rayOrigin, |
|
|
const glm::vec3 & |
rayDir, |
|
|
float |
radius, |
|
|
glm::vec2 & |
roots |
|
) |
| |
|
static |
Check if a sphere of a given radius is intersected by a ray defined by an origin wrt to the sphere center and a normalized direction.
- Parameters
-
rayOrigin | the origin of the ray |
rayDir | the direction of the ray (normalized) |
radius | the radius of the sphere to intersect |
roots | will contain the two roots of the associated polynomial, ordered. |
- Returns
- true if there is intersection.
- Warning
- The intersection can be in the negative direction along the ray. Check the sign of the roots to know.
The documentation for this class was generated from the following files: