# Polytopes package for represents the intersection of elements

How do I use the Hexagon function of the Polytopes package?

I am not understanding what is shown in the documentation. I do not see any parameters.

Different from Circle function where I enter the center value, radius value, ...

EDIT

Actually, my goal is to apply a Boolean operation so that I get this geometry.

The procedure I have in mind is to create a 3D hexagon and a sphere with a certain thickness. With this I could apply some command that get a geometry that represents the intersection of these elements.

In the image the ball is cut in half for just visualization. In fact the sphere is whole to make the intersection.

My attempts:

ℛ =
RegionDifference[Ball[{0, 0, 0}, 10], Ball[{0, 0, 0}, 9]];
DiscretizeRegion[ℛ]


I have identified the points for my Hexagon

transform = CoordinateTransformData["Polar" -> "Cartesian", "Mapping"];
{p1, p2, p3, p4, p5, p6} =
transform[{2 Sqrt[3], # Degree}] & /@ Most[Subdivide[360, 6] + 30] //
N

Graphics[{Black, Line[{p1, p2, p3, p4, p5, p6, p1}], Dashed, Red,
Circle[{0, 0}, 3]}]


Here I tried to define all the vertices:

p0h = {{3., 1.7320508075688772, 0}, {0., 3.4641016151377544,
0}, {-3., 1.7320508075688772, 0}, {-3., -1.7320508075688772,
0}, {0., -3.4641016151377544, 0},
{3., -1.7320508075688772, 0}};
p15h = {{3., 1.7320508075688772, 15}, {0., 3.4641016151377544,
15}, {-3., 1.7320508075688772, 15}, {-3., -1.7320508075688772,
15}, {0., -3.4641016151377544, 15},
{3., -1.7320508075688772, 15}};


But it does not work:

hex = Hexahedron[Join[p0h, p15h]];
Graphics3D[{Pink, hex}]


If all you want is a nice picture, you can use contourRegionPlot3D[] from this answer:

(* by Simon Woods *)
contourRegionPlot3D[region_, {x_, x0_, x1_}, {y_, y0_, y1_}, {z_, z0_, z1_},
opts : OptionsPattern[]] :=
Module[{reg, preds},
reg = LogicalExpand[region &&
x0 <= x <= x1 && y0 <= y <= y1 && z0 <= z <= z1];
preds = Union @ Cases[reg, _Greater | _GreaterEqual |
_Less | _LessEqual, -1];
Show @ Table[ContourPlot3D[Evaluate[Equal @@ p],
{x, x0, x1}, {y, y0, y1}, {z, z0, z1},
RegionFunction -> Function @@ {{x, y, z},
Refine[reg, p] && Refine[! reg, ! p]},
opts], {p, preds}]]

With[{r1 = 9/10, r2 = 1, r = 3/4},
contourRegionPlot3D[RegionMember[SphericalShell[{0, 0, 0}, {r1, r2}], {x, y, z}] &&
RegionMember[RegularPolygon[r, 6], {x, y}] && z > 0,
{x, -1, 1}, {y, -1, 1}, {z, 0, 1},
BoxRatios -> Automatic, Mesh -> False]]


• With your license, I could edit your answer to append the code you just referenced. I think it's important to show this contourRegionPlot3D[] function in your answer. Commented Dec 20, 2016 at 10:49

Edit: RegularPolygon

I think they are used as symbolic objects rather than like a function, so you could write Vertices[Hexagon] for example. This does mean you can't set certain properties of the object, but that doesn't seem to be the aim of the package. If you want to make regular shapes like that with inputs you could use:

Polygon[(# + {1, 1}) & /@ CirclePoints[6]]


Where {1,1} is the position of the centre of the shape and 6 is the number of vertices.

If you want a pre-built function there is RegularPolygon as pointed out by J.M. which seems to do pretty much exactly the same thing.

• ...or use RegularPolygon[]. Commented Dec 16, 2016 at 10:40
• Yeah fair enough. I never really encountered it before so it didn't come to mind. I'll edit it in. Commented Dec 16, 2016 at 10:41
• @Caio, why not look through the docs for those functions? You'll see that it can take a "radius" argument corresponding to its circumradius. Commented Dec 16, 2016 at 10:45
• @Caio, then why not edit your question to mention that requirement? Commented Dec 16, 2016 at 11:06