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

The struct t_shearing is a helper type to allow shearing operation on matrices. Shearing (or skew) is a complex operation where the coordinate is changed in proportion to the other two coordinates. When doing it to a matrix, it means that x will change in proportion to y and z, y will change in proportion to x and z and, lastly, z will change in proportion to x and y. For example, to apply shearing to the x axis of a given matrix, we pass to shearing() a struct of type t_shearing containing the y and z values. For instance, when done to the y axis, we pass p1 and p2 which stands for x and z. Lastly, when applying it to the z axis, we pass x and y as p1 and p2, respectively. More...

#include <matrices.h>

Data Fields

double p1
 
double p2
 

Detailed Description

The struct t_shearing is a helper type to allow shearing operation on matrices. Shearing (or skew) is a complex operation where the coordinate is changed in proportion to the other two coordinates. When doing it to a matrix, it means that x will change in proportion to y and z, y will change in proportion to x and z and, lastly, z will change in proportion to x and y. For example, to apply shearing to the x axis of a given matrix, we pass to shearing() a struct of type t_shearing containing the y and z values. For instance, when done to the y axis, we pass p1 and p2 which stands for x and z. Lastly, when applying it to the z axis, we pass x and y as p1 and p2, respectively.

Parameters
p1The first value to be used as proportion for shearing.
p2The second value to be used as proportion for shearing.