# Plotting a convex hull with a coordinate mesh

I am plotting the convex hull of some curves by extracting the curves from a contour plot and constructing the convex hull around their discretized version . It's not terribly accurate for calculations but it works well for a quick visualization.

Here's a simple example.

curve = ContourPlot3D[{((x - 0.5)^2 + (y - 0.5)^2 + (z -
0.5)^2) ((x + 0.5)^2 + (y + 0.5)^2 + (z + 0.5)^2) == 2,
x^2 + y^2 + z^2 == 1}, {x, -1.1, 1.1}, {y, -1.1, 1.1},
{z, -1.1, 1.1}, ContourStyle -> None, Mesh -> 0,
BoundaryStyle -> {1 -> None, 2 -> None, {1, 2} -> {Blue, Thickness[0.015]}},
PlotPoints -> 30];

hull = ConvexHullMesh@MeshCoordinates@Quiet@DiscretizeGraphics@First@Normal@curve;

Show[curve,hull]


The result is a convex hull with a mesh of all the polygons:

Can I turn this into an object that I can display a normal, coordinate-based mesh on? Something like this

that would work for any convex hull.

I want to do this because the convex hull mesh is ugly, but if I remove it it becomes difficult to see where a convex hull bends, where it's round etc.

• what about hull["Graphics3D"]? Apr 29, 2016 at 1:23
• @RunnyKine Hm. That doesn't seem to accept any options related to the mesh, unfortunately.
– T.J.
Apr 29, 2016 at 1:58
• @RunnyKine I have added an example.
– T.J.
Apr 29, 2016 at 2:14

You've created a MeshRegion, so you can plot it with RegionPlot3D,

Of course, since your cylinder is rotated with respect to the cartesian coordinates, you'll need to find the right combination of coordinates to give the mesh you want.

Here are some examples,

RegionPlot3D[hull, Mesh -> 10, MeshFunctions -> #, Axes -> True,
ImageSize -> 400] & /@
{{#1 &, #2 &},
{1/4 (2 - Sqrt[2]) #1 + 1/4 (2 + Sqrt[2]) #2 - #3/2 &,
-(#1/2) + #2/2 + #3/Sqrt[2] &},
{1/4 (2 + Sqrt[2]) #1 + 1/4 (2 - Sqrt[2]) #2 &,
1/4 (2 - Sqrt[2]) #1 + 1/4 (2 + Sqrt[2]) #2 &,
-(#1/2) + #2/2 &},
{1/4 (2 + Sqrt[2]) #1 + 1/4 (2 - Sqrt[2]) #2 + #3/2 &,
-(#1/2) + #2/2 + #3/Sqrt[2] &}}


This set of coordinates comes close to matching the original mesh,

RegionPlot3D[hull, Mesh -> 15,
MeshFunctions -> {(1/Sqrt[2.] (#1 - #2) &), (1/Sqrt[
2.] (-#1 + #3) &), 1/Sqrt[3] (#1 + #2 + #3) &},
Axes -> True, ImageSize -> 400]