필터 지우기
필터 지우기

How to create a boundary along the edges for 3d plot?

조회 수: 30 (최근 30일)
Shiv Karpoor
Shiv Karpoor 2022년 3월 8일
댓글: Shiv Karpoor 2022년 3월 9일
Hello MATLAB Community,
I am having a problem creating boundary line for the point cloud as shown in the below image in RED colour.
(Note: the below image is taken from MATLAB blogs)
here is my code and excel document consisting of around 14000 points:
A = readmatrix('points435');
plot3(A(:,1),A(:,2),A(:,3),'.')
My code runs a part of the problem I am working on.
The image shown above is different from the results of the code attached.
I only need to trace a line along the boundary of the point cloud which is 3d.
Can anyone please help me with any suggestions.
Thank you in advance!!
I really appreciate your help.
Kind regards,
Shiv

채택된 답변

Benjamin Thompson
Benjamin Thompson 2022년 3월 8일
There is a function called "boundary" that should work for you. Type "help boundary" or "doc boundary" for more information.
  댓글 수: 3
Benjamin Thompson
Benjamin Thompson 2022년 3월 8일
편집: Benjamin Thompson 2022년 3월 8일
Boundary supports 3D problems also. In that case the return value specifies the set of triangles enclosing your shape. But you problem is really 2D since the third dimension is constrained to 435. Here is how to construct the boundary of your 2D data set in 3D space:
>> data = xlsread('points435.xlsx');
>> figure, plot3(data(:,1), data(:,2), data(:,3));
>> min(data(:,1))
ans =
-7.926606985093684
>> min(data(:,2))
ans =
-6.864643014906309
>> min(data(:,3))
ans =
435
>> max(data(:,3))
ans =
435
>> k = boundary(data(:,1), data(:,2));
>> hold on, plot3(data(k,1), data(k,2), 435*ones(size(k,1),1), 'r-')
>> grid on;
>>
If you are looking for something different look over all the options that boundary offers. Adjusting the shrink factor parameter "s" may help you tweak the output some.
Shiv Karpoor
Shiv Karpoor 2022년 3월 9일
Hi Benjamin,
I tried your method on the actual problem I am working on and I am glad to inform you that it worked.
Thanks for your help! I really appreciate it.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Max Alger-Meyer
Max Alger-Meyer 2022년 3월 8일
So this is actually a pretty complicated problem. Luckily for you, someone already wrote and posted the code for this exact situation: https://www.mathworks.com/matlabcentral/fileexchange/60690-boundary-extraction-identification-and-tracing-from-point-cloud-data
  댓글 수: 1
Shiv Karpoor
Shiv Karpoor 2022년 3월 9일
Hi Max,
I had a look at the link, its quite complicated.
But since my Z values are constant all the time, Benjamin provided a solution to trace the boundary.
Anyways, thanks for the suggestion.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by