Matrix4.Rotate

Rotate(double, Vector3)

通过旋转角度和轴创建旋转矩阵

public static Matrix4 Rotate(double angle, Vector3 axis)
参数类型描述
角度Double以弧度表示的旋转角度
Vector3旋转轴

示例

以下代码展示了如何创建用于旋转操作的矩阵。

var t = Matrix4.Rotate(Math.PI, new Vector3(0, 1, 0));
var pos = new Vector3(1, 1, 10);
Console.WriteLine($"Transformed: {t * pos}");

另请参见


Rotate(Quaternion)

从四元数创建旋转矩阵

public static Matrix4 Rotate(Quaternion q)
参数类型描述
q四元数旋转四元数

示例

以下代码展示了如何创建用于旋转操作的矩阵。

var t = Matrix4.Rotate(Quaternion.FromAngleAxis(Math.PI, Vector3.YAxis));
var pos = new Vector3(1, 1, 10);
Console.WriteLine($"Transformed: {t * pos}");

另请参见