21 # define EPSILON 0.00001
118 t_hit_record intersect;
119 t_normal_at normal_at;
t_ray transform(t_ray ray, t_matrix matrix)
The function transform() multiplies a given ray by a given matrix, which results in an unnormalized r...
Definition: rays.c:27
struct s_ray t_ray
The struct of type t_ray represents a ray, which is the foundation for ray casting....
t_shape new_cylinder(void)
Creates a new cylinder with default properties.
Definition: cylinders.c:20
t_bool intersect(t_hit **xs, t_shape *shape, t_ray ray)
This function gets shape's intersection from ray's origin. If the ray is inside the shape,...
Definition: intersections.c:31
t_shape new_cone(void)
Creates a new cone with default properties.
Definition: cones.c:20
t_hit * intersection(float t, t_shape *shape)
Creates a hit record for an intersection.
Definition: intersections.c:18
struct s_sphere t_sphere
The structure t_sphere represents a sphere.
struct s_cone t_cone
The structure t_cone represents a cone.
struct s_hit t_hit
The structure t_hit stores a linked list of ray-shape intersections' values.
Definition: shapes.h:82
struct s_plane t_plane
The structure t_plane represents a plane.
t_color pattern_at_shape(t_pattern pattern, t_shape *shape, t_tuple world_point)
This function applies a pattern texture on a given object at a given world location.
Definition: patterns.c:52
t_color lighting(t_shape *shape, t_light light, t_tuple point, t_sight sight)
In a nutshell, the function adds together the material's ambient diffuse, and specular componentes,...
Definition: materials.c:32
t_shape new_sphere(void)
Creates a new sphere with default properties.
Definition: spheres.c:19
void insert_intersection(t_hit **xs, t_hit *i)
Inserts a hit record into a list of intersections in order of increasing t value.
Definition: intersections.c:40
t_discriminant sphere_discriminant(t_sphere *sphere, t_ray ray)
This function returns the necessary data to evaluate a ray-sphere intersection. To do that,...
Definition: discriminants.c:15
struct s_cylinder t_cylinder
The structure t_cylinder represents a cylinder.
t_discriminant cone_discriminant(t_ray ray)
This function returns the necessary data to evaluate a ray-cone intersection. To do that,...
Definition: discriminants.c:60
t_vector normal_at(t_shape *shape, t_point world_point)
Calculates the normal vector at a given point on a shape's surface.
Definition: shapes.c:32
t_discriminant cylinder_discriminant(t_ray ray)
This function returns the necessary data to evaluate a ray-cylinder intersection. To do that,...
Definition: discriminants.c:38
t_hit * hit(t_hit *xs)
Determines the first hit from a list of intersections.
Definition: intersections.c:62
struct s_discriminant t_discriminant
This struct stores the necessary data to evaluate a ray-sphere intersection. To do that,...
t_shape new_shape(void)
Creates a new shape with default properties.
Definition: shapes.c:15
t_shape new_plane(void)
Creates a new plane with default properties.
Definition: planes.c:18
void set_transform(t_shape *shape, t_matrix transform)
Assigns a transformation matrix to a shape.
Definition: shapes.c:25
This structure encapsulates the function uv_checkers().
Definition: patterns.h:44
The struct s_color stores the color values of ray tracing. It contains a field for red,...
Definition: tuples.h:63
The structure t_cone represents a cone.
Definition: shapes.h:74
The structure t_cylinder represents a cylinder.
Definition: shapes.h:56
This struct stores the necessary data to evaluate a ray-sphere intersection. To do that,...
Definition: shapes.h:168
The structure t_hit stores a linked list of ray-shape intersections' values.
Definition: shapes.h:134
The struct s_light represents a light's source. This source has a position in space and an intensity ...
Definition: lights.h:44
A material has a surface color and four attributes from the Phong Reflection Model: ambient,...
Definition: materials.h:43
The struct t_matrix stores a matrix up to 4x4 and size of 16. A matrix is a grid of numbers that can ...
Definition: matrices.h:34
The type t_pattern contatins all the necessary information to apply a texture on a given shape's surf...
Definition: patterns.h:123
The structure t_plane represents a plane.
Definition: shapes.h:41
The struct of type t_ray represents a ray, which is the foundation for ray casting....
Definition: rays.h:28
The struct s_sight represents the human eye looking forwards.
Definition: lights.h:62
The structure t_sphere represents a sphere.
Definition: shapes.h:30
Tuple means a list of ordered things. The struct t_tuple stores coordinates for a left-handed coordin...
Definition: tuples.h:33
Represents a shape in a scene.
struct s_tuple t_tuple
Tuple means a list of ordered things. The struct t_tuple stores coordinates for a left-handed coordin...
t_tuple point(double x, double y, double z)
This function is a simplification of the function tuple(). It will create a point with the given coor...
Definition: models.c:20