3
$\begingroup$

I need to extract the six boundary corner points (vertices of hexagon) from the following hexagonal region plot.

RegionPlot[
 Abs[(5 x)/Sqrt[3] + y] <= (4 \[Pi])/3 && 
  Abs[x/(3 Sqrt[3]) + y] <= (4 \[Pi])/9 && 
  Abs[-((2 x)/Sqrt[3]) + y] <= (2 \[Pi])/3, {x, -2, 2}, {y, -2, 2}]

Can anyone kindly help me in this regard? Thanks in advance.

$\endgroup$

1 Answer 1

5
$\begingroup$
Clear["Global`*"];
reg = ImplicitRegion[
   Abs[(5 x)/Sqrt[3] + y] <= (4 \[Pi])/3 && 
    Abs[x/(3 Sqrt[3]) + y] <= (4 \[Pi])/9 && 
    Abs[-((2 x)/Sqrt[3]) + y] <= (2 \[Pi])/3, {x, y}];
bdr = BoundaryDiscretizeRegion[reg];
pts = MeshCoordinates[bdr];
ctr = RegionCentroid[bdr];
corners = {#, EuclideanDistance[ctr, #]} & /@ pts // 
   SortBy[Last] // #[[-6 ;;]] &

Show[bdr, Graphics[{Red, Point@corners[[All, 1]]
   , Blue, Point@ctr
   }
  ], Frame -> True
 ]

enter image description here

$\endgroup$
1
  • $\begingroup$ All the values of corners are related to Pi: corners = Pi*(corners/Pi // RootApproximant) $\endgroup$
    – Bob Hanlon
    May 20 at 20:12

Your Answer

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

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