Pikchr

Demo Generating Flower Snarks
Login

Demo Generating Flower Snarks

(1) By pskechr on 2026-03-27 16:21:00 [source]

Hello,

Many years ago, I did a college paper on snarks and, if I remember correctly, I manually designed all my paper's diagrams in MS Visio. Having Pikchr would have been so nice. Figuring out how to generate flower snarks in Pikchr has been floating around in my head for a while. Here's a pretty good method, I think, with only a minor change needed between each generation.

define drawNext {
   layer = 2
   Z1: circle same as A1 at $R heading $S+360/$N*$1 from C
   Z2: circle same as A1 at $R*2 heading $S+360/$N*$1 from C
   Z3: circle same as A1 at $R heading $S+360/$N*$1-360/$N/2 from $R*2 heading $S+360/$N*$1 from C
   Z4: circle same as A1 at $R heading $S+360/$N*$1+360/$N/2 from $R*2 heading $S+360/$N*$1 from C
   
   layer = 1
   line from Z1 to Z2
   line from Z2 to Z3
   line from Z2 to Z4
   
   layer = 0
   circle at 1/2 between T3 and Z3 width dist(T3,Z3)
   circle at 1/2 between T4 and Z4 width dist(T4,Z4)
   
   T1: Z1
   T2: Z2
   T3: Z3
   T4: Z4
}

C: (0,0)
$R = 0.25in
$D = 0.0625in
$N = 3
$S = 180+360/$N/2

layer = 1
circle at C radius dist($R heading $S+360/$N/2 from $R*2 heading $S from C,C) color none fill white
circle at C radius $R color black fill none

layer = 2
A1: circle at $R heading $S from C diameter $D color black fill red
A2: circle same as A1 at $R*2 heading $S from C
A3: circle same as A1 at $R heading $S-360/$N/2 from $R*2 heading $S from C
A4: circle same as A1 at $R heading $S+360/$N/2 from $R*2 heading $S from C

layer = 1
line from A1 to A2
line from A2 to A3
line from A2 to A4

T1: A1
T2: A2
T3: A3
T4: A4

drawNext(1)
drawNext(2)

layer = 0
P1: Z3
P2: dist(C,1/2 between Z3 and A3)+dist(1/2 between Z3 and A3,Z3) heading 180 from C
P3: (0,((-((P2.x-P1.x)/(P2.y-P1.y)))*(-((P1.x+P2.x)/2)))+((P1.y+P2.y)/2))
circle at P3 radius dist(P3,Z3)
P1: Z4
P2: 1/3 between dist(P3,Z4) heading 180 from P3 and previous circle .s
P3: (0,((-((P2.x-P1.x)/(P2.y-P1.y)))*(-((P1.x+P2.x)/2)))+((P1.y+P2.y)/2))
circle at P3 radius dist(P3,Z4)

define drawNext {
   layer = 2
   Z1: circle same as A1 at $R heading $S+360/$N*$1 from C
   Z2: circle same as A1 at $R*2 heading $S+360/$N*$1 from C
   Z3: circle same as A1 at $R heading $S+360/$N*$1-360/$N/2 from $R*2 heading $S+360/$N*$1 from C
   Z4: circle same as A1 at $R heading $S+360/$N*$1+360/$N/2 from $R*2 heading $S+360/$N*$1 from C
   
   layer = 1
   line from Z1 to Z2
   line from Z2 to Z3
   line from Z2 to Z4
   
   layer = 0
   circle at 1/2 between T3 and Z3 width dist(T3,Z3)
   circle at 1/2 between T4 and Z4 width dist(T4,Z4)
   
   T1: Z1
   T2: Z2
   T3: Z3
   T4: Z4
}

C: (0,0)
$R = 0.25in
$D = 0.0625in
$N = 5
$S = 180+360/$N/2

layer = 1
circle at C radius dist($R heading $S+360/$N/2 from $R*2 heading $S from C,C) color none fill white
circle at C radius $R color black fill none

layer = 2
A1: circle at $R heading $S from C diameter $D color black fill red
A2: circle same as A1 at $R*2 heading $S from C
A3: circle same as A1 at $R heading $S-360/$N/2 from $R*2 heading $S from C
A4: circle same as A1 at $R heading $S+360/$N/2 from $R*2 heading $S from C

layer = 1
line from A1 to A2
line from A2 to A3
line from A2 to A4

T1: A1
T2: A2
T3: A3
T4: A4

drawNext(1)
drawNext(2)
drawNext(3)
drawNext(4)

