Thank you very much, buddy. The other end of this question is that I need to actually build a new Matrix. The following is the original code. The first block calls the second block.
float rotAngle = distance / radius * 0.5f; //rotSpeed;
Vector3f v = new Vector3f(vel.z, 0, -vel.x);
MathTools.normalize(v);
MathTools.buildRotationMatrix(rotAngle, v, matrix)l
public static void buildRotationMatrix(float phi, Vector3f axis, matrix4 mRet) {
float u = axis.x;
float v = axis.y;
float w = axis.z;
float rcos = (float) Math.cos(phi);
float rsin = (float) Math.sin(phi);
float m[] = new float[16];
//(*this)(0,0) = rcos + u*u*(1-rcos);
//mRet.setM(0, rcos + u*u*(1-rcos));
m[0] = rcos + u*u*(1-rcos);
//(*this)(1,0) = w * rsin + v*u*(1-rcos);
//mRet.setM(1, w * rsin + v*u*(1-rcos));
m[1] = w * rsin + v*u*(1-rcos);
//(*this)(2,0) = -v * rsin + w*u*(1-rcos);
//mRet.setM(2, -v * rsin + w*u*(1-rcos));
m[2] = -v * rsin + w*u*(1-rcos);
//(*this)(3,0) = 0;
//mRet.setM(3, 0);
m[3] = 0;
//(*this)(0,1) = -w * rsin + u*v*(1-rcos);
//mRet.setM(4, -w * rsin + u*v*(1-rcos));
m[4] = -w * rsin + u*v*(1-rcos);
//(*this)(1,1) = rcos + v*v*(1-rcos);
//mRet.setM(5, rcos + v*v*(1-rcos));
m[5] = rcos + v*v*(1-rcos);
//(*this)(2,1) = u * rsin + w*v*(1-rcos);
//mRet.setM(6, u * rsin + w*v*(1-rcos));
m[6] = u * rsin + w*v*(1-rcos);
//(*this)(3,1) = 0;
//mRet.setM(7, 0);
m[7] = 0;
//(*this)(0,2) = v * rsin + u*w*(1-rcos);
//mRet.setM(8, v * rsin + u*w*(1-rcos));
m[8] = v * rsin + u*w*(1-rcos);
//(*this)(1,2) = -u * rsin + v*w*(1-rcos);
//mRet.setM(9, -u * rsin + v*w*(1-rcos));
m[9] = -u * rsin + v*w*(1-rcos);
//(*this)(2,2) = rcos + w*w*(1-rcos);
//mRet.setM(10, rcos + w*w*(1-rcos));
m[10] = rcos + w*w*(1-rcos);
//(*this)(3,2) = 0;
//mRet.setM(11, 0);
m[11] = 0;
//(*this)(0,3) = 0;
//mRet.setM(12, 0);
m[12] = 0;
//(*this)(1,3) = 0;
//mRet.setM(13, 0);
m[13] = 0;
//(*this)(2,3) = 0;
//mRet.setM(14, 0);
m[14] = 0;
//(*this)(3,3) = 1;
//mRet.setM(15, 1);
m[15] = 1;
mRet.setM(m);
}