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 CenterFile Exchange에서 Fractals에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by