layer = 0
P1: Z3
P2: dist(C,1/2 between Z3 and A3)+dist(1/2 between Z3 and A3,Z3) heading 180 from C
P3: (0,((-((P2.x-P1.x)/(P2.y-P1.y)))*(-((P1.x+P2.x)/2)))+((P1.y+P2.y)/2))
circle at P3 radius dist(P3,Z3)
P1: Z4
P2: 1/3 between dist(P3,Z4) heading 180 from P3 and previous circle .s
P3: (0,((-((P2.x-P1.x)/(P2.y-P1.y)))*(-((P1.x+P2.x)/2)))+((P1.y+P2.y)/2))
circle at P3 radius dist(P3,Z4)

define drawNext {
   layer = 2
   Z1: circle same as A1 at $R heading $S+360/$N*$1 from C
   Z2: circle same as A1 at $R*2 heading $S+360/$N*$1 from C
   Z3: circle same as A1 at $R heading $S+360/$N*$1-360/$N/2 from $R*2 heading $S+360/$N*$1 from C
   Z4: circle same as A1 at $R heading $S+360/$N*$1+360/$N/2 from $R*2 heading $S+360/$N*$1 from C
   
   layer = 1
   line from Z1 to Z2
   line from Z2 to Z3
   line from Z2 to Z4
   
   layer = 0
   circle at 1/2 between T3 and Z3 width dist(T3,Z3)
   circle at 1/2 between T4 and Z4 width dist(T4,Z4)
   
   T1: Z1
   T2: Z2
   T3: Z3
   T4: Z4
}

C: (0,0)
$R = 0.25in
$D = 0.0625in
$N = 7
$S = 180+360/$N/2

layer = 1
circle at C radius dist($R heading $S+360/$N/2 from $R*2 heading $S from C,C) color none fill white
circle at C radius $R color black fill none

layer = 2
A1: circle at $R heading $S from C diameter $D color black fill red
A2: circle same as A1 at $R*2 heading $S from C
A3: circle same as A1 at $R heading $S-360/$N/2 from $R*2 heading $S from C
A4: circle same as A1 at $R heading $S+360/$N/2 from $R*2 heading $S from C

layer = 1
line from A1 to A2
line from A2 to A3
line from A2 to A4

T1: A1
T2: A2
T3: A3
T4: A4

drawNext(1)
drawNext(2)
drawNext(3)
drawNext(4)
drawNext(5)
drawNext(6)

layer = 0
P1: Z3
P2: dist(C,1/2 between Z3 and A3)+dist(1/2 between Z3 and A3,Z3) heading 180 from C
P3: (0,((-((P2.x-P1.x)/(P2.y-P1.y)))*(-((P1.x+P2.x)/2)))+((P1.y+P2.y)/2))
circle at P3 radius dist(P3,Z3)
P1: Z4
P2: 1/3 between dist(P3,Z4) heading 180 from P3 and previous circle .s
P3: (0,((-((P2.x-P1.x)/(P2.y-P1.y)))*(-((P1.x+P2.x)/2)))+((P1.y+P2.y)/2))
circle at P3 radius dist(P3,Z4)

define drawNext {
   layer = 2
   Z1: circle same as A1 at $R heading $S+360/$N*$1 from C
   Z2: circle same as A1 at $R*2 heading $S+360/$N*$1 from C
   Z3: circle same as A1 at $R heading $S+360/$N*$1-360/$N/2 from $R*2 heading $S+360/$N*$1 from C
   Z4: circle same as A1 at $R heading $S+360/$N*$1+360/$N/2 from $R*2 heading $S+360/$N*$1 from C
   
   layer = 1
   line from Z1 to Z2
   line from Z2 to Z3
   line from Z2 to Z4
   
   layer = 0
   circle at 1/2 between T3 and Z3 width dist(T3,Z3)
   circle at 1/2 between T4 and Z4 width dist(T4,Z4)
   
   T1: Z1
   T2: Z2
   T3: Z3
   T4: Z4
}

C: (0,0)
$R = 0.25in
$D = 0.0625in
$N = 9
$S = 180+360/$N/2

layer = 1
circle at C radius dist($R heading $S+360/$N/2 from $R*2 heading $S from C,C) color none fill white
circle at C radius $R color black fill none

layer = 2
A1: circle at $R heading $S from C diameter $D color black fill red
A2: circle same as A1 at $R*2 heading $S from C
A3: circle same as A1 at $R heading $S-360/$N/2 from $R*2 heading $S from C
A4: circle same as A1 at $R heading $S+360/$N/2 from $R*2 heading $S from C

layer = 1
line from A1 to A2
line from A2 to A3
line from A2 to A4

