How to draw a triangular grid of length n in math

I am wondering if anyone can help draw a triangular grid (equilateral) with edge length n in math. Thank.

+3
source share
3 answers

Simple grid:

p = Table[ Table[

    Polygon[{j - 1/2 i, i Sqrt[3]/2} + # & /@ {{0, 0}, {1/2,Sqrt[3]/2}, {1, 0}}],

    {j, i, 9}], {i, 0, 9}];

Graphics[{EdgeForm[Black], FaceForm[White], p}]  

Triangular grid

Edit

A clearer version, I think:

s3 = Sqrt[3];
templateTriangleVertex = {{0, 0}, {1, s3}, {2, 0}};

p = Table[Table[

    Polygon[{2 j - i, s3 i } + # & /@ templateTriangleVertex],

    {j, i, 9}], {i, 0, 9}];

Graphics[{EdgeForm[Black], FaceForm[White], p}]
+4
source

Something like this?


(source: yaroslavvb.com )

This is the code I used. Perhaps too complicated for the specific task above, this is the part of the code that I had to visualize with integer lattices such as this

A = Sqrt[2/3] {Cos[#], Sin[#], Sqrt[1/2]} & /@ 
    Table[Pi/2 + 2 Pi/3 + 2 k Pi/3, {k, 0, 2}] // Transpose;
p2r[{x_, y_, z_}] := Most[A.{x, y, z}];
n = 10;
types = 1/n Permutations /@ IntegerPartitions[n, {3}, Range[1, n]] // 
   Flatten[#, 1] &;
points = p2r /@ types;
Needs["ComputationalGeometry'"]
Graphics[{EdgeForm[Black], FaceForm[Transparent], 
  GraphicsComplex[points, 
   Polygon /@ DelaunayTriangulation[points // N][[All, 2]]]}]

What does it do

  1. types contains all 3 sets of integers that add up to n. These integers lie in the 2-dimensional subspace R ^ 3
  2. A - , 3 x-y
  3. angular,
+4

belisarius.

p = Table[{2 j - i, Sqrt[3] i}, {i, 0, 9}, {j, i, 9}]

Graphics[ Line @ Join[p, Riffle @@@ Partition[p, 2, 1]] ]
+1

Source: https://habr.com/ru/post/1787577/


All Articles