Find points on a 3D convex hull surface

5 views (last 30 days)
Hi all,
I have a 3D convex hull and would like to populate it's surface with points. To be more specific, the convex hull gives the coordinates of the vertices of the smallest enclosing polygon, but I would like many more points, spread across the hull's surface.
Ultimately, I would like to transform these coordinates into spherical coordinates and generate a 'map' of the distance to the edge of the convexhull at every possible azimuth/elevation. A rough demonstration of this can be seen below. You will see that the step involving scatteredInterpolant would benefit from having many more points to work with, which is why I need more points falling on the convexhull surface...
Thanks for any help,
Rod.
% generate random data and find 3D convex hull
dat = [10 10 40].*rand(50,3);
K = convhulln(dat);
% convert these to spherical coordinates centred on hull centroid
cdat = dat-nanmean(dat(K,:));
[azi,ele,rad] = cart2sph(cdat(:,1),cdat(:,2),cdat(:,3));
% plot the result
figure
subplot(1,2,1)
scatter(azi,ele,20,rad)
daspect([1 1 1])
title('Actual points')
subplot(1,2,2)
F = scatteredInterpolant([azi ele],rad,'natural');
[xe,ye] = meshgrid(-pi:0.1:pi,-pi/2:0.1:pi/2);
dmap = F(xe,ye);
imagesc(dmap);
axis xy
daspect([1 1 1])
title('Distance map')

Answers (0)

Categories

Find more on Bounding Regions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!