8

I would like to put 1cm isometric dot paper into an exercise of the exam for my class, so my students can draw on. My apologies for no MWE. I haven't got a clue where to start. See image

enter image description here

TobiBS
  • 5,240
Jon
  • 525
  • 1
  • 3
  • 11
  • When you say 1cm, is that the vertical or horizontal difference between two dots? Or is 1cm the vertical distance as well as the distance to the above left and above right dot? – TobiBS Aug 22 '20 at 16:30
  • In isometry, the dot distances (let's call it the unit vectors) along the 30 deg lines and the vertical lines are the same. I guess it is this distance OP wants to be 1 cm. – AlexG Aug 22 '20 at 16:35
  • Does this answer your question? creating a dotted paper pdf Related enough to get you started but not isometric dots. – Alan Munn Aug 22 '20 at 16:36

5 Answers5

9

Isometric dots can easily be created by modifying the x and y coordinates and then putting dots on a grid. However we would need to clip the result, because we basically rotated the coordinate system. The scale has to be adopted to your liking, as I asked how the 1cm shall be defined and now used the assumption of @AlexG.

\documentclass[tikz]{standalone}

\begin{document} \begin{tikzpicture}[x={(0.86cm,0.5cm)},y={(-0.86cm,0.5cm)}] \clip (0,12.5) rectangle (25,12.5); \foreach \x in {0,...,25} \foreach \y in {0,...,25} { \fill (\x,\y) circle (2pt); } \end{tikzpicture} \end{document}

enter image description here

Edit after the comments of Jon

I took some measurements with Adobe Acrobat in the PDF created from the code above and this is the result: enter image description here

So which measurement needs to be 1cm, if you take this image as a reference? enter image description here

The isometric A4-paper

\documentclass[tikz,border={0.23cm 0.25cm}]{standalone}

\begin{document} \begin{tikzpicture}[x={(0.86cm,0.5cm)},y={(-0.86cm,0.5cm)}] \clip (0,25.5) rectangle (37.5,29); \foreach \x in {0,...,50} \foreach \y in {0,...,50} { \fill (\x,\y) circle (2pt); } \end{tikzpicture} \end{document}

TobiBS
  • 5,240
  • I wanted 1 cm going across and down, also how did you know to use those particular coordinates (0.86cm. 05cm)? – Jon Aug 23 '20 at 13:19
  • 1
    @Jon This is due to trigonometry: sin(60°) = 0.866 and cos(60°) = 0.5. – AJF Aug 23 '20 at 14:07
  • @Jon AJ explained it already, it is based on the isometric projection. I have seen you tried to edit my answer instead of adding a comment, I will follow up on that later. Basically to not cut between dots, use a coordinate that doesn‘t cut through, so x.5 helps. – TobiBS Aug 23 '20 at 14:50
  • TobiBS, I only understood your answer when I removed the clip I got a "rhombus" with the corners at (0,0), (0,25), (25,25), (25,0), then I \clip (0,16.5) rectangle (25,8.5); this gave me the top 10 cm for the top of my page, which I wanted, but when I print the whole page I do get isometric paper but 2 cm in length going across and down.I will wait for your follow up and then vote as solved for me – Jon Aug 24 '20 at 14:16
  • @Jon Exactly, this is what you would do, basically the new definitions for x and y are defining a new coordinate system which is defined by new vectors. However I still don't get which measurement you want to be 1cm. Please see my edit of the answer, it shows an actual measurement from Adobe Acrobat. So which measurement do you want to change? Please indicate red, green or blue as in my second additional image. – TobiBS Aug 24 '20 at 16:40
  • TobiBS, your dimensions are exactly the same as the Isometric Dot Paper 1 cm from Printerest, which is what I require. When I print using your code the red line is 13 mm dots apart the blue is 23 mm, and the green is also 13 mm dots apart, and its in landscape not portrait, not sure it that means anything. I am using Windows 8.1, Texstudio and Adobe DC, for printing. – Jon Aug 25 '20 at 11:10
  • @Jon it seems you let Adobe or your printer scale the printout. So as long as you use the standalone package, the page size will be arbitrary. Use the setting none, as in this screenshot: https://www.cadzation.com/help/acroplot/drex_pro_troubleshooting_printingfromadobe2_custom.png or read the complete article: https://www.cadzation.com/help/acroplot/pro_troubleshooting_printingfromadobe2.htm Alternatively I can change my solution to be printed on A4 paper if you want. – TobiBS Aug 25 '20 at 11:24
  • You are a genius, first I printed the compiled file using SumatraPDF and it printed correctly, but in landscape, then I used Adobe DC using your suggestion it is"actual size" in Adobe DC, and it printed correctly, Can you change your solution to A4? I have learnt so much from this question. – Jon Aug 25 '20 at 12:58
  • @Jon No I'm not, but I made the same mistakes a long time ago. ;-) I added another section of code to produce a page which is 29.7cm x 21cm, be aware however that you still need to select "actual size", otherwise most printers reduce the size to the printable area. – TobiBS Aug 25 '20 at 15:00
  • @Jon A4?, see below ;-) – AlexG Aug 25 '20 at 16:05
