lab9

lab9-GeometryPositionColorOrientation-src

// Yaw/Pitch/Roll -> Rotation Matrix

glm::yawPitchRoll(yaw, pitch, roll) ;

float yaw, // by y-axis (in radians)

float pitch, // by x-axis (in radians)

float roll // by z-axis (in radians)

 

// R1 != R2

glm::mat4 R1, R2, Rx, Ry, Rz;

Ry = glm::rotate(glm::mat4(1), 60, glm::vec3(0, 1, 0));

Rx = glm::rotate(glm::mat4(1), 30, glm::vec3(1, 0, 0));

Rz = glm::rotate(glm::mat4(1), 45, glm::vec3(0, 0, 1));

R1 = Ry * Rx * Rz; // world coordinate system에서 rotation

R2 = glm::yawPitchRoll(60, 30, 45); // Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (YXZ). local coordinate system에서 rotation