tikz drawing rectangle discretized with triangle lattices and its centroidsHow to draw triangular grid in TikZ?Confused about TikZ draw[rotate=angle]Drawing Subgroup Lattices in TikZDrawing an altitude in a triangle and labeling its footDrawing an obtuse triangle, and marking its heightInput/Output Nodes - Specification and Description LanguageDrawing rectangle triangles with labels only in its sizesHow to draw stacked rectangles (in a third dimension), but with the intersected lines clipped + grid pattern for each rectangle + shaded fill + textDrawing this matrix using Tikzfading angle does not work?tikz put text under rectangle
Riley Rebuses that Share a Common Theme
What is the largest (size) solid object ever dropped from an airplane to impact the ground in freefall?
I think I may have violated academic integrity last year - what should I do?
At what point in European history could a government build a printing press given a basic description?
Were pens caps holes designed to prevent death by suffocation if swallowed?
Can a wire having a 610-670 THz (frequency of blue light) AC frequency supply, generate blue light?
Can you heal a summoned creature?
What is the object moving across the ceiling in this stock footage?
What is the most important source of natural gas? coal, oil or other?
Infinite Sequence based on Simple Rule
Why are C64 games inconsistent with which joystick port they use?
Why colon to denote that a value belongs to a type?
Dictionary size reduces upon increasing one element
Is there a general effective method to solve Smullyan style Knights and Knaves problems? Is the truth table method the most appropriate one?
Apparent Ring of Craters on the Moon
Geological aftereffects of an asteroid impact on a large mountain range?
Command to Search for Filenames Exceeding 143 Characters?
When did God say "let all the angels of God worship him" as stated in Hebrews 1:6?
What's the Difference between Two Single-Quotes and One Double-Quote?
Does this degree 12 genus 1 curve have only one point over infinitely many finite fields?
Looking for a soft substance that doesn't dissolve underwater
Full horizontal justification in table
Why are these traces shaped in such way?
Why doesn't the Earth's acceleration towards the Moon accumulate to push the Earth off its orbit?
tikz drawing rectangle discretized with triangle lattices and its centroids
How to draw triangular grid in TikZ?Confused about TikZ draw[rotate=angle]Drawing Subgroup Lattices in TikZDrawing an altitude in a triangle and labeling its footDrawing an obtuse triangle, and marking its heightInput/Output Nodes - Specification and Description LanguageDrawing rectangle triangles with labels only in its sizesHow to draw stacked rectangles (in a third dimension), but with the intersected lines clipped + grid pattern for each rectangle + shaded fill + textDrawing this matrix using Tikzfading angle does not work?tikz put text under rectangle
Is there a way to draw the following figure using tikz
This post is similar but the for loops are complicated for me to understand.
The rectangle domain is 2.0 x 1.0 (width x height) and there are 20 subdivisions along horizontal direction and 10 subdivisions along vertical directions.
The blue dots are centroids of the triangle
Any help/clue will be really appreciated.
Thank you
tikz-pgf
add a comment |
Is there a way to draw the following figure using tikz
This post is similar but the for loops are complicated for me to understand.
The rectangle domain is 2.0 x 1.0 (width x height) and there are 20 subdivisions along horizontal direction and 10 subdivisions along vertical directions.
The blue dots are centroids of the triangle
Any help/clue will be really appreciated.
Thank you
tikz-pgf
add a comment |
Is there a way to draw the following figure using tikz
This post is similar but the for loops are complicated for me to understand.
The rectangle domain is 2.0 x 1.0 (width x height) and there are 20 subdivisions along horizontal direction and 10 subdivisions along vertical directions.
The blue dots are centroids of the triangle
Any help/clue will be really appreciated.
Thank you
tikz-pgf
Is there a way to draw the following figure using tikz
This post is similar but the for loops are complicated for me to understand.
The rectangle domain is 2.0 x 1.0 (width x height) and there are 20 subdivisions along horizontal direction and 10 subdivisions along vertical directions.
The blue dots are centroids of the triangle
Any help/clue will be really appreciated.
Thank you
tikz-pgf
tikz-pgf
asked May 14 at 13:36
ggulguliaggulgulia
281110
281110
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
One needs to find an algorithm to draw it. The following is one of such algorithms.
documentclass[tikz,margin=3]standalone
begindocument
begintikzpicture[scale=0.5]
draw[gray] (0,0) grid (20,10);
foreach i in 0,...,9
% Draw the grid
draw[gray] (0,i) -- (10-i,10);
draw[gray] (10+i,0) -- (20,10-i);
ifnumi=0relaxelse
draw[gray] (i,0) -- (10+i,10);fi
% Draw the dots
foreach j in 0,...,19
% The center of each square is j+.5 and i+.5
coordinate (center) at (j+.5,i+.5);
fill[blue] ([shift=(-1/6,1/6)]center) circle (3pt);
fill[blue] ([shift=(1/6,-1/6)]center) circle (3pt);
endtikzpicture
enddocument
add a comment |
An alternative construction with a matrix
and nodes in empty cells
.
documentclass[tikz,border=2mm]standalone
usetikzlibrarymatrix
begindocument
begintikzpicture[%
mymatrix/.style=
matrix of nodes,
nodes in empty cells,
row sep=-pgflinewidth,
column sep=-pgflinewidth,
nodes=draw=gray,
minimum size=1cm,
outer sep=0pt,
inner sep=0pt,
anchor=center,
path picture=%
draw (path picture bounding box.north east)--(path picture bounding box.south west);
fill[blue] ([shift=(-1/6,1/6)]path picture bounding box.center) circle(3pt);
fill[blue] ([shift=(1/6,-1/6)]path picture bounding box.center) circle(3pt);
]
matrix[mymatrix]%
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
;
endtikzpicture
enddocument
add a comment |
Yet another alternative: pic
s. And store the variables in pgf keys. Like Joule V's nice solution, this grid can be transformed (e.g. rotated) without resorting to transform canvas
, which tends to mess up things.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture[pics/cell/.style=code=draw (-#1,-#1) rectangle (#1,#1)
(-#1,-#1) -- (#1,#1);
fill[pgfkeysvalueof/tikz/cell/color]
(135:#1*pgfkeysvalueof/tikz/cell/circle pos)
circle[radius=#1*pgfkeysvalueof/tikz/cell/radius]
(-45:#1*pgfkeysvalueof/tikz/cell/circle pos)
circle[radius=#1*pgfkeysvalueof/tikz/cell/radius];,
cell/.cd,color/.initial=blue,radius/.initial=1/6,circle pos/.initial=sqrt(0.5)]
path foreach X in 1,...,20
foreach Y in 1,...,10 (X,Y) pic[cell/radius=1/5,cell/circle pos=1/2]cell=0.5;
endtikzpicture
enddocument
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f490800%2ftikz-drawing-rectangle-discretized-with-triangle-lattices-and-its-centroids%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
One needs to find an algorithm to draw it. The following is one of such algorithms.
documentclass[tikz,margin=3]standalone
begindocument
begintikzpicture[scale=0.5]
draw[gray] (0,0) grid (20,10);
foreach i in 0,...,9
% Draw the grid
draw[gray] (0,i) -- (10-i,10);
draw[gray] (10+i,0) -- (20,10-i);
ifnumi=0relaxelse
draw[gray] (i,0) -- (10+i,10);fi
% Draw the dots
foreach j in 0,...,19
% The center of each square is j+.5 and i+.5
coordinate (center) at (j+.5,i+.5);
fill[blue] ([shift=(-1/6,1/6)]center) circle (3pt);
fill[blue] ([shift=(1/6,-1/6)]center) circle (3pt);
endtikzpicture
enddocument
add a comment |
One needs to find an algorithm to draw it. The following is one of such algorithms.
documentclass[tikz,margin=3]standalone
begindocument
begintikzpicture[scale=0.5]
draw[gray] (0,0) grid (20,10);
foreach i in 0,...,9
% Draw the grid
draw[gray] (0,i) -- (10-i,10);
draw[gray] (10+i,0) -- (20,10-i);
ifnumi=0relaxelse
draw[gray] (i,0) -- (10+i,10);fi
% Draw the dots
foreach j in 0,...,19
% The center of each square is j+.5 and i+.5
coordinate (center) at (j+.5,i+.5);
fill[blue] ([shift=(-1/6,1/6)]center) circle (3pt);
fill[blue] ([shift=(1/6,-1/6)]center) circle (3pt);
endtikzpicture
enddocument
add a comment |
One needs to find an algorithm to draw it. The following is one of such algorithms.
documentclass[tikz,margin=3]standalone
begindocument
begintikzpicture[scale=0.5]
draw[gray] (0,0) grid (20,10);
foreach i in 0,...,9
% Draw the grid
draw[gray] (0,i) -- (10-i,10);
draw[gray] (10+i,0) -- (20,10-i);
ifnumi=0relaxelse
draw[gray] (i,0) -- (10+i,10);fi
% Draw the dots
foreach j in 0,...,19
% The center of each square is j+.5 and i+.5
coordinate (center) at (j+.5,i+.5);
fill[blue] ([shift=(-1/6,1/6)]center) circle (3pt);
fill[blue] ([shift=(1/6,-1/6)]center) circle (3pt);
endtikzpicture
enddocument
One needs to find an algorithm to draw it. The following is one of such algorithms.
documentclass[tikz,margin=3]standalone
begindocument
begintikzpicture[scale=0.5]
draw[gray] (0,0) grid (20,10);
foreach i in 0,...,9
% Draw the grid
draw[gray] (0,i) -- (10-i,10);
draw[gray] (10+i,0) -- (20,10-i);
ifnumi=0relaxelse
draw[gray] (i,0) -- (10+i,10);fi
% Draw the dots
foreach j in 0,...,19
% The center of each square is j+.5 and i+.5
coordinate (center) at (j+.5,i+.5);
fill[blue] ([shift=(-1/6,1/6)]center) circle (3pt);
fill[blue] ([shift=(1/6,-1/6)]center) circle (3pt);
endtikzpicture
enddocument
edited May 14 at 14:16
answered May 14 at 13:55
The old JouleVThe old JouleV
19.5k33175
19.5k33175
add a comment |
add a comment |
An alternative construction with a matrix
and nodes in empty cells
.
documentclass[tikz,border=2mm]standalone
usetikzlibrarymatrix
begindocument
begintikzpicture[%
mymatrix/.style=
matrix of nodes,
nodes in empty cells,
row sep=-pgflinewidth,
column sep=-pgflinewidth,
nodes=draw=gray,
minimum size=1cm,
outer sep=0pt,
inner sep=0pt,
anchor=center,
path picture=%
draw (path picture bounding box.north east)--(path picture bounding box.south west);
fill[blue] ([shift=(-1/6,1/6)]path picture bounding box.center) circle(3pt);
fill[blue] ([shift=(1/6,-1/6)]path picture bounding box.center) circle(3pt);
]
matrix[mymatrix]%
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
;
endtikzpicture
enddocument
add a comment |
An alternative construction with a matrix
and nodes in empty cells
.
documentclass[tikz,border=2mm]standalone
usetikzlibrarymatrix
begindocument
begintikzpicture[%
mymatrix/.style=
matrix of nodes,
nodes in empty cells,
row sep=-pgflinewidth,
column sep=-pgflinewidth,
nodes=draw=gray,
minimum size=1cm,
outer sep=0pt,
inner sep=0pt,
anchor=center,
path picture=%
draw (path picture bounding box.north east)--(path picture bounding box.south west);
fill[blue] ([shift=(-1/6,1/6)]path picture bounding box.center) circle(3pt);
fill[blue] ([shift=(1/6,-1/6)]path picture bounding box.center) circle(3pt);
]
matrix[mymatrix]%
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
;
endtikzpicture
enddocument
add a comment |
An alternative construction with a matrix
and nodes in empty cells
.
documentclass[tikz,border=2mm]standalone
usetikzlibrarymatrix
begindocument
begintikzpicture[%
mymatrix/.style=
matrix of nodes,
nodes in empty cells,
row sep=-pgflinewidth,
column sep=-pgflinewidth,
nodes=draw=gray,
minimum size=1cm,
outer sep=0pt,
inner sep=0pt,
anchor=center,
path picture=%
draw (path picture bounding box.north east)--(path picture bounding box.south west);
fill[blue] ([shift=(-1/6,1/6)]path picture bounding box.center) circle(3pt);
fill[blue] ([shift=(1/6,-1/6)]path picture bounding box.center) circle(3pt);
]
matrix[mymatrix]%
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
;
endtikzpicture
enddocument
An alternative construction with a matrix
and nodes in empty cells
.
documentclass[tikz,border=2mm]standalone
usetikzlibrarymatrix
begindocument
begintikzpicture[%
mymatrix/.style=
matrix of nodes,
nodes in empty cells,
row sep=-pgflinewidth,
column sep=-pgflinewidth,
nodes=draw=gray,
minimum size=1cm,
outer sep=0pt,
inner sep=0pt,
anchor=center,
path picture=%
draw (path picture bounding box.north east)--(path picture bounding box.south west);
fill[blue] ([shift=(-1/6,1/6)]path picture bounding box.center) circle(3pt);
fill[blue] ([shift=(1/6,-1/6)]path picture bounding box.center) circle(3pt);
]
matrix[mymatrix]%
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
&&&&&&&&&&&&&&&&&&&\
;
endtikzpicture
enddocument
answered May 14 at 15:11
IgnasiIgnasi
97.1k6177327
97.1k6177327
add a comment |
add a comment |
Yet another alternative: pic
s. And store the variables in pgf keys. Like Joule V's nice solution, this grid can be transformed (e.g. rotated) without resorting to transform canvas
, which tends to mess up things.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture[pics/cell/.style=code=draw (-#1,-#1) rectangle (#1,#1)
(-#1,-#1) -- (#1,#1);
fill[pgfkeysvalueof/tikz/cell/color]
(135:#1*pgfkeysvalueof/tikz/cell/circle pos)
circle[radius=#1*pgfkeysvalueof/tikz/cell/radius]
(-45:#1*pgfkeysvalueof/tikz/cell/circle pos)
circle[radius=#1*pgfkeysvalueof/tikz/cell/radius];,
cell/.cd,color/.initial=blue,radius/.initial=1/6,circle pos/.initial=sqrt(0.5)]
path foreach X in 1,...,20
foreach Y in 1,...,10 (X,Y) pic[cell/radius=1/5,cell/circle pos=1/2]cell=0.5;
endtikzpicture
enddocument
add a comment |
Yet another alternative: pic
s. And store the variables in pgf keys. Like Joule V's nice solution, this grid can be transformed (e.g. rotated) without resorting to transform canvas
, which tends to mess up things.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture[pics/cell/.style=code=draw (-#1,-#1) rectangle (#1,#1)
(-#1,-#1) -- (#1,#1);
fill[pgfkeysvalueof/tikz/cell/color]
(135:#1*pgfkeysvalueof/tikz/cell/circle pos)
circle[radius=#1*pgfkeysvalueof/tikz/cell/radius]
(-45:#1*pgfkeysvalueof/tikz/cell/circle pos)
circle[radius=#1*pgfkeysvalueof/tikz/cell/radius];,
cell/.cd,color/.initial=blue,radius/.initial=1/6,circle pos/.initial=sqrt(0.5)]
path foreach X in 1,...,20
foreach Y in 1,...,10 (X,Y) pic[cell/radius=1/5,cell/circle pos=1/2]cell=0.5;
endtikzpicture
enddocument
add a comment |
Yet another alternative: pic
s. And store the variables in pgf keys. Like Joule V's nice solution, this grid can be transformed (e.g. rotated) without resorting to transform canvas
, which tends to mess up things.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture[pics/cell/.style=code=draw (-#1,-#1) rectangle (#1,#1)
(-#1,-#1) -- (#1,#1);
fill[pgfkeysvalueof/tikz/cell/color]
(135:#1*pgfkeysvalueof/tikz/cell/circle pos)
circle[radius=#1*pgfkeysvalueof/tikz/cell/radius]
(-45:#1*pgfkeysvalueof/tikz/cell/circle pos)
circle[radius=#1*pgfkeysvalueof/tikz/cell/radius];,
cell/.cd,color/.initial=blue,radius/.initial=1/6,circle pos/.initial=sqrt(0.5)]
path foreach X in 1,...,20
foreach Y in 1,...,10 (X,Y) pic[cell/radius=1/5,cell/circle pos=1/2]cell=0.5;
endtikzpicture
enddocument
Yet another alternative: pic
s. And store the variables in pgf keys. Like Joule V's nice solution, this grid can be transformed (e.g. rotated) without resorting to transform canvas
, which tends to mess up things.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture[pics/cell/.style=code=draw (-#1,-#1) rectangle (#1,#1)
(-#1,-#1) -- (#1,#1);
fill[pgfkeysvalueof/tikz/cell/color]
(135:#1*pgfkeysvalueof/tikz/cell/circle pos)
circle[radius=#1*pgfkeysvalueof/tikz/cell/radius]
(-45:#1*pgfkeysvalueof/tikz/cell/circle pos)
circle[radius=#1*pgfkeysvalueof/tikz/cell/radius];,
cell/.cd,color/.initial=blue,radius/.initial=1/6,circle pos/.initial=sqrt(0.5)]
path foreach X in 1,...,20
foreach Y in 1,...,10 (X,Y) pic[cell/radius=1/5,cell/circle pos=1/2]cell=0.5;
endtikzpicture
enddocument
edited May 14 at 18:46
answered May 14 at 18:31
marmotmarmot
130k6165313
130k6165313
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f490800%2ftikz-drawing-rectangle-discretized-with-triangle-lattices-and-its-centroids%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown