intersection of 3d convex hull

10 views (last 30 days)
The intersectionhull() file is to check whether two 3d convexhull intersects or not. But it is not working in some of the cases. How to rectify this issue. Or is there anyother method to determine the intersection of the two 3d cconvexhulls.
Thanks for the support.
p1= [43.961289283353700 33.512575463274281 33.613840429989359 42.340944494263006 35.288986368542560 41.056811554217155];
p2=[30.590075583980230 35.915120121340294 33.574933295509716 37.344208504897921 26.173402555032332 30.198012511343730];
p3 =[10.330796683012963 9.963200883535126 18.574452071667043 15.835847248672628 12.879791022170529 19.414601585972356];
q1=[46.004744828920650 41.163393660365159 51.452401327922964 41.849385497620105 42.869991197527590 50.039024582191267];
q2=[31.424550981019021 35.676956419203506 28.922337320334460 27.076344973453185 31.778507082954274 37.111194619619646];
q3=[ 23.867241879231550 19.005969411102843 14.847070059958151 18.395037298236641 11.732895264936387 17.288528904954013];
V{1} = [p1;p2;p3];
V{2} = [q1;q2;q3];
S=(intersectionHull('vert',V{1},'vert',V{2}));
Unrecognized function or variable 'intersectionHull'.
s=isempty(S.vert);
k = convhull(p1,p2,p3);
trisurf(k,p1,p2,p3);
hold on;
k = convhull(q1,q2,q3);
trisurf(k,q1,q2,q3);
  2 Comments
CHANDRABHAN Singh
CHANDRABHAN Singh on 7 Mar 2022
@Simon Chan thanks for quick response. Is it nessesary to have same number of vertices to use intersectionhull, else it is giving vertcat error?
Simon Chan
Simon Chan on 7 Mar 2022
Better to ask the author but I think it is not necessary to have the same number of vertices for each polyhedron.

Sign in to comment.

Accepted Answer

Simon Chan
Simon Chan on 7 Mar 2022
Have a quick look on the function and I suspect you should use transpose of V{1} and V{2} as the input arguments
S=(intersectionHull('vert',V{1}','vert',V{2}'));
I am able to get something like the following:
h=convhull(S.vert(:,1),S.vert(:,2),S.vert(:,3));
trisurf(h,S.vert(:,1),S.vert(:,2),S.vert(:,3));
from the original 3D shapes.
k = convhull(p1,p2,p3);
trisurf(k,p1,p2,p3);
hold on;
k = convhull(q1,q2,q3);
trisurf(k,q1,q2,q3);

More Answers (0)

Categories

Find more on Bounding Regions in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!