# Plot a triangular grid inside of a hexagonal grid?

I have made the following grid:

With the following code:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes}

\begin{document}
\begin{tikzpicture}
[hexa/.style= {shape=regular polygon, regular polygon sides=6, minimum size=1cm, draw,anchor=south}, tria/.style= {shape=regular polygon, regular polygon sides=3, minimum size=.25cm, draw,anchor=center},circ/.style= {draw,circle,inner sep=2pt,fill}]

\foreach \j in {0,...,9}{%
\ifodd\j
\foreach \i in {0,...,9}{\node[hexa] (h\j;\i) at ({\j/2+\j/4},{(\i+1/2)*sin(60)}) {};}
\foreach \i in {0,...,9}{\node[tria] (h\j;\i) at ({\j/2+\j/4},{(\i+1)*sin(60)}) {};}
\else
\foreach \i in {0,...,9}{\node[hexa] (h\j;\i) at ({\j/2+\j/4},{\i*sin(60)}) {};}
\foreach \i in {0,...,9}{\node[tria] (h\j;\i) at ({\j/2+\j/4},{(\i+1/2)*sin(60)}) {};}
\fi}
\end{tikzpicture}
\end{document}


What I want to do is shrink the triangles a little, and plot a circle at each vertices of both the hexagons and the triangles.

But, here is the catch: Each odd and even row and column of nodes must be independent.

Basically, I should be able to add +1 to all odd columns, or odd rows, or even rows, or even columns. Also, the nodes connected to the triangles and the ones connected to the hexagons should be separate, existing on different "planes" so to speak.

How could this be achieved?

The reason for it is to construct a "projection" of an HCP lattice unto the x-y plane.

An HCP lattice looks like this:

And my graph can be thought of as the view from looking "downwards" towards the structure. The independence will allow me to transform the lattice graphically, explaining my mathematical transformations that turn this lattice into a simple cubic lattice.

• I'm a bit foggy about how this independence is supposed to work. Nor do I understand what you mean by +1. – A.Ellett Dec 17 '13 at 3:47
• Basically, if I can draw a straight horizontal or vertical line through the points, they are a single set, and should be anchored by a single coordinate that I can change the value of to move the whole set. If a point is part of multiple sets, then its position is defined by the sum of the coordinates. – NictraSavios Dec 18 '13 at 2:19

The shapes have various nodes defined. You can access those:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes}

\begin{document}
\begin{tikzpicture}
[
hexa/.style={shape=regular polygon,
regular polygon sides=6,
minimum size=1cm,
%draw,
anchor=south},
tria/.style={shape=regular polygon,
regular polygon sides=3,
minimum size=.25cm,
%%draw,
anchor=center},
circ/.style={draw,
circle,
inner sep=2pt,
fill}
]

\foreach \j in {0,...,9}{%
\ifodd\j
\foreach \i in {0,...,9}
{
\node[hexa] (h\j;\i) at ({\j/2+\j/4},{(\i+1/2)*sin(60)}) {};
\path
(h\j;\i.corner 1) node[circle,draw,inner sep=0.8pt] (t1) {}
(h\j;\i.corner 2) node[circle,draw,inner sep=0.8pt] (t2) {}
(h\j;\i.corner 3) node[circle,draw,inner sep=0.8pt] (t3) {}
(h\j;\i.corner 4) node[circle,draw,inner sep=0.8pt] (t4) {}
(h\j;\i.corner 5) node[circle,draw,inner sep=0.8pt] (t5) {}
(h\j;\i.corner 6) node[circle,draw,inner sep=0.8pt] (t6) {};
\draw (t1) -- (t2) -- (t3) -- (t4) -- (t5) -- (t6) -- (t1);
}
\foreach \i in {0,...,9}
{
\node[tria] (h\j;\i) at ({\j/2+\j/4},{(\i+1)*sin(60)}) {};
\path  (h\j;\i.corner 1) node[circle,draw,inner sep=0.8pt] (t1) {}
(h\j;\i.corner 2) node[circle,draw,inner sep=0.8pt] (t2) {}
(h\j;\i.corner 3) node[circle,draw,inner sep=0.8pt] (t3) {};
\draw (t1) -- (t2) -- (t3) -- (t1);
}
\else
\foreach \i in {0,...,9}
{
\node[hexa] (h\j;\i) at ({\j/2+\j/4},{\i*sin(60)}) {};
\path
(h\j;\i.corner 1) node[circle,draw,inner sep=0.8pt] (t1) {}
(h\j;\i.corner 2) node[circle,draw,inner sep=0.8pt] (t2) {}
(h\j;\i.corner 3) node[circle,draw,inner sep=0.8pt] (t3) {}
(h\j;\i.corner 4) node[circle,draw,inner sep=0.8pt] (t4) {}
(h\j;\i.corner 5) node[circle,draw,inner sep=0.8pt] (t5) {}
(h\j;\i.corner 6) node[circle,draw,inner sep=0.8pt] (t6) {};
\draw (t1) -- (t2) -- (t3) -- (t4) -- (t5) -- (t6) -- (t1);

}
\foreach \i in {0,...,9}
{
\node[tria] (h\j;\i) at ({\j/2+\j/4},{(\i+1/2)*sin(60)}) {};
\path  (h\j;\i.corner 1) node[circle,draw,inner sep=0.8pt] (t1) {}
(h\j;\i.corner 2) node[circle,draw,inner sep=0.8pt] (t2) {}
(h\j;\i.corner 3) node[circle,draw,inner sep=0.8pt] (t3) {};
\draw (t1) -- (t2) -- (t3) -- (t1);
}
\fi}
\end{tikzpicture}
\end{document}


There are two issues with my approach.

1. I'm having to create even more nodes for the circle. It seems there's got to be way around that.
2. I can't seem to write \draw (t1) -- (t2) -- (t3) -- cycle; and have it properly cycle.

NOTE

There seems to be an issue with my internet connection or a firewall preventing my image from properly getting imported. When I'm at a new computer, I'll try editing the image.

• Almost, but the rows and columns don't seem to be independently adjustable. – NictraSavios Dec 16 '13 at 23:21