軸がz軸と平行ではない円錐面のplot方法

4 views (last 30 days)
dai
dai on 16 Sep 2020
Commented: dai on 17 Sep 2020
3次元で頂点の座標,頂点と底面を結ぶ直線の傾き,底面の半径が分かっているときに円錐面をplotする方法はありますか?
頂点が原点,そして円錐の軸がz軸である場合はcylinder関数を用いて以下のように円錐が描けます.
ここから任意の点を頂点とし,軸を一定の角度に傾けて円錐を描くことは可能でしょうか?
%円錐の作成
[X,Y,Z] = cylinder([0:0.1:1],50);
Z = Z/sqrt(2);
%plot
surf(X,Y,Z)

Accepted Answer

Shunichi Kusano
Shunichi Kusano on 16 Sep 2020
こんにちは
3次元の回転を使って頂点の座標を変換して、それを描画することができました。添付のスクリプトの使い方を下に示します。
%円錐の作成
[X,Y,Z] = cylinder([0:0.1:1],50);
Z = Z/sqrt(2);
%plot
f = surf(X,Y,Z);
axis equal
surf_rot_3d(f, 45, 30, [10 20 30]);
2番目の45はx->y軸方向の回転角(方位角)
3番目の30はz->x方向の俯角
4番目の[10 20 30]は頂点座標のxyz
です。角度はそれぞれdegreeで入れてください。実行すると元のプロットが上書きされて3次元回転したものになっているはずです。
  1 Comment
dai
dai on 17 Sep 2020
解決しました!回答の速さに感動です...
とても助かりました.ありがとうございます!

Sign in to comment.

More Answers (0)

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!