[Tex/LaTex] Regular Polygon with tip on the bottom

rotatingtikz-pgf

I have a set of three regular polygons with six sides which I create using regular polygon from the shapes tikz package. However this always creates the polygon with the flat side on the bottom. How do I get one of the corners on the bottom with minimal changes to my code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}
\def\x{0}
\def\y{0}
\def\r{1.5}
\pgfmathsetmacro\dx{\r*(1+cos(60))}
\pgfmathsetmacro\dy{\r*sin(60)}
\pgfmathsetmacro\dAx{\r*cos(60)}
\pgfmathsetmacro\dAy{\r*sin(60)}
\pgfmathsetmacro\dBx{\r*cos(120)}
\pgfmathsetmacro\dBy{\r*sin(120)}
\pgfmathsetmacro\d{2*\r}

\def\xc{\x} %mittelpunkt des aktuellen hexagons
\def\yc{\y}
\node[draw, regular polygon, regular polygon sides=6,minimum size=\d cm]
at (\x,\y) {};
\node[circle, radius=0.15cm, label=A, fill=black] (A) at (\xc+\dAx,    
\yc+\dAy) {};
\node[circle, radius=0.15cm, label=below:A, fill=black] (AA) at     
(\xc+\dAx,\yc-\dAy) {};
\node[circle, radius=0.15cm, label=A, fill=black] at (\xc-\r,\yc) {};
\node[circle, radius=0.15cm, label=B, fill=gray] at (\xc+\dBx,\yc+\dBy) {};
\node[circle, radius=0.15cm, label=below:B, fill=gray] at (\xc+\dBx,    \yc-\dBy) {};

\def\xc{\x+\dx}
\def\yc{\y+\dy}
\node[draw, regular polygon, regular polygon sides=6,minimum size=\d cm]
at (\x+\dx,\y+\dy) {};
\node[circle, radius=0.15cm, label=A, fill=black] (AAA) at (\xc+\dAx,\yc+\dAy) {};
\node[circle, radius=0.15cm, label=right:A, fill=black] (AAAA) at (\xc+\dAx,\yc-\dAy) {};
\node[circle, radius=0.15cm, label=right:B, fill=gray] (BB) at (\xc+\r,\yc) {};
\node[circle, radius=0.15cm, label=B, fill=gray] at (\xc+\dBx,\yc+\dBy) {};

\def\xc{\x+\dx}
\def\yc{\y-\dy}
\node[draw, regular polygon, regular polygon sides=6,minimum size=\d cm]
at (\x+\dx,\y-\dy) {};
\node[circle, radius=0.15cm, label=below:A, fill=black] at (\xc+\dAx,\yc-\dAy) {};
\node[circle, radius=0.15cm, label=right:B, fill=gray] (BBB)at (\xc+\r,\yc) {};
\node[circle, radius=0.15cm, label=B, fill=gray] (B) at (\xc+\dBx,\yc+\dBy) {};
\node[circle, radius=0.15cm, label=below:B, fill=gray] (BBBB)at (\xc+\dBx,\yc-\dBy) {};
\end{tikzpicture}
\end{document}

Latex output

Best Answer

shape border rotate is the parameter that you can use to rotate a shape node. But in this case, you also need to change where labels are placed.

Unfortunately this answer will change all your code. It uses hexagon corners as reference points and also as anchors to place them one over the other. Hope it helps.

First example is not rotated and second one has a 30 degree rotation.

\documentclass[border=2mm,tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}[%
    point/.style={circle, radius=0.15cm, fill=#1},    
    hex/.style={draw, regular polygon, regular polygon sides=6,minimum size=3 cm}]

\node[hex] (A) {};
\node[hex, anchor=corner 4] (B) at (A.corner 2) {};
\node[hex, anchor=corner 6] (C) at (A.corner 2) {};

\foreach \i/\j/\k in {
    B/1/above, B/3/above, B/5/right,
    C/3/above, C/5/below, A/5/below}
    \node[point=black, label=\k:A] at (\i.corner \j) {};

\foreach \i/\j/\k in {
    B/2/above, B/4/above, B/6/right,
    C/2/above, C/4/below, A/4/below, A/6/right}
    \node[point=gray, label=\k:B] at (\i.corner \j) {};

\end{tikzpicture}

\begin{tikzpicture}[%
    point/.style={circle, radius=0.15cm, fill=#1},    
    hex/.style={draw, regular polygon, regular polygon sides=6,minimum size=3 cm, shape border rotate=30}]

\node[hex] (A) {};
\node[hex, anchor=corner 4] (B) at (A.corner 2) {};
\node[hex, anchor=corner 6] (C) at (A.corner 2) {};

\foreach \i/\j/\k in {
    B/1/above, B/3/left, B/5/right,
    C/3/below, C/5/below, A/5/below}
    \node[point=black, label=\k:A] at (\i.corner \j) {};

\foreach \i/\j/\k in {
    B/2/above, B/4/above, B/6/right,
    C/2/above, C/4/below, A/4/below, A/6/right}
    \node[point=gray, label=\k:B] at (\i.corner \j) {};

\end{tikzpicture}

\end{document}

enter image description here