Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
Intersection Class Reference

Provide helpers for basic analytic intersections. More...

#include <Intersection.hpp>

Static Public Member Functions

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)
 

Detailed Description

Provide helpers for basic analytic intersections.

Member Function Documentation

◆ box()

bool Intersection::box ( const Ray ray,
const BoundingBox box,
float  mini,
float  maxi 
)
static

Test a ray and bounding box intersection.

Parameters
raythe ray
boxthe bounding box
minithe minimum allowed distance along the ray
maxithe 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
rayOriginthe origin of the ray
rayDirthe direction of the ray (normalized)
radiusthe radius of the sphere to intersect
rootswill 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: