Last active
December 30, 2015 06:29
-
-
Save surt91/7790122 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{standalone} | |
\usepackage{tikz} | |
\begin{document} | |
\begin{tikzpicture} | |
\newcommand*{\shear}{0.2} | |
\newcommand*{\height}{1.0} | |
\newcommand*{\radius}{0.1} | |
\newcommand*{\xspacing}{1} | |
\newcommand*{\yspacing}{0.5} | |
% two-dimensional lattice, with three dimensional basis | |
% decreasing counter, otherwise there will be lines through the circles | |
\foreach \x in {4,...,0}{ | |
\foreach \y/\dx in {3,...,0}{ | |
% primitive vectors | |
\draw (\x+\y*\shear-\xspacing/2 , \y*\yspacing ) | |
-- (\x+\y*\shear+\xspacing/2, \y*\yspacing ); | |
\draw (\x+\y*\shear-\shear/2 , \y*\yspacing-\yspacing/2) | |
-- (\x+\y*\shear+\shear/2 , \y*\yspacing+\yspacing/2); | |
\draw (\x+\y*\shear , \y*\yspacing ) | |
-- (\x+\y*\shear , \y*\yspacing+\height ); | |
% base | |
\fill[white] (\x+\y*\shear, \y*\yspacing ) circle(\radius); | |
\draw (\x+\y*\shear, \y*\yspacing ) circle(\radius); | |
\fill[gray] (\x+\y*\shear, \y*\yspacing+\height) circle(\radius); | |
\draw (\x+\y*\shear, \y*\yspacing+\height) circle(\radius); | |
} | |
} | |
\end{tikzpicture} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment