Identify nodes which lie within a range of 3D volumes
4 views (last 30 days)
Show older comments
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.

I want to create a separate dataset containing only the nodes within the boxed regions. Any guidance would be great!
1 Comment
darova
on 6 Aug 2019
Hi! The data you attached contains Vertices of size 8x8x31
How to define x,y,z of cuboids?
Is the question still actual?
Answers (1)
Fabio Freschi
on 7 Aug 2019
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
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!