From 3d681da551ce2f2f7f1d3b8b5e0f5c616dd53fdd Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Mon, 26 Feb 2024 10:04:57 -0500 Subject: [PATCH] Export other shapes --- TeX/jam.sty | 18 ++++++++++++++++++ src/painter.py | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/TeX/jam.sty b/TeX/jam.sty index 9dd1ac3..33c7431 100644 --- a/TeX/jam.sty +++ b/TeX/jam.sty @@ -28,3 +28,21 @@ \fill[color=#1]#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-1)--++(-1,0)--++(0,-1)--++(1,0)--++(0,-1)--++(1,0)--++(0,1)--++(1,0)--++(0,1)--++(-1,0); \draw[color=black]#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-1)--++(-1,0)--++(0,-1)--++(1,0)--++(0,-1)--++(1,0)--++(0,1)--++(1,0)--++(0,1)--++(-1,0); } + +% 3-staircase (color #1, position #2) +\def\staircase#1#2{ + \fill[color=#1]#2++(-0.5,-0.5)--++(3,0)--++(0,1)--++(-1,0)--++(0,1)--++(-1,0)--++(0,1)--++(-1,0)--++(0,-3); + \draw[color=black]#2++(-0.5,-0.5)--++(3,0)--++(0,1)--++(-1,0)--++(0,1)--++(-1,0)--++(0,1)--++(-1,0)--++(0,-3); +} + +% disk (color #1, position #2) +\def\disk#1#2{ + \fill[color=#1]#2circle(2.5); + \draw[color=black]#2circle(2.5); +} + +% square (color #1, position #2) +\def\square#1#2{ + \fill[color=#1]#2++(-1,-1)--++(0,2)--++(2,0)--++(0,-2)--cycle; + \draw[color=black]#2++(-1,-1)--++(0,2)--++(2,0)--++(0,-2)--cycle; +} diff --git a/src/painter.py b/src/painter.py index 9559d40..2708237 100644 --- a/src/painter.py +++ b/src/painter.py @@ -708,6 +708,12 @@ class Painter(Widget): for particle in self.particles: if type(particle)==Cross: ff.write("\cross{"+colors.closest_color(particle.color,colors.xcolor_names)+"}") + elif type(particle)==Disk: + ff.write("\disk{"+colors.closest_color(particle.color,colors.xcolor_names)+"}") + elif type(particle)==Staircase: + ff.write("\staircase{"+colors.closest_color(particle.color,colors.xcolor_names)+"}") + elif type(particle)==Square2: + ff.write("\square{"+colors.closest_color(particle.color,colors.xcolor_names)+"}") ff.write("{{({:05.2f},{:05.2f})}};\n".format(particle.elements[0].pos.x-self.particles[0].elements[0].pos.x,particle.elements[0].pos.y-self.particles[0].elements[0].pos.y)) ff.write("\\end{tikzpicture}\n")