public static RotateY ( double angle ) : |
||
angle | double | rotate angle |
return |
public static Matrix4 RotateY(double angle)
{
Matrix4 rotateX = new Matrix4();
rotateX.Type = MatrixType.Rotation;
rotateX.Identity();
double sin = (double)Math.Sin(angle);
double cos = (double)Math.Cos(angle);
rotateX.Matrix[0, 0] = cos;
rotateX.Matrix[0, 2] = -sin;
rotateX.Matrix[2, 0] = sin;
rotateX.Matrix[2, 2] = cos;
return rotateX;
}
/// <summary> /// rotate slab with specific angle /// </summary> /// <param name="xAngle">rotate angle in X direction</param> /// <param name="yAngle">rotate angle in Y direction</param> public void RotateFloor(double xAngle, double yAngle) { if (0 == xAngle && 0 == yAngle) { return; } m_rotateAngleX += xAngle; m_rotateAngleY += yAngle; Matrix4 rotateX = Matrix4.RotateX(m_rotateAngleX); Matrix4 rotateY = Matrix4.RotateY(m_rotateAngleY); Matrix4 rotateMatrix = Matrix4.Multiply(rotateX, rotateY); m_rotateMatrix = Matrix4.Multiply(m_MoveToPictureBoxCenter.Inverse(), rotateMatrix); m_rotateMatrix = Matrix4.Multiply(m_rotateMatrix, m_MoveToPictureBoxCenter); }