Main Content

rotate

説明

polyout = rotate(polyin,theta) は、基準点 (0,0) を基準に polyintheta 度回転させて作成された polyshape オブジェクトを返します。

polyout = rotate(polyin,theta,refpoint) は、回転の基準となる基準点を指定します。

すべて折りたたむ

正方形 polyin を作成し、点 (0,0) を基準に反時計回りに 45 度回転させます。

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

点 (1,0) を基準に polyin を 45 度回転させます。

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

3 つの多角形をすべてプロットします。

plot([polyin poly1 poly2])
axis equal

Figure contains an axes object. The axes object contains 3 objects of type polygon.

入力引数

すべて折りたたむ

入力 polyshape。スカラー、ベクトル、行列または多次元配列として指定します。

データ型: polyshape

回転角度。度単位のスカラー数値として指定します。入力 polyshape が配列の場合、この配列の各要素が theta 度回転します。theta が正の場合、回転は反時計回りで、theta が負の場合は時計回りです。

データ型: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

基準点。x 座標と y 座標を含む 2 要素の行ベクトルとして指定します。関数 rotate では、この基準点を基準に回転します。入力 polyshape が配列の場合、この配列の各要素は refpoint を基準に回転します。

データ型: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

拡張機能

バージョン履歴

R2017b で導入