Ray Tracer Common Project
Image rendering program based on the ray tracing technique.
Public Member Functions | List of all members
rt::hit Class Reference

The result of a collistion between a Geometry and an euclidian. More...

#include <hit.hpp>

Public Member Functions

 hit ()
 Default constructor. More...
 
 hit (const hit &)
 Copy constructor.
 
 hit (double t, const element &)
 Construct a new hit from its date and surface element.
 
double date () const
 Date of the hit. More...
 
const elementsurface () const
 Surface element attached to the hit.
 
void setMaterial (Material *m)
 Set the material associated with the surface element.
 
bool operator< (const hit &h) const
 Compare the date of two hits.
 
bool operator> (const hit &h) const
 Compare the date of two hits.
 

Detailed Description

The result of a collistion between a Geometry and an euclidian.

A hit is generated when an collision occurs between a Geometry and an euclidian through the Geometry::hits method. The hit class can also be used to describe a "no hit" when no collision occurs by setting the hit date to infinity or simply by using default constructor.

A hit is attached to a surface element, the exact surface location where the hit occurs.

You can also attach a material to the surface element through hit::setMaterial. Typicaly, the material match the surface material, and is set by the Object::hit method.

An order relation is defined for the hits according to there occurrence date. A hit precede an other if its occurence date is prior.

Constructor & Destructor Documentation

◆ hit()

rt::hit::hit ( )

Default constructor.

This constructor is used to make a "no hit", when no collision occurs.

Member Function Documentation

◆ date()

double rt::hit::date ( ) const
inline

Date of the hit.

May be infinity if no hit occurs.


The documentation for this class was generated from the following files: