Go to the source code of this file.
|
struct | s_ray |
| The struct of type t_ray represents a ray, which is the foundation for ray casting. Ray casting is the process of creating a ray, or line, and finding the intersections of that ray with the objects in a scene. More...
|
|
|
typedef struct s_ray | t_ray |
| The struct of type t_ray represents a ray, which is the foundation for ray casting. Ray casting is the process of creating a ray, or line, and finding the intersections of that ray with the objects in a scene. More...
|
|
|
t_ray | new_ray (t_point origin, t_vector direction) |
| The function new_ray() creates and queries a ray with the given origin and direction passed as parameter. More...
|
|
t_point | position (t_ray ray, float distance) |
| The function position() finds the position of a given ray and a given time or distance. To find a ray's position, it's necessary to multiply the ray direction by time or distance to find the total distance traveled and add the result to the ray's origin. More...
|
|
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 ray. In other words, whatever wanted transformation to be applied to a world's object is applied instead in the ray by the inverse of the operation intended on a world's object. For more information, refer to the book TRTC on page 66. More...
|
|
◆ t_ray
The struct of type t_ray represents a ray, which is the foundation for ray casting. Ray casting is the process of creating a ray, or line, and finding the intersections of that ray with the objects in a scene.
- Parameters
-
origin | Stores the starting point of a ray. |
direction | Stores the vector which says where a ray points to. |
◆ new_ray()
The function new_ray() creates and queries a ray with the given origin and direction passed as parameter.
- Parameters
-
origin | Receives a point tuple, which is starting point of the ray. |
direction | Receives a vector tuple, which is the direction where the ray points to. |
- Returns
- Sucessfully returns a new ray with the given origin and direction passed as parameter to the function.
◆ position()
The function position() finds the position of a given ray and a given time or distance. To find a ray's position, it's necessary to multiply the ray direction by time or distance to find the total distance traveled and add the result to the ray's origin.
- Parameters
-
ray | Receives a ray as reference. |
distance | Receives a float value which is the time or distance that the ray must travel. |
- Returns
- Returns the ray's coordinates after it traveled for a given time or after it gone through a given distance.
◆ transform()
The function transform() multiplies a given ray by a given matrix, which results in an unnormalized ray. In other words, whatever wanted transformation to be applied to a world's object is applied instead in the ray by the inverse of the operation intended on a world's object. For more information, refer to the book TRTC on page 66.
- Parameters
-
ray | Receives a ray to the transformed. |
matrix | Reveives the matrix transformation to be applied in the ray. |
- Returns
- Successfully returns a new unnormalized and transformed ray.