Main Content

rotate

旋转 polyshape

说明

示例

polyout = rotate(polyin,theta) 返回将 polyin 相对于参考点 (0,0) 旋转 theta 度而产生的 polyshape 对象。

示例

polyout = rotate(polyin,theta,refpoint) 指定旋转的参考点。

示例

全部折叠

创建一个正方形 polyin,然后相对于点 (0,0) 逆时针旋转 45 度。

polyin = polyshape([0 0 1 1],[1 0 0 1]);
poly1 = rotate(polyin,45);

polyin 相对于点 (1,0) 旋转 45 度。

poly2 = rotate(polyin,45,[1 0]);

绘制这三个多边形。

plot([polyin poly1 poly2])
axis equal

输入参数

全部折叠

输入 polyshape,指定为标量、向量、矩阵或多维数组。

数据类型: polyshape

旋转角度,指定为以标量值表示的度数。当输入 polyshape 是数组时,数组的每个元素都旋转 theta 度。当 theta 为正时,旋转方向为逆时针;当 theta 为负时,旋转方向为顺时针。

数据类型: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

参考点,指定为包含 x 坐标和 y 坐标的二元素行向量。rotate 函数相对于参考点进行旋转。当输入 polyshape 是数组时,数组的每个元素都相对于 refpoint 进行旋转。

数据类型: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

扩展功能

版本历史记录

在 R2017b 中推出

另请参阅

| |