3

I wish to draw the following tessellation.

\documentclass[10pt]{standalone}
\usepackage{pgf,tikz}
\begin{document}

\begin{tikzpicture}[scale=.6]%
\tikzset{scale=1.30341}
\newcommand\lizard[1]{%
\begin{scope}[#1]
  \filldraw (13.422918137345045,13.680978525125255)-- (13.659953556507825,13.846185029390224)-- (15.12526342042319,13.264370818717946)-- (15.391030405545093,11.777512280333239)-- (15.67116317364656,11.72004914841499)-- (16.579817341897726,12.425703855507482)-- (16.3646984930814,12.79140589849524)-- (15.84841325592221,12.866697495580956)-- (15.855161459468931,13.94010548381755)-- (16.668860668412805,13.917291487305105)-- (17.144152262422075,13.213859928171386)-- (17.752525502753944,12.552254029310484)-- (16.597341279799362,11.197766370466836)-- (17.410102311005424,10.35027196185881)-- (17.792169462427076,11.135246291143293)-- (18.792490731603767,11.934113971388562)-- (20.142686568606667,11.576169106938247)-- (21.087525279275397,11.588029007072164)-- (20.94915977771303,11.010847200554867)-- (20.81898250767505,10.852366908234124)-- (20.805528357695607,10.704371258460256)-- (20.676368517892957,10.51332232875217)-- (18.876203250643528,10.820076948283461)-- (18.59420516307783,9.915506925354336)-- (18.193025228305295,9.164206320234863)-- (18.6379702468712,8.427494076379846)-- (18.844666925808617,6.904818820144172)-- (17.95862112841492,5.901748106113575)-- (18.192670961688727,6.932681895533911)-- (17.624264223738052,8.141939367448574)-- (17.18402763258018,8.336980895176746)-- (16.208819993939315,7.963615684954246)
-- (15.634840640910692,8.147511982526522)-- (14.922287521677037,7.623232424645655)-- (15.261696345666758,7.3517053654538795)-- (15.60110516965648,7.088663526861846)-- (15.8,6.8)-- (15.818151045174377,6.433008174003308)-- (15.725830225603188,6.0054170096735975)-- (15.686958301573215,5.636133731388847)-- (14.91923780198123,5.947109123628637)-- (14.788045058380069,6.501034041055762)-- (14.,7.2)-- (13.952298691735633,7.71578166699244)-- (14.438197742110306,8.303719517945792)-- (14.783186067876324,8.85278544486917)-- (15.685514906635822,9.085791062307269)-- (14.299779078148498,9.369847714130154)-- (13.09445760960274,8.36413362254102)-- (12.771872470843727,8.600141859203525)-- (12.509763327084142,8.722053088859145)-- (12.2,9.)
-- (11.979449478082195,8.566616271048229)-- (11.537521270580571,8.551377367341278)-- (11.264191606843669,9.519220185870521)-- (11.468789386562122,9.912844780375393)-- (12.36318613741914,9.693238435298893)-- (12.930169791980285,9.473632090222395)-- (14.171943852321949,10.300150516237583)-- (14.116876121116597,10.778510755204247)-- (12.907128162651231,11.952908935662506)-- (13.422918137345045,13.680978525125255);

\end{scope}
}

\lizard{shift={(0,0)}, fill=white};
\lizard{shift={(8,0)}, fill=cyan};
\lizard{shift={(16,0)}, fill=white};
\lizard{shift={(24,0)}, fill=cyan};
\end{tikzpicture}
\end{document}
5

Are you just looking for the rotate around={<angle>:<coordinate>} syntax?

\documentclass[10pt]{standalone}
\usepackage{pgf,tikz}
\begin{document}
\begin{tikzpicture}[scale=.6]%
\tikzset{scale=1.30341}
\newcommand\lizard[1]{%
\begin{scope}[#1]
  \filldraw (13.422918137345045,13.680978525125255)-- (13.659953556507825,13.846185029390224)-- (15.12526342042319,13.264370818717946)-- (15.391030405545093,11.777512280333239)-- (15.67116317364656,11.72004914841499)-- (16.579817341897726,12.425703855507482)-- (16.3646984930814,12.79140589849524)-- (15.84841325592221,12.866697495580956)-- (15.855161459468931,13.94010548381755)-- (16.668860668412805,13.917291487305105)-- (17.144152262422075,13.213859928171386)-- (17.752525502753944,12.552254029310484)-- (16.597341279799362,11.197766370466836)-- (17.410102311005424,10.35027196185881)-- (17.792169462427076,11.135246291143293)-- (18.792490731603767,11.934113971388562)-- (20.142686568606667,11.576169106938247)-- (21.087525279275397,11.588029007072164) -- (20.94915977771303,11.010847200554867)-- (20.81898250767505,10.852366908234124)-- (20.805528357695607,10.704371258460256)-- (20.676368517892957,10.51332232875217)-- (18.876203250643528,10.820076948283461)-- (18.59420516307783,9.915506925354336)-- (18.193025228305295,9.164206320234863)-- (18.6379702468712,8.427494076379846)-- (18.844666925808617,6.904818820144172)-- (17.95862112841492,5.901748106113575)-- (18.192670961688727,6.932681895533911)-- (17.624264223738052,8.141939367448574)-- (17.18402763258018,8.336980895176746)-- (16.208819993939315,7.963615684954246)
-- (15.634840640910692,8.147511982526522)-- (14.922287521677037,7.623232424645655)-- (15.261696345666758,7.3517053654538795)-- (15.60110516965648,7.088663526861846)-- (15.8,6.8)-- (15.818151045174377,6.433008174003308)-- (15.725830225603188,6.0054170096735975)-- (15.686958301573215,5.636133731388847)-- (14.91923780198123,5.947109123628637)-- (14.788045058380069,6.501034041055762)-- (14.,7.2) -- (13.952298691735633,7.71578166699244)-- (14.438197742110306,8.303719517945792)-- (14.783186067876324,8.85278544486917)-- (15.685514906635822,9.085791062307269)-- (14.299779078148498,9.369847714130154)-- (13.09445760960274,8.36413362254102)-- (12.771872470843727,8.600141859203525)-- (12.509763327084142,8.722053088859145)-- (12.2,9.)
-- (11.979449478082195,8.566616271048229)-- (11.537521270580571,8.551377367341278)-- (11.264191606843669,9.519220185870521)-- (11.468789386562122,9.912844780375393)-- (12.36318613741914,9.693238435298893)-- (12.930169791980285,9.473632090222395)-- (14.171943852321949,10.300150516237583)-- (14.116876121116597,10.778510755204247)-- (12.907128162651231,11.952908935662506) -- (13.422918137345045,13.680978525125255);

\end{scope}
}

\lizard{fill=yellow};
\lizard{rotate around={120:(12.907128162651231,11.952908935662506)}, fill=cyan};
\lizard{rotate around={-120:(12.907128162651231,11.952908935662506)}, fill=violet};
\lizard{shift={(30:10.3)}, rotate around={-120:(12.907128162651231,11.952908935662506)}, fill=violet};
\end{tikzpicture}
\end{document}

You could do the shift and rotation programatically using a \foreach to tessellate a larger area.

Also, your shape doesn't seem to tessellate exactly. Are you looking for a way to fix that, too?

EDIT: Advice for fixing the shape so that it tessellates.

To fix the shape you need a) the corners where three lizards meet to make a hexagonal lattice (probably a regular one) and b) the path segments which are supposed to fit together to actually be the same shape.

