Identify nodes which lie within a range of 3D volumes

3 ビュー (過去 30 日間)
Vicki Corrigan
Vicki Corrigan 2019 年 4 月 12 日
回答済み: Fabio Freschi 2019 年 8 月 7 日
I have tagged multiple different regions of a 3d plot which I want to look at data for as demonstrated by the shaded cuboids on the figure below. I then have a range of random xyz coordinates and want to identify which nodes lie within any of the boxed regions which I’ve identified. I have the vertices for each of the regions saved in an 8x3x31 double and a random dataset of xyz nodes saved as xrand, yrand and zrand to be checked.
Tagged Regions Cropped.png
I want to create a separate dataset containing only the nodes within the boxed regions. Any guidance would be great!
  1 件のコメント
darova
darova 2019 年 8 月 6 日
Hi! The data you attached contains Vertices of size 8x8x31
How to define x,y,z of cuboids?
Is the question still actual?

サインインしてコメントする。

回答 (1 件)

Fabio Freschi
Fabio Freschi 2019 年 8 月 7 日
Try this
% preallocation
idx = cell(size(Vertices,3),1);
% for each box
for i = 1:size(Vertices,3)
% find box min and max
minV = min(Vertices(:,:,i));
maxV = max(Vertices(:,:,i));
% find points in box
idx{i} = find(xrand >= minV(1) & xrand <= maxV(1) & ... % points within x range
yrand >= minV(2) & yrand <= maxV(2) & ... % points within y range
zrand >= minV(3) & zrand <= maxV(3)); % points within z range
end

カテゴリ

Help Center および File ExchangeFractals についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by