angle
around the vector defined by x, y, z
# Create a rotation matrix by `angle` around the vector defined by `x, y, z`
new rotation(angle, x, y, z: Float)
do
var mat = new Matrix.identity(4)
var mag = (x*x + y*y + z*z).sqrt
var sin = angle.sin
var cos = angle.cos
if mag > 0.0 then
x = x / mag
y = y / mag
z = z / mag
var inv_cos = 1.0 - cos
mat[0, 0] = inv_cos*x*x + cos
mat[0, 1] = inv_cos*x*y - z*sin
mat[0, 2] = inv_cos*z*x + y*sin
mat[1, 0] = inv_cos*x*y + z*sin
mat[1, 1] = inv_cos*y*y + cos
mat[1, 2] = inv_cos*y*z - x*sin
mat[2, 0] = inv_cos*z*x - y*sin
mat[2, 1] = inv_cos*y*z + x*sin
mat[2, 2] = inv_cos*z*z + cos
end
return mat
end
lib/matrix/projection.nit:115,2--144,4