3D Bounding Boxの可視化がしたい

10 vues (au cours des 30 derniers jours)
尚輝 伊東
尚輝 伊東 le 6 Oct 2021
Commenté : Kenta le 8 Oct 2021
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 commentaires
Atsushi Ueno
Atsushi Ueno le 6 Oct 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
尚輝 伊東
尚輝 伊東 le 8 Oct 2021
Ueno 様
ご回答ありがとうございます。
やはり今の条件だけでは厳しいようですね...
検討していただき、ありがとうございます。

Connectez-vous pour commenter.

Réponse acceptée

Kenta
Kenta le 6 Oct 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 commentaires
尚輝 伊東
尚輝 伊東 le 8 Oct 2021
Kenta 様
ご回答ありがとうございます。
まさにこのような処理がやりたかったです。
条件をもう少し工夫する必要がありますが、関数を教えていただきありがとうございます。
Kenta
Kenta le 8 Oct 2021
@尚輝 伊東 さま、ご連絡ありがとうございます。よかったです。
なるほど、これからどんどんカスタマイズされるのですね、スムーズに実装できるといいですね!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!