필터 지우기
필터 지우기

How to plot the exterior edges only of an alphaShape

조회 수: 19 (최근 30일)
Mustafa Al Homsi
Mustafa Al Homsi 2019년 3월 18일
댓글: Román Comelli 2022년 2월 1일
I am trying to plot an alphaShape using the code below
x = rand(10,1)*5;
y = rand(10,1)*5;
shape = alphaShape(x,y);
alphas = alphaSpectrum(shape);
shape.Alpha = alphas(1);
ax = app.mapPlt;
plot(shape,'Parent',ax,'EdgeColor','none','LineStyle','--','LineWidth',0.75);
When I plot this shape, the exterior edges are blank. Changing the last line to
plot(shape,'Parent',ax,'EdgeColor','black','LineStyle','--','LineWidth',0.75);
will plot the exterior esdges but it will also plot the the interior edges. Is there a way to plot the exterior edges only?

답변 (1개)

John D'Errico
John D'Errico 2019년 3월 19일
편집: John D'Errico 2019년 3월 20일
When you have a problem like this, learn how to investigate what you can do with the class.
x = rand(10,1)*5;
y = rand(10,1)*5;
shape = alphaShape(x,y);
>> methods(shape)
Methods for class alphaShape:
alphaShape alphaTriangulation boundaryFacets inShape numRegions plot volume
alphaSpectrum area criticalAlpha nearestNeighbor perimeter surfaceArea
methods tells you what methods have been provided. Here, do any of them sound interesting? I hope so.
edges = boundaryFacets(shape)
edges =
1 4
4 8
8 6
6 10
10 3
3 9
9 2
2 5
5 1
plot(x(edges),y(edges),'-ro')
hold on
plot(x,y,'.')
So a fairly boring alpha shape, since all but one of the points were on the perimeter.
  댓글 수: 6
John D'Errico
John D'Errico 2019년 3월 20일
You know how to plot the shape, filled, with NO edges.
Do you know how to then add a second set of edges on top?
help hold
So just then add the perimeter edges on top. Make them any color you wish.
Román Comelli
Román Comelli 2022년 2월 1일
Is there any easy way to do this with 3D polytopes?

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

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by