Ray Tracer
2020
|
Class to store the intersection of a Ray and an Object. More...
#include <RayIntersection.h>
Public Member Functions | |
bool | operator< (const RayIntersection &ri) |
Less-than comparison for RayIntersection. More... | |
Public Attributes | |
Point | point |
The Point at which a Ray intersects with an Object. More... | |
Normal | normal |
The Normal at the Point of intersection. More... | |
Material | material |
The Material of the Object that is hit. More... | |
double | distance |
The distance along the Ray to the intersection Point. More... | |
Class to store the intersection of a Ray and an Object.
The fundamental operation in ray-tracing is intersecting a Ray with an Object. A RayIntersection stores the information about this intersection. As well as the Point at which the intersection occurs, the Normal to the object at that location, the Material of the object, and the distance along the ray are all required.
RayInteresections can also be sorted on distance along the ray.
|
inline |
Less-than comparison for RayIntersection.
In order to sort RayIntersection objects using the standard algorithms a less-than operator is required. This is defined in terms of the distance property, which provides a natural ordering for multipe Object intersections for a single Ray.
ri | The RayIntersection to compare to this |
this.distance
is less than ri.distance
, false otherwise.