Basic 3D plotting on 3D axis

9 ビュー (過去 30 日間)
Yordan
Yordan 2014 年 2 月 12 日
編集済み: Matt J 2014 年 2 月 12 日
This is a very basic question. I am sorry I am absolutely new and i am trying to figure out one of the basics into 3D plotting. Lets say I create and 3D plot axis:
axis([0 100 0 100 0 100])
grid on
Now lets say i want to crate 2 different cubes with size of 10 10 10. I want to be able to display this 2 cubes over this axis with different positions. Let say the one to be at 20 20 0 the other at 50 50 0.
Thank you

採用された回答

Walter Roberson
Walter Roberson 2014 年 2 月 12 日
F1 = [0 1 1 0 0;
0 0 1 1 0;
0 0 0 0 0]
F1 * 10 is now [X; Y; Z] for the front face for a cube.
f20 = [20 + 10 * F1(1,:); 20 + 10 * F1(2,:); 0 + 10 * F1(3,:)] would put that face at [20 20 0]
patch(f20(1,:), f20(2,:), f20(3,:))
would create the graphic for that face.
You can extend this sort of technique to the other faces.

その他の回答 (1 件)

Yordan
Yordan 2014 年 2 月 12 日
Thank you!

カテゴリ

Help Center および File ExchangeInteractions, Camera Views, and Lighting についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by