does convex hull intersect?

5 visualizaciones (últimos 30 días)
CHANDRABHAN Singh
CHANDRABHAN Singh el 13 de En. de 2022
Comentada: CHANDRABHAN Singh el 21 de En. de 2022
Hello. The codes shown produces two convhull. I want to generate a parameter p such that
if convhull intersect, p=false
else, p=true. Any help or suggetions regarding this. Thanks in advance.
figure
for ii=1:2
rand_theta(ii,:) = sort(rand(1,10)).*2*pi;
rand_beta(ii,:) = sort(rand(1,10)).*pi - pi/2;
radius = 5;
[x(ii,:), y(ii,:), z(ii,:)] = sph2cart(rand_theta(ii,:), rand_beta(ii,:),radius);
%[X, Y, Z] = meshgrid(x,y,z);
k = convhull(x(ii,:), y(ii,:), z(ii,:));
trisurf(k, x(ii,:), y(ii,:), z(ii,:));
hold on;
end

Respuesta aceptada

Matt J
Matt J el 13 de En. de 2022
Editada: Matt J el 13 de En. de 2022
You can use intersectionHull() from
for ii=1:2
V{ii}=[x(ii,:); y(ii,:); z(ii,:)]';
end
S=intersectionHull('vert',V{1},'vert',V{2});
If S.vert is empty, there is no intersection.
  3 comentarios
Matt J
Matt J el 20 de En. de 2022
I cannot see where, in this code, you call intersectionHull().
CHANDRABHAN Singh
CHANDRABHAN Singh el 21 de En. de 2022
I have specified piece of code using intersectionhull below. Line 58 of the code.
for ii= 1:numel(agg_num)
V{1}=[x_plot(agg_num(ii),1:theta_m(agg_num(ii),1)); y_plot(agg_num(ii),1:theta_m(agg_num(ii),1)); z_plot(agg_num(ii),1:theta_m(agg_num(ii),1))]';
V{2}=[x_plot(jj,1:theta_m(jj,1)); y_plot(jj,1:theta_m(jj,1)); z_plot(jj,1:theta_m(jj,1))]';
S=(intersectionHull('vert',V{1},'vert',V{2}));
s=isempty(S.vert);
while_inner_loop = s;

Iniciar sesión para comentar.

Más respuestas (1)

Bjorn Gustavsson
Bjorn Gustavsson el 13 de En. de 2022
You should have two file-exchange packages that solves your problem:
They should be able to return the intersection-points of your conv-hull curves. I don't know how they behave for peculiar edge-cases like osculating curves and potentially similar corners (and how you want to solve those considering our finite precision...)
HTH

Categorías

Más información sobre Bounding Regions en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by