How to prevent Convexhull function data reduction in matlab ?
1 次查看(过去 30 天)
显示 更早的评论
By default , convexhull function reduce the data given to it , How can we prevent it from doing it ? when this function do so , it will we useless for complicated shapes. Actually I need a Concave hull function. Thanks in advance.
0 个评论
回答(1 个)
Steven Lord
2018-7-11
Concave hulls are ambiguous, though there may be a tool that will help you that I'll mention after the example. Consider this set of points:
x = [-1 1 1 -1 0];
y = [-1 -1 1 1 0];
plot(x, y, 'o');
axis([-2 2 -2 2]);
axis square
Which would be the concave hull of this data?
figure
subplot(2, 2, 1);
plot(x([1:5 1]), y([1:5 1]), 'o-');
axis([-2 2 -2 2]);
axis square
subplot(2, 2, 2);
plot(x([1 2 5 3 4 1]), y([1 2 5 3 4 1]), 'o-');
axis([-2 2 -2 2]);
axis square
subplot(2, 2, 3);
plot(x([1 2 5 3 4 5 1]), y([1 2 5 3 4 5 1]), 'o-');
axis([-2 2 -2 2]);
axis square
subplot(2, 2, 4);
plot(x([1:4 1]), y([1:4 1]), 'o-');
hold on
plot(x(5), y(5), 'o');
axis([-2 2 -2 2]);
axis square
That being said, the alphaShape function may do what you want.
figure
plot(alphaShape(x.', y.'))
axis([-2 2 -2 2]);
axis square
Choose your alpha value carefully.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Bounding Regions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!