Closed physcopanda closed 9 years ago
I noticed this as well, I think your matrix is correct with the exception that it should be in column major:
highp mat4 rotation(highp vec3 n, highp float theta) {
//TODO: Using Rodrigues' formula, find a matrix which performs a rotation about the axis n by theta radians
return mat4(n.x*n.x*(1.0-cos(theta))+cos(theta), n.x*n.y*(1.0-cos(theta))+n.z*sin(theta), n.x*n.z*(1.0-cos(theta))-n.y*sin(theta), 0,
n.y*n.x*(1.0-cos(theta))-n.z*sin(theta),n.y*n.y*(1.0-cos(theta))+cos(theta), n.y*n.z*(1.0-cos(theta))+n.x*sin(theta), 0,
n.z*n.x*(1.0-cos(theta))+n.y*sin(theta),n.z*n.y*(1.0-cos(theta))-n.x*sin(theta), n.z*n.z*(1.0-cos(theta))+cos(theta), 0,
0, 0, 0, 1.0);
}
#pragma glslify: export(rotation)
Fixed
Exercises 15 and 16 have the same answer! I think the correct answer is something like this:-
It doesn't seem to match the correct answer on screen, can anyone validate this as a correct rotation matrix?