python-opengl icon indicating copy to clipboard operation
python-opengl copied to clipboard

X-axis rotation

Open rasql opened this issue 6 years ago • 1 comments

Hello Nicolas,

I have the feeling the cos/sin terms should be shifted by one column to the left. For d=0 we should obtain the identity matrix.

┌                    ┐   ┌   ┐   ┌                                 ┐
│   1       0    0 0 │ * │ x │ = │      1*x      + 0*y + 0*z + 0*0 │
│ cos(d) -sin(d) 0 0 │   │ y │   │ cos(d)*x - sin(d)*y + 0*z + 0*0 │
│ sin(d)  cos(d) 0 0 │   │ z │   │ sin(d)*x + cos(d)*y + 0*z + 0*0 │
│   0       0    0 1 │   │ 1 │   │      0*x      + 0*y + 0*z + 1*1 │
└                    ┘   └   ┘   └                                 ┘

should be like this
┌                      ┐   ┌   ┐ 
│   1       0    0   0 │ * │ x │ =
│   0 cos(d) -sin(d) 0 │   │ y │  
│   0 sin(d) cos(d)  0 │   │ z │  
│   0       0    0   1 │   │ 1 │   │    
└                      ┘   └   ┘   

rasql avatar Mar 12 '19 22:03 rasql

Thanks. I think you're right and I'm afraid other rotation matrices might be wrong as well. Can you make a PR?

rougier avatar Mar 13 '19 20:03 rougier