2
$\begingroup$

I have a set of circles defined by a Middlepoint and a radius e.g.

Circle1: x = 10, y = 10, r = 3
Circle2: x = 15, y = 2, r = 10
etc...

But I want to have them converted to Hexagons, do you know any formulas to calculate the 6 edge coordinates for them?

$\endgroup$
7
  • 1
    $\begingroup$ Polygon[CirclePoints[6]] $\endgroup$
    – george2079
    Commented Sep 27, 2016 at 19:08
  • $\begingroup$ Thank you for answering but how to get those 6 points is the question $\endgroup$
    – LuaNoob
    Commented Sep 27, 2016 at 19:16
  • $\begingroup$ did you read the docs for CirclePoints ? $\endgroup$
    – george2079
    Commented Sep 27, 2016 at 19:20
  • $\begingroup$ Sorry im quite new to this, where can i find those docs? $\endgroup$
    – LuaNoob
    Commented Sep 27, 2016 at 19:23
  • $\begingroup$ type CirclePoints and press "F1". The docs are also online: reference.wolfram.com/language/ref/CirclePoints.html $\endgroup$
    – george2079
    Commented Sep 27, 2016 at 19:28

1 Answer 1

6
$\begingroup$

The documentation can be found here: CirclePoints or here: RegularPolygon. You can convert a circle into a hexagon via the replacement rule Circle[x_, y_] :> Polygon[CirclePoints[x, y, 6]], or Circle[x_, y_] :> RegularPolygon[x, y, 6]

Here it is with 7 random circles,

circles = 
  Table[Circle[RandomReal[{-10, 10}, 2], RandomReal[{1, 2}]], {n, 
    7}];
Graphics@circles

Mathematica graphics

Graphics[{EdgeForm[Black], FaceForm[None], 
  circles /. Circle[x_, y_] :> RegularPolygon[x, y, 6]}]

Mathematica graphics

$\endgroup$
9
  • $\begingroup$ But how do I get the coordinates of them or better where can i draw them like you i cant find it $\endgroup$
    – LuaNoob
    Commented Sep 27, 2016 at 19:44
  • $\begingroup$ What coordinates? The coordinates for the six points of the hexagon? $\endgroup$
    – Jason B.
    Commented Sep 27, 2016 at 19:46
  • $\begingroup$ i guess I know how to get those points I saw in the Docs, but where can I draw them like you did? $\endgroup$
    – LuaNoob
    Commented Sep 27, 2016 at 19:47
  • 1
    $\begingroup$ Start with this: pts = CirclePoints[{1,1},2,6]; Print[pts]; hexagon = Polygon[pts]; Graphics[hexagon] $\endgroup$
    – Jason B.
    Commented Sep 27, 2016 at 19:49
  • $\begingroup$ I cant find the Internet Site you are using with it.. $\endgroup$
    – LuaNoob
    Commented Sep 27, 2016 at 19:52

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