T1: A1
T2: A2
T3: A3
T4: A4

drawNext(1)
drawNext(2)
drawNext(3)
drawNext(4)
drawNext(5)
drawNext(6)
drawNext(7)
drawNext(8)

layer = 0
P1: Z3
P2: dist(C,1/2 between Z3 and A3)+dist(1/2 between Z3 and A3,Z3) heading 180 from C
P3: (0,((-((P2.x-P1.x)/(P2.y-P1.y)))*(-((P1.x+P2.x)/2)))+((P1.y+P2.y)/2))
circle at P3 radius dist(P3,Z3)
P1: Z4
P2: 1/3 between dist(P3,Z4) heading 180 from P3 and previous circle .s
P3: (0,((-((P2.x-P1.x)/(P2.y-P1.y)))*(-((P1.x+P2.x)/2)))+((P1.y+P2.y)/2))
circle at P3 radius dist(P3,Z4)

define drawNext {
   layer = 2
   Z1: circle same as A1 at $R heading $S+360/$N*$1 from C
   Z2: circle same as A1 at $R*2 heading $S+360/$N*$1 from C
   Z3: circle same as A1 at $R heading $S+360/$N*$1-360/$N/2 from $R*2 heading $S+360/$N*$1 from C
   Z4: circle same as A1 at $R heading $S+360/$N*$1+360/$N/2 from $R*2 heading $S+360/$N*$1 from C
   
   layer = 1
   line from Z1 to Z2
   line from Z2 to Z3
   line from Z2 to Z4
   
   layer = 0
   circle at 1/2 between T3 and Z3 width dist(T3,Z3)
   circle at 1/2 between T4 and Z4 width dist(T4,Z4)
   
   T1: Z1
   T2: Z2
   T3: Z3
   T4: Z4
}

C: (0,0)
$R = 0.25in
$D = 0.0625in
$N = 11
$S = 180+360/$N/2

layer = 1
circle at C radius dist($R heading $S+360/$N/2 from $R*2 heading $S from C,C) color none fill white
circle at C radius $R color black fill none

layer = 2
A1: circle at $R heading $S from C diameter $D color black fill red
A2: circle same as A1 at $R*2 heading $S from C
A3: circle same as A1 at $R heading $S-360/$N/2 from $R*2 heading $S from C
A4: circle same as A1 at $R heading $S+360/$N/2 from $R*2 heading $S from C

layer = 1
line from A1 to A2
line from A2 to A3
line from A2 to A4

T1: A1
T2: A2
T3: A3
T4: A4

drawNext(1)
drawNext(2)
drawNext(3)
drawNext(4)
drawNext(5)
drawNext(6)
drawNext(7)
drawNext(8)
drawNext(9)
drawNext(10)

layer = 0
P1: Z3
P2: dist(C,1/2 between Z3 and A3)+dist(1/2 between Z3 and A3,Z3) heading 180 from C
P3: (0,((-((P2.x-P1.x)/(P2.y-P1.y)))*(-((P1.x+P2.x)/2)))+((P1.y+P2.y)/2))
circle at P3 radius dist(P3,Z3)
P1: Z4
P2: 1/3 between dist(P3,Z4) heading 180 from P3 and previous circle .s
P3: (0,((-((P2.x-P1.x)/(P2.y-P1.y)))*(-((P1.x+P2.x)/2)))+((P1.y+P2.y)/2))
circle at P3 radius dist(P3,Z4)

define drawNext {
   layer = 2
   Z1: circle same as A1 at $R heading $S+360/$N*$1 from C
   Z2: circle same as A1 at $R*2 heading $S+360/$N*$1 from C
   Z3: circle same as A1 at $R heading $S+360/$N*$1-360/$N/2 from $R*2 heading $S+360/$N*$1 from C
   Z4: circle same as A1 at $R heading $S+360/$N*$1+360/$N/2 from $R*2 heading $S+360/$N*$1 from C
   
   layer = 1
   line from Z1 to Z2
   line from Z2 to Z3
   line from Z2 to Z4
   
   layer = 0
   circle at 1/2 between T3 and Z3 width dist(T3,Z3)
   circle at 1/2 between T4 and Z4 width dist(T4,Z4)
   
   T1: Z1
   T2: Z2
   T3: Z3
   T4: Z4
}

C: (0,0)
$R = 0.25in
$D = 0.0625in
$N = 13
$S = 180+360/$N/2

layer = 1
circle at C radius dist($R heading $S+360/$N/2 from $R*2 heading $S from C,C) color none fill white
circle at C radius $R color black fill none

