miniRT
By Marcelo Magalhães and Ygor G. Sena, 2023.
s_comps Struct Reference

This structure of type t_comps stores some precomputed values that are useful when working intersections and their color calculations. More...

#include <world.h>

Collaboration diagram for s_comps:

Data Fields

float t
 
t_shapeobject
 
t_point point
 
t_sight sight
 
t_bool inside
 
t_tuple over_point
 

Detailed Description

This structure of type t_comps stores some precomputed values that are useful when working intersections and their color calculations.

Parameters
tStores the intersection value at a given point, if any.
objectStores shape's data.
pointStores a point to be used as referenece.
sightStores the human's eye data used as reference.
insideStores TRUE or FALSE in regards to whether a hit occurs inside the object (or shape). If hit is inside the shape, the value is TRUE. Otherwise, it's is FALSE. It works together with the field over_point to fix a problem called acne.
over_pointThis field avoids the effect called acne, which happens because computers cannot represent floating points very well. Because of that, sometimes the calculation of the ray-surface intersection will result in a point of intersection that lies beneath the actual surface of a given shape. This field sets a margin of error.