9

Update 2: new coordinate system defined with pgfkeys

Coordinates are given in the same style as the native implicit coordinates of tikz, i.e. 3 numbers separated by commas. They are prefixed by iso cs: as for example: (iso cs:0,1,7)

screenshot

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{arrows.meta}

\pgfkeys{/isometrique/.cd, coordonnee/.code args={#1,#2,#3} { \def\myx{#1} \def\myy{#2} \def\myz{#3} } }

\tikzdeclarecoordinatesystem{isometric} { \pgfkeys{/isometrique/.cd, coordonnee={#1}} \pgfpointadd{\pgfpointxyz{0}{\myz}{0}}{\pgfpointadd{\pgfpointpolarxy{-30}{\myx}}{\pgfpointpolarxy{30}{\myy}}} } \tikzaliascoordinatesystem{iso}{isometric}

\begin{document} \begin{tikzpicture}[>={Triangle[angle=45:4pt 3]}]

\newcommand{\nbx}{11}%<--number of point on one row \newcommand{\nby}{9}%<-- number of point on one column

\foreach \j in {0,...,\the\numexpr\nby-1} { \foreach \i in {0,...,\the\numexpr\nbx-1} {\fillblack++(0:{2\icos(30)})circle[radius=1pt]+(30:1)circle[radius=1pt]; }}

\drawvery thick,red,->--node[sloped,below]{$y=6$}(iso cs:0,4,0); \draw[very thick,blue,->](iso cs:0,4,0)-- node[sloped,above]{$x=2$}++(iso cs:2,0,0); \draw[very thick,red,->](iso cs:2,4,0)-- node[sloped,below]{$z=3$}++(iso cs:0,0,3);

% Arrows showing the newest coordinate system "iso" \draw blue,thick,->--node[below]{x}++(iso cs:1,0,0); \draw red,thick,->--node[left]{y}++(iso cs:0,1,0); \draw violet,thick,->--node[left]{z}++(iso cs:0,0,1); \node[below,align=center,draw,fill=white] at (iso cs:0,1,2.7){New \textbf{iso} \ coordinate system};

\begin{scope}[shift={(iso cs:2,4,3)}] \draw[blue,thick] (iso cs:0,0,0)--++ (iso cs:3,0,0) --++ (iso cs:0,3,0) --++ (iso cs:0,0,3) --++ (iso cs:-3,0,0) --++ (iso cs:0,-3,0) --++(iso cs:0,0,-3) (0,3)--++(iso cs:3,0,0)--+(0,-3) (iso cs:0,3,0)--+(iso cs:0,3,0); \end{scope} \end{tikzpicture} \end{document}

Update Addition of another coordinate system with a vertical key z (at Tobi's request)

Its disadvantage is to be more verbose since you have to write 3 coordinates instead of 2.

With keyvals since here the keys are defined with keyval package, we can define default values and write for example (trio cs:x,y=2,z) instead of (trio cs:x=0,y=2,z=0). Here, the keys have default values, that is to say that if no value is given, they are worth the default value.

screenshot

\documentclass[tikz,border=5mm]{standalone}

%\usepackage{tikz} \usetikzlibrary{arrows.meta}

\makeatletter \define@key{triangularokeys}{x}[0]{\def\myx{#1}} \define@key{triangularokeys}{y}[0]{\def\myy{#1}} \define@key{triangularokeys}{z}[0]{\def\myz{#1}} \tikzdeclarecoordinatesystem{triangularo}% {% \setkeys{triangularokeys}{#1}% \pgfpointadd{\pgfpointxyz{0}{\myz}{0}}{\pgfpointadd{\pgfpointpolarxy{-30}{\myx}}{\pgfpointpolarxy{30}{\myy}} } } \makeatother \tikzaliascoordinatesystem{trio}{triangularo} \begin{document}

\begin{tikzpicture}[>={Stealth[]}]

\newcommand{\nbx}{11}%<--number of point on one row \newcommand{\nby}{9}%<-- number of point on one column

\foreach \j in {0,...,\the\numexpr\nby-1} { \foreach \i in {0,...,\the\numexpr\nbx-1} {\fillblack++(0:{2\icos(30)})circle[radius=1pt]+(30:1)circle[radius=1pt]; }}

\drawvery thick,red,->--node[sloped,below]{$y=6$}(trio cs:x=0,y=4,z=0); \draw[very thick,red,->](trio cs:x,y=4,z)-- node[sloped,above]{$x=2$}++(trio cs:x=2,y,z); \draw[very thick,red,->](trio cs:x=2,y=4,z)-- node[sloped,below]{$z=3$}++(trio cs:x,y,z=3);

% Arrows showing the newest coordinate system "trio" \draw blue,thick,->--node[below]{x}++(trio cs:x=1,y,z); \draw red,thick,->--node[left]{y}++(trio cs:x,y=1,z); \draw violet,thick,->--node[left]{z}++(trio cs:x,y,z=1); \node[below,align=center] at (trio cs:x,y=1,z=3){New trio \ coordinate system};

\begin{scope}[shift={(trio cs:x=2,y=4,z=3)}] \draw[blue,thick] (trio cs:x,y,z)--++ (trio cs:x=3,y,z) --++ (trio cs:x,y=3,z) --++ (trio cs:x,y,z=3) --++ (trio cs:x=-3,y,z) --++ (trio cs:x,y=-3,z) --++(trio cs:x,y,z=-3) (0,3)--++(trio cs:x=3,y,z)--+(0,-3) (trio cs:x,y=3,z)--+(trio cs:x,y=3,z); \end{scope} \end{tikzpicture}

\end{document}

First answer With a coordinate system called tri with the x and y keys.

screenshot

In addition to the Cartesian coordinates, I have defined a new coordinate system that makes it "simpler" to draw figures on this grid. It is called triangular and its alias is tri.

For example, the first red arrow is drawn like this:

\draw[very thick,red,->](0,0)--(tri cs:x=0,y=7);

The second arrow is defined as follows:

\draw[very thick,red,->](tri cs:x=0,y=7)--++(tri cs:x=2,y=0);

You'll notice that you can mix the two coordinate systems in the same path and use the relative coordinate.

Code

\documentclass[tikz,border=5mm]{standalone}

%\usepackage{tikz} \usetikzlibrary{arrows.meta}

% new coordinate system called triangular \makeatletter \define@key{triangularkeys}{x}{\def\myx{#1}} \define@key{triangularkeys}{y}{\def\myy{#1}} \tikzdeclarecoordinatesystem{triangular}% {% \setkeys{triangularkeys}{#1}% \pgfpointadd{\pgfpointpolarxy{-30}{\myx}}{\pgfpointpolarxy{30}{\myy}} } \makeatother % end of new coordinate system

\tikzaliascoordinatesystem{tri}{triangular}%<-- define the alias tri for triangular

\begin{document}

\begin{tikzpicture}[>={Stealth[]}]

\newcommand{\nbx}{11}%<--number of dots in a single row \newcommand{\nby}{9}%<-- number of dots in a single column

% Drawing of the isometric grid \foreach \j in {0,...,\the\numexpr\nby-1} { \foreach \i in {0,...,\the\numexpr\nbx-1} {\fillblack++(0:{2\icos(30)})circle[radius=1pt]+(30:1)circle[radius=1pt]; }}

% The following code below shows how to draw on this grid

% Arrows showing the new coordinate system \draw blue,thick,->--node[below]{x}++(tri cs:x=1,y=0); \draw red,thick,->--node[left]{y}++(tri cs:x=0,y=1);

% Big red arrow going from the bottom left to the perspective cube \drawvery thick,red,->--node[sloped,below]{$y=7$}(tri cs:x=0,y=7); \draw[very thick,red,->](tri cs:x=0,y=7)-- node[sloped,above]{$x=2$}++(tri cs:x=2,y=0);

% Cube perspective drawing \begin{scope}[shift={(tri cs:x=2,y=7)}] \draw (tri cs:x=0,y=0)circle(3pt)--++ (tri cs:x=3,y=0) --++ (tri cs:x=0,y=3) --++ (0,3) --++ (tri cs:x=-3,y=0) --++ (tri cs:x=0,y=-3) --++(0,-3) (0,3)--++(tri cs:x=3,y=0)--+(0,-3) (tri cs:x=0,y=3)--+(tri cs:x=0,y=3); \end{scope}

\end{tikzpicture}

\end{document}

AndréC
  • 24,137
  • That’s a nice solution, but shouldn’t there be also a z key?! – Tobi Aug 23 '20 at 08:29
  • Why not, but I'm not sure what use would be made of it? What's your idea about that? – AndréC Aug 23 '20 at 09:15
  • 1
    It could be used for al lines that go straight upwards. As the isometric view is a projection of 3D in 2D all three axis should be available. I’d say … – Tobi Aug 23 '20 at 10:06
  • @Tobi I just finished it, but its disadvantage is that it is more verbose since you now have to write 3 coordinates instead of 2. – AndréC Aug 23 '20 at 12:06
  • Thanks! Is it possible to have the z part optional? I don’t know the coordinate system of TikZ well enough. – Tobi Aug 23 '20 at 20:36
  • @Tobi I'm asking myself the same question as you and I'm trying to do it. With keyvals since here the keys are defined with keyvalpackage, we can define default values and write for example (trio cs:x,y=2,z) instead of (trio cs:x=0,y=2,z=0). Here, the keys have default values, that is to say that if no value is given, they are worth the default value. I already add this to the solution. – AndréC Aug 23 '20 at 20:50
  • @Tobi It would be more interesting to give an initial value to the keys in order to write (trio cs:y=2) x and z being then equal to 0. But here, you have to use the pgfkeys package and it is hard to understand. I dive into it and do my best. But I don't guarantee anything. – AndréC Aug 23 '20 at 20:52
  • Don’t invest too much time. It was just a thought. Better wait what the OP says ;-) – Tobi Aug 23 '20 at 21:15
  • @Tobi That's it, I did it! Phew! – AndréC Aug 24 '20 at 20:04
  • Well done. Good job! Maybe this should became part of TikZ ;-) – Tobi Aug 24 '20 at 21:54
  • Hi, why did you disappear? A cordial greeting from Sicily. – Sebastiano Feb 01 '21 at 21:49
  • @Sebastiano Thank you for your concern, I have a lot of work at the moment and I don't have time to invest in the forum. I hope you are well. :-) – AndréC Mar 30 '21 at 04:30
  • @AndréC With extreme sincerity I always think of you even as a professor. Right now I'm crying...but it will pass...I always wish you the best and serenity for you and the people you love. – Sebastiano Mar 30 '21 at 12:05
  • 1
    @Sebastiano I am sorry that you are grieving. I hope that you will get through this ordeal, whatever it is. – AndréC Apr 05 '21 at 20:13
  • @AndréC I thank you and always wish you every well for all your future days. – Sebastiano Apr 05 '21 at 20:16
9

Just for fun, a pure PostScript solution for making 1-cm-scale isometric dotted paper. Can be directly sent to a PostScript printer.

Use ps2pdf if you need a PDF; but it is much bigger [38 kB] than the PS [242 B]. (The PS code was somewhat optimized for size, though not too aggressively in order not to sacrifice legibility.)

isometricdottedA4.ps:

%! 
<</PageSize [595 842]>> setpagedevice 
/cm {28.346457 mul} def 
[.866 .5 -.866 .5 595 2 div 842 41 cm sub 2 div] concat 
0 1 41 { cm 
 0 1 41 { cm 1 index exch moveto 
  gsave initmatrix currentpoint 2 0 360 arc fill grestore 
 } for pop 
} for 

The following version can be used for both, A4 and Letter, formats. Just replace false with true in the 2nd line for Letter paper. Dots still spaced by 1 cm.

isometricdottedA4orLetter.ps:

%! 
/letter false def % replace with `true' for Letter paper 
letter {/width 612 def /height 792 def} {/width 595 def /height 842 def} ifelse 
<</PageSize [width height]>> setpagedevice 
/cm2bp {28.346457 mul} def % conversion 
/dots height width 60 sin 60 cos div div add 1 cm2bp div cvi def % # dots filled rhombus height [cm] 
[30 cos 30 sin 60 sin neg 60 cos width 2 div height dots cm2bp sub 2 div] concat % axes rotated (30°, 60°) & translated 
0 1 dots { cm2bp 
  0 1 dots { cm2bp 1 index exch moveto 
    gsave initmatrix currentpoint 2 0 360 arc fill grestore 
  } for pop 
} for

enter image description here

AlexG
  • 54,894
  • +1 It's interesting, but how do you actually print a postscript file from, say, a Windows 10 computer? – AndréC Aug 23 '20 at 09:17
  • No idea, I can only speak for Linux where printing is centred around the PS format: lpr isometricdottedA4.ps (Of course, the default printer must be a PS printer. But most Laser printers in office environments, e. g. HP LaserJets, are.) – AlexG Aug 23 '20 at 09:24
  • 1
    @AndréC : Found this on the web: COPY file.ps \\servername\printername. Seems to be the way to print a PS file on a PS network printer on Windows, at the DOS prompt. – AlexG Aug 23 '20 at 09:43
2

A PSTricks solution only for either fun or comparison purposes.

\documentclass[pstricks,border=12pt]{standalone}
\begin{document}
\begin{pspicture}(10,10)
    \multips(0,0)(0,1){11}{%
        \multips(0,0)(1,0){11}{%
            \qdisk(0,0){2pt}\qdisk(.5,.5){2pt}}}
\end{pspicture}
\end{document}

enter image description here

Display Name
  • 46,933
2

Like this? I see here.

\documentclass[border=3.14mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{3d,perspective}
%https://tex.stackexchange.com/questions/690566/how-to-create-a-mapping-like-the-following-figure/690569#690569
\begin{document}
\begin{tikzpicture}[isometric view ,declare function={a=3;b=3;h=3;
        }]
        \path
        foreach \X in {-1,...,5}
        {foreach \Y in {-1,...,5}
            {foreach \Z in {-1,...,3}
                {(\X,\Y,\Z)node[circle,inner sep=1pt,fill]{}}}}
        (0,0,0) coordinate (A)
        (a,0,0) coordinate (B)
        (a,b,0) coordinate (C)
        (0,b,0) coordinate (D)
        (0,0,h) coordinate (E)
        (a,0,h) coordinate (F)
        (a,b,h) coordinate (G)
        (0,b,h) coordinate (H)
        ;
        \draw  (E)-- (F) -- (G) -- (H) --cycle 
        (E) -- (A) -- (D) -- (H)
        (A) -- (B) -- (F)
        ;
    \end{tikzpicture}
    \end{document}

enter image description here