3D Bounding Boxの可視化がしたい
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Bounding Boxの可視化を3次元で行いたいです。
例えば、次のような8頂点の座標が与えられているとします。
[array([-35.89922945, 197.26166974, 17.43749083]),
array([-37.55457094, 88.89204521, 20.0512217 ]),
array([ 61.77622177, 97.12136408, 424.16114286]),
array([ 63.43156326, 205.49098861, 421.54741199]),
array([148.03557994, 84.95884208, -25.48700505]),
array([149.69092143, 193.32846662, -28.10073593]),
array([249.02171414, 201.55778549, 376.00918523]),
array([247.36637265, 93.18816096, 378.62291611])]
この時、それぞれの点を頂点とする直方体を3次元空間で可視化したいです。
Bounding Boxなので、点と点を線で結んだような枠組みのみの直方体を可視化したいです。
よろしくお願いします。
2 Kommentare
Atsushi Ueno
am 6 Okt. 2021
頂点だけでなく、面の定義をしないとこうなってしまいます。
「Bounding Boxを作った機能」側から「面を構成する頂点」の情報は得られないのでしょうか?
頂点の位置から面の構成を作るのは... (-公-;)チョットムズカシイ
bb=[array([-35.89922945, 197.26166974, 17.43749083]),
array([-37.55457094, 88.89204521, 20.0512217 ]),
array([ 61.77622177, 97.12136408, 424.16114286]),
array([ 63.43156326, 205.49098861, 421.54741199]),
array([148.03557994, 84.95884208, -25.48700505]),
array([149.69092143, 193.32846662, -28.10073593]),
array([249.02171414, 201.55778549, 376.00918523]),
array([247.36637265, 93.18816096, 378.62291611])];
plot3(bb(:,1),bb(:,2),bb(:,3)); hold on;
plot3(bb(:,1),bb(:,2),bb(:,3), '*');
function out = array(vertex)
out = vertex;
end
Akzeptierte Antwort
Kenta
am 6 Okt. 2021
伊東さま、こんにちは、このようなイメージでしょうか?showshapeという関数で行えます。
またもう少しカスタマイズしたければ以下のファイルなどを参考に書き換えてみてもいいかもしれません。
https://jp.mathworks.com/matlabcentral/fileexchange/18264-minimal-bounding-box

pt=pcread('teapot.ply');
figure;pcshow(pt);hold on
pos = [0.3753 0 1.65 6 4 3 0 0 0];
showShape('cuboid',pos,'Color','green','Opacity',0.5)
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!