You can achieve (a) by calculating the corners' positions relative to each other. Your path seems to be close to a regular hexagon with side length 3.35, so I've just corrected the corner points to be exactly that.

Achieving (b) is trickier. You have two different versions of each path, so I've just picked one to use on both sides. Getting "the same shape" for the two interlocking sides of the hexagon requires a rotation, but since you can specify a rotate around scope for only part of a path that's not too hard to achieve. The tricky thing is that in order to go around the hexagon you need to traverse each section once forwards and then again rotated and backwards. There's probably a better way to do this than what I've done, which is just to copy the section of the path and reverse the order of the coordinates (see this post for a possible better solution).

My final (but rather sloppy) solution is as follows:

\documentclass[10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\newcommand{\patha}{
  (20.14268656860666,11.576169106938247)--
  (21.087525279275397,11.588029007072164)--
  (20.94915977771303,11.010847200554867)--
  (20.81898250767505,10.852366908234124)--
  (20.805528357695607,10.704371258460256)--
  (20.676368517892957,10.51332232875217)--
  (18.876203250643528,10.820076948283461)--
  (18.59420516307783,9.915506925354336)--
  (18.193025228305295,9.164206320234863)
  }
\newcommand{\patharev}{
  (18.193025228305295,9.164206320234863)--
  (18.59420516307783,9.915506925354336)--
  (18.876203250643528,10.820076948283461)--
  (20.676368517892957,10.51332232875217)--
  (20.805528357695607,10.704371258460256)--
  (20.81898250767505,10.852366908234124)--
  (20.94915977771303,11.010847200554867)--
  (21.087525279275397,11.588029007072164)--
  (20.14268656860666,11.576169106938247)
}
\newcommand{\pathb}{
  (18.844666925808617,6.904818820144172)--
  (17.95862112841492,5.901748106113575)--
  (18.192670961688727,6.932681895533911)--
  (17.624264223738052,8.141939367448574)--
  (17.18402763258018,8.336980895176746) --
  (16.208819993939315,7.963615684954246)--
  (15.634840640910692,8.147511982526522)--
  (14.922287521677037,7.623232424645655)--
  (15.261696345666758,7.3517053654538795)--
  (15.60110516965648,7.088663526861846)
}
\newcommand{\pathbrev}{
  (15.60110516965648,7.088663526861846)--
  (15.261696345666758,7.3517053654538795)--
  (14.922287521677037,7.623232424645655)--
  (15.634840640910692,8.147511982526522)--
  (16.208819993939315,7.963615684954246)--
  (17.18402763258018,8.336980895176746) --
  (17.624264223738052,8.141939367448574)--
  (18.192670961688727,6.932681895533911)--
  (17.95862112841492,5.901748106113575)--
  (18.844666925808617,6.904818820144172)
}
\newcommand{\pathc}{
  (12.771872470843727,8.600141859203525)--
  (12.509763327084142,8.722053088859145)--
  (12.2,9.)--
  (11.979449478082195,8.566616271048229)--
  (11.537521270580571,8.551377367341278)--
  (11.264191606843669,9.519220185870521) --
  (11.468789386562122,9.912844780375393)--
  (12.36318613741914,9.693238435298893)--
  (12.930169791980285,9.473632090222395)--
  (14.171943852321949,10.300150516237583)--
  (14.116876121116597,10.778510755204247)
}
\newcommand{\pathcrev}{
  (14.116876121116597,10.778510755204247) --
  (14.171943852321949,10.300150516237583)--
  (12.930169791980285,9.473632090222395)--
  (12.36318613741914,9.693238435298893)--
  (11.468789386562122,9.912844780375393)--
  (11.264191606843669,9.519220185870521) --
  (11.537521270580571,8.551377367341278)--
  (11.979449478082195,8.566616271048229)--
  (12.2,9.)--
  (12.509763327084142,8.722053088859145)--
  (12.771872470843727,8.600141859203525)
}
\newcommand\lizard[1]{%
\begin{scope}[#1, thick]
  \filldraw (18.7,11.93) coordinate (b) -- \patha --
  ($(b)+(-90:3.35)$) coordinate (c) -- \pathb --
  ($(c) + (-150:3.35)$) coordinate (d) {[rotate around={120:(d)}] -- \pathbrev} --
  ($(d)+(150:3.35)$) coordinate (e) -- \pathc --
  ($(e)+(90:3.35)$) coordinate (f) {[rotate around={120:(f)}] -- \pathcrev} --
  ($(f)+(30:3.35)$) coordinate (a) {[rotate around={-120:(18.7,11.93)}] -- \patharev} --cycle;
\end{scope}
}

\lizard{fill=yellow};
\lizard{rotate around={120:(f)}, fill=cyan};
\lizard{rotate around={-120:(f)}, fill=violet};
\lizard{rotate around={-120:(f)}, shift={(150:10.05)}, fill=red};
\end{tikzpicture}
\end{document}

Note that the macros \patha, \patharev, etc. are rather superfluous, but I have kept them named to make it clearer what's going on in drawing the tessellation.

Probably if you were doing this from scratch rather than from a traced picture you'd want to position the shape on the coordinate system so that one of the corners is (0,0), but fixing this now requires a lot of arithmetic (which you might be able to automate).

  • Yes, it still leave gaps in between. Calculating the better shape is too hard for me. – Thumbolt Nov 3 '16 at 4:25
  • @Thumbolt: I have added some advice for fixing the shape as well. – Emma Nov 3 '16 at 15:53
4

Not quite, but sort of:

\documentclass[tikz,border=5]{standalone}
\tikzset{pics/.cd, lizard/.style={code={
\path [every lizard/.try, #1]
 (  0, 20) -- ( 10, 27) -- ( 14, 27) -- ( 15, 20) --
 (  7, 11) -- ( 10, 10) -- ( 14, 10) -- ( 16, 13) -- ( 15, 15) -- ( 22, 22) --
 ( 24, 19) -- ( 20, 11) -- ( 20,  7) -- ( 15,  5) -- (  8,  3) -- (  5, -5) --
 ( 12, -1) -- ( 15,  0) -- ( 20,  0) -- ( 20, -5) -- ( 21, -7) -- ( 25,-10) --
 ( 17,-15) -- ( 15,-10) -- ( 13, -7) -- (  9,-11) -- (  1,-16) -- ( -2,-20) --
 ( -9,-28) -- (-18,-33) -- ( -7,-20) -- ( -7,-15) -- (-12,-15) -- (-13,-12) --
 (-18,-12) -- (-20,-20) -- (-28,-26) -- (-28,-21) -- (-25,-17) -- (-25,-12) --
 (-20, -7) -- ( -7, -5) -- (-12, -1) -- (-20, -2) -- (-20,  5) -- (-23,  4) --
 (-24,  6)  --(-20, 10) -- (-16, 13) -- (-15,  5) -- ( -7,  6) -- ( -3, 10) --
 cycle;
}}}
\begin{document}
\begin{tikzpicture}[x=(330:5pt),y=(90:5pt)]
\pic at (  0,  0) {lizard={fill=red}};
\pic at (-20, 20) {lizard={fill=yellow, rotate=240}};
\pic at ( 20, 40) {lizard={fill=pink,   rotate=120}};
\pic at ( 40, 20) {lizard={fill=green,  rotate=240}};
\pic at ( 20,-20) {lizard={fill=orange, rotate=120}};
\pic at (-20,-40) {lizard={fill=purple, rotate=240}};
\pic at (-40,-20) {lizard={fill=blue,   rotate=120}};
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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