函数 rotate #

将大小为 1x2 的向量按给定角度逆时针旋转。将大小为 1x3 的向量按给定角度绕给定轴逆时针旋转。

Syntax #

math.rotate(w, theta)
math.rotate(w, theta, v)

Parameters #

Parameter Type Description
w Array | Matrix 待旋转向量
theta number | BigNumber | Complex | Unit 旋转角度
v Array | Matrix 旋转轴

Returns #

Type Description
Array | Matrix 旋转矩阵与 w 的乘积

Throws #

Type | Description —- | ———–

Examples #

math.rotate([11, 12], math.pi / 2)                           // returns [-12, 11]
math.rotate(matrix([11, 12]), math.pi / 2)                   // returns [-12, 11]

math.rotate([1, 0, 0], unit('90deg'), [0, 0, 1])             // returns [0, 1, 0]
math.rotate(matrix([1, 0, 0]), unit('90deg'), [0, 0, 1])     // returns Matrix [0, 1, 0]

math.rotate([1, 0], math.complex(1 + i))                     // returns [cos(1 + i) - sin(1 + i), sin(1 + i) + cos(1 + i)]

另请参阅 #

matrix, rotationMatrix

Fork me on GitHub