我正在进行图像处理,我想根据角度,原点以及x,y和z坐标旋转xyz空间中的所有像素.
我只需要设置正确的矩阵(4x4)然后我就会很好.角度是度,而不是弧度,x,y,z都是从-1到1(浮点数)
编辑:
好的,这是我为了由原点和X,Y,Z坐标定义的给定线进行旋转而编写的代码.
float ang = angD * (float)(Math.PI / 180); // from degrees to radians, if needed
//U = n*n(t) + cos(a)*(I-n*n(t)) + sin(a)*N(x).
var u = MatrixDouble.Identity(4); // 4x4 Identity Matrix
u = u.Multiply(Math.Cos(ang));
var n = new MatrixDouble(1, 4, new List<double> { x, y, z, 0 });
var nt = n.Transpose();
// This next part is the N(x) matrix. The data is inputted in Column
// first order and fills in the 4x4 matrix with the …Run Code Online (Sandbox Code Playgroud)