layer = 2
A1: circle at $R heading $S from C diameter $D color black fill red
A2: circle same as A1 at $R*2 heading $S from C
A3: circle same as A1 at $R heading $S-360/$N/2 from $R*2 heading $S from C
A4: circle same as A1 at $R heading $S+360/$N/2 from $R*2 heading $S from C

layer = 1
line from A1 to A2
line from A2 to A3
line from A2 to A4

T1: A1
T2: A2
T3: A3
T4: A4

drawNext(1)
drawNext(2)
drawNext(3)
drawNext(4)
drawNext(5)
drawNext(6)
drawNext(7)
drawNext(8)
drawNext(9)
drawNext(10)
drawNext(11)
drawNext(12)

layer = 0
P1: Z3
P2: dist(C,1/2 between Z3 and A3)+dist(1/2 between Z3 and A3,Z3) heading 180 from C
P3: (0,((-((P2.x-P1.x)/(P2.y-P1.y)))*(-((P1.x+P2.x)/2)))+((P1.y+P2.y)/2))
circle at P3 radius dist(P3,Z3)
P1: Z4
P2: 1/3 between dist(P3,Z4) heading 180 from P3 and previous circle .s
P3: (0,((-((P2.x-P1.x)/(P2.y-P1.y)))*(-((P1.x+P2.x)/2)))+((P1.y+P2.y)/2))
circle at P3 radius dist(P3,Z4)

There's some extra code around generating the bottom-most, final "petal", just because I think the result looks better than the "hard edge" of the Wikipedia diagrams. And, these require a white circle to cover the inside parts of all the circles used to draw the graph edges. But, I didn't make a white background behind the whole Pikchr. So, when backlit with blue as the thread's "most recent", that will show.

Thanks for reading. Happy snark hunting.

(2) By pskechr on 2026-03-28 01:46:53 in reply to 1 [link] [source]

Adding an extra layer, the outer edges can be filled in.

define drawNext {
   //-- A1 layer = 3
   Z1: circle same as A1 at $R heading $S+360/$N*$1 from C
   Z2: circle same as A1 at $R*2 heading $S+360/$N*$1 from C
   Z3: circle same as A1 at $R heading $S+360/$N*$1-360/$N/2 from $R*2 heading $S+360/$N*$1 from C
   Z4: circle same as A1 at $R heading $S+360/$N*$1+360/$N/2 from $R*2 heading $S+360/$N*$1 from C
   
   layer = 2
   line from Z1 to Z2
   line from Z2 to Z3
   line from Z2 to Z4
   
   layer = 0
   circle at 1/2 between T3 and Z3 diameter dist(T3,Z3) color none fill white
   circle same at 1/2 between T4 and Z4
   
   layer = 1
   circle at 1/2 between T3 and Z3 diameter dist(T3,Z3) color black fill none
   circle same at 1/2 between T4 and Z4
   
   T1: Z1
   T2: Z2
   T3: Z3
   T4: Z4
}

C: (0,0)
$R = 0.25in
$D = 0.0625in
$N = 7
$S = 180+360/$N/2

layer = 2
circle at C radius dist($R heading $S+360/$N/2 from $R*2 heading $S from C,C) color none fill white
circle at C radius $R color black fill none

layer = 3
A1: circle at $R heading $S from C diameter $D color black fill red
A2: circle same as A1 at $R*2 heading $S from C
A3: circle same as A1 at $R heading $S-360/$N/2 from $R*2 heading $S from C
A4: circle same as A1 at $R heading $S+360/$N/2 from $R*2 heading $S from C

layer = 2
line from A1 to A2
line from A2 to A3
line from A2 to A4

T1: A1
T2: A2
T3: A3
T4: A4

drawNext(1)
drawNext(2)
drawNext(3)
drawNext(4)
drawNext(5)
drawNext(6)

P1: Z3
P2: dist(C,1/2 between Z3 and A3)+dist(1/2 between Z3 and A3,Z3) heading 180 from C
P3: (0,((-((P2.x-P1.x)/(P2.y-P1.y)))*(-((P1.x+P2.x)/2)))+((P1.y+P2.y)/2))

layer = 0
circle at P3 radius dist(P3,Z3) color none fill white

layer = 1
circle same at P3 color black fill none

P1: Z4
P2: 1/3 between dist(P3,Z4) heading 180 from P3 and previous circle .s
P3: (0,((-((P2.x-P1.x)/(P2.y-P1.y)))*(-((P1.x+P2.x)/2)))+((P1.y+P2.y)/2))

circle same at P3 radius dist(P3,Z4)