# Combine a star and a circle as a new shape and show in a grid

I wish to create a two by two Grid

  y = Graphics[{Red, Disk[Scaled[{.01, .01}]]}];
GraphicsGrid[{{"", "first column"}, {"first raw", GraphicsGrid[{{y, y}, {y, y}}]}}, Frame -> All,
ImageSize -> 40*{3, 3}],


but instead of a Disk for Graphics, a new shape as the below one is desired. I don't know how can I generate that, and replace one of disks by this shape. Can anyone help me?

In addition, how can I apply the Alignment for just Disks and the new shape. For example the desired case is putting the new shape at the center of the cell as long as Disks be on the three corners.

Maybe this will work for you.

circledStar =
Module[{blue, thick, circle, pentagonPts, innerPt, starPts, star},
blue = RGBColor[{.3, .6, 1}];
thick = Scaled[.03];
circle = {Thickness[thick], Red, Circle[{0, 0}, 1.07]};
pentagonPts = CirclePoints;
innerPt =
RegionIntersection[
Line[{pentagonPts[], pentagonPts[]}],
Line[{pentagonPts[], pentagonPts[]}]];
starPts =
N[
DeleteDuplicates[
Catenate[
NestList[
RotationTransform[360/5 Degree],
{pentagonPts[], innerPt[[1, 1]], pentagonPts[]},
4]]]];
star = {EdgeForm[{Thickness[thick], Red}], FaceForm[blue], Polygon[starPts]};
Graphics[{circle, star}]] Grid[
{{"", "first column"},
{"first row", GraphicsGrid[ConstantArray[circledStar, {2, 2}]]}},
Frame -> All] ### Note

If what I did above to generate the star isn't clear to you, consider the following graphic.

Module[{thick, pentagonPts, innerPt, starPart},
thick = Scaled[.03];
pentagonPts = CirclePoints;
innerPt =
RegionIntersection[
Line[{pentagonPts[], pentagonPts[]}],
Line[{pentagonPts[], pentagonPts[]}]];
starPart = Line[{pentagonPts[], innerPt[[1, 1]], pentagonPts[]}];
Graphics[
{Thickness[thick], Red, starPart,
Text[Style["innerPt", 14, Black], innerPt[[1, 1]], {0, 2}],,
MapThread[Text[Style[#1, 20, Black], #2] &, {Range, pentagonPts}]}]] Here you see the five vertices of a pentagon labeled 1 through 5. In the code I found the intersection of the line from 1 to 3 with the line from 2 to 4. Then I constructed one fifth of the star from points 2 and 3 and innerPt, the found intersection.

In the main graphic. I took this set of tree points, rotated it trough 105 degrees about the origin, rotated the results trough 105 degrees again, and so on until I had five sets of three points. I deleted the duplicates and made a flat list of remaining points, which form the vertices of the star polygon in the main graphic.

• Thank you so much for your clear explanation. It was very good – Inzo Babaria Feb 28 '18 at 13:09
• @InzoBabaria. I'm glad you find my answer useful. Please consider accepting this answer or the other one, whichever you think best. You can do that by clicking on the check mark that appears on the left of an answer below the down arrow. – m_goldberg Feb 28 '18 at 15:46
• @m_goldberg: When I evaluate your code, the figure is created, but I get a N::meprec warning, originating in the RegionIntersection command in MMA 11.0.1. This can be avoided by putting N@ in front of CirclePoints. – JEM_Mosig Feb 28 '18 at 22:34
• @InzoBabaria. I'm using 11.2.1. CirclePoints returns coordinate in exact numbers for a pentagon, so there is problem with precision when passing points that it returns to R RegionIntersection. Did you somehow compute the pentagon vertices with machine floats? – m_goldberg Feb 28 '18 at 22:59

You can create the circle/star figure with

Graphics[
GraphicsComplex[
SortBy[
Join[
(* outer points of the star *)
CirclePoints,
(* inner points of the star *)
CirclePoints[{(* inner radius: *) 0.4, -\[Pi]/2}, 5]
],
(* sort points by angle *)
N[ArcTan@@#] &
],
{
(* enclosing circle *)
Directive[Thick, Red],
Circle[],
(* star *)
EdgeForm[Directive[Thick, Red]],
FaceForm[LightBlue],
Polygon[Range]
}
]
] You can adjust the thickness of the lines with, e.g., Thickness[.03] instead of Thick. If thick lines reach beyond the circle, you may increase its radius, e.g. by Circle[{0,0}, 1.1].

I am not sure what you mean by your second question, though.