7
$\begingroup$

I have the following convex hull.

P0={0,0,0};
P1={1,0,0};
P2={0,1,0};
P3={0,0,1};

ConvexHullMesh[{P0,P1,P2,P3}]

Now I want the region algebraically as equality of the convex hull generated, in this case x+y+z<1&&x>0&&y>0&&z>0. Is there any automatic way to get it from Mathematica by converting the convex hull generated as a region and then convert it into inequality?

$\endgroup$

1 Answer 1

11
$\begingroup$
chm = ConvexHullMesh[{P0, P1, P2, P3}]; 

ClearAll[regFunc]

regFunc[{x, y, z}] := FullSimplify @ RegionMember[Rationalize @
    MeshPrimitives[DiscretizeRegion[chm, MaxCellMeasure -> ∞], 3][[1]]] @ {x, y, z}

regFunc @ {x, y, z}
 x + y + z <= 1 && z >= 0 && y >= 0 && x >= 0

Also

dm = DelaunayMesh[{P0, P1, P2, P3}];

ClearAll[regFunc2]

regFunc2[{x_, y_, z_}] := FullSimplify @
   RegionMember[Rationalize @ First @ MeshPrimitives[dm, 3]] @ {x, y, z};

regFunc2 @ {x, y, z}
 x + y + z <= 1 && z >= 0 && y >= 0 && x >= 0
$\endgroup$
9
  • 1
    $\begingroup$ Thanks a lot. Just another question: Can this be done for a 4-d convex hull? Of course, Mathematica cannot evaluate the convex hull for a 4-d case. But is there any way to get the inequality representation of the convex hull? The type of convex hull I work with has 5 points for a 4-d case and so is very simple. Say for example {0,0,0,0},{1,0,0,0}, {0,1,0,0},{0,0,1,0},{0,0,0,1}. Is there any way to get it just like the 3d case you showed in Mathematica itself? $\endgroup$
    – Epsilon
    Jun 14, 2020 at 4:32
  • 1
    $\begingroup$ @SumitBanik, thank you for the accept. Don't know how the nD case can be handled. $\endgroup$
    – kglr
    Jun 14, 2020 at 4:47
  • $\begingroup$ Alright.Thanks a lot $\endgroup$
    – Epsilon
    Jun 14, 2020 at 4:55
  • 1
    $\begingroup$ An nD example can be found here. $\endgroup$
    – Greg Hurst
    Jun 14, 2020 at 11:36
  • $\begingroup$ When I several convex hulls defined in an array R[i], where say $\endgroup$
    – Epsilon
    Jun 15, 2020 at 2:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.