Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

rotate

指定した原点と方向によってオブジェクトを回転

構文

rotate(h,direction,alpha)
rotate(...,origin)

説明

関数 rotate は 3 次元空間でグラフィックス オブジェクトを回転します。

rotate(h,direction,alpha) は、グラフィックス オブジェクト halpha 度回転させます。h は、surface、patch、line、text または image オブジェクトとして指定します。direction は、回転軸の原点と共に回転軸を示す 2 要素または 3 要素のベクトルです。回転軸の既定の原点がプロット ボックスの中心になります。この点は必ずしも Axes の原点でなくてもかまいません。

正の alpha は、回転の原点から伸長する方向ベクトルを中心とした右手則の角度として定義されます。

h がハンドル番号の配列である場合、すべてのオブジェクトが同じ Axes の子でなければなりません。

rotate(...,origin) は、回転軸の原点を 3 要素のベクトル [x0,y0,z0] として指定します。

メモ

image オブジェクトでは 3 次元データはサポートされていません。したがって、x-y 平面外のイメージの回転はサポートされていません。

すべて折りたたむ

関数 peaks の表面プロットを作成して surface オブジェクトを返します。

s = surf(peaks(20));
xlabel('x-axis')
ylabel('y-axis')
zlabel('z-axis')

Figure contains an axes object. The axes object with xlabel x-axis, ylabel y-axis contains an object of type surface.

表面プロットを x 軸を中心として 25 度回転させます。

direction = [1 0 0];
rotate(s,direction,25)

Figure contains an axes object. The axes object with xlabel x-axis, ylabel y-axis contains an object of type surface.

関数 peaks の表面プロットを作成して surface オブジェクトを返します。

s = surf(peaks(20));
xlabel('x-axis')
ylabel('y-axis')
zlabel('z-axis')

Figure contains an axes object. The axes object with xlabel x-axis, ylabel y-axis contains an object of type surface.

表面プロットを y 軸を中心として 25 度回転させます。

direction = [0 1 0];
rotate(s,direction,25)

Figure contains an axes object. The axes object with xlabel x-axis, ylabel y-axis contains an object of type surface.

関数 peaks の表面プロットを作成して surface オブジェクトを返します。

s = surf(peaks(20));
xlabel('x-axis')
ylabel('y-axis')
zlabel('z-axis')

Figure contains an axes object. The axes object with xlabel x-axis, ylabel y-axis contains an object of type surface.

表面プロットをその x 軸および y 軸を中心として 25 度回転させます。

direction = [1 1 0];
rotate(s,direction,25)

Figure contains an axes object. The axes object with xlabel x-axis, ylabel y-axis contains an object of type surface.

ヒント

オブジェクトのデータは、回転変換により変更されます。この手法は、視点のみを変更する view および rotate3d で使用される手法とは異なります。

回転軸は、回転の原点および点 P で定義されます。P は、球面座標 [theta phi] としてまたは直交座標 [xp,yp,zp] として指定してください。

Cartesian axes displaying the axis of rotation relative to an origin of rotation and point P

direction の 2 要素の形式では、thetax-y 平面上で正の x 軸から反時計回りの角度です。phi は、x-y 平面からの方向ベクトルの仰角です。

Cartesian axes displaying the location of point P relative to theta and phi

direction の 3 要素の形式では、直交座標を使って軸の方向を指定します。方向ベクトルは、回転原点から P へのベクトルです。

ヒント

rotate は、グラフィックス オブジェクトを回転させる XdataYdata および Zdata プロパティの値を変更します。

バージョン履歴

R2006a より前に導入