summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-12-12 01:00:43 +0100
committerPeter Wu <peter@lekensteyn.nl>2016-12-12 01:00:43 +0100
commitcc0345f766e2118421cad98daea91b087ab73dd6 (patch)
tree581a7378e8839a2b97cd76c9d344951fbf50d276
parentbf32a02e180a030307f7bc27896976abeaeb2c1a (diff)
download2IMF25-AR-cc0345f766e2118421cad98daea91b087ab73dd6.tar.gz
ChipDesign: Add text labels with size and number
-rwxr-xr-xchip_design/solution-to-latex.py6
-rw-r--r--part1.tex12
2 files changed, 18 insertions, 0 deletions
diff --git a/chip_design/solution-to-latex.py b/chip_design/solution-to-latex.py
index 2028b1b..798267a 100755
--- a/chip_design/solution-to-latex.py
+++ b/chip_design/solution-to-latex.py
@@ -80,6 +80,12 @@ def print_boxes():
tpl = r"\draw[{attrs}] ({x}, {y}) rectangle ({x2}, {y2});"
print(tpl.strip().format(**vars()))
+ # Draw number for debugging
+ tx = x + w/2
+ ty = y + h/2
+ text = r"%s\\(%s x %s)" % (i, w, h)
+ print(r'\node[align=center] at (%f,%f) {%s};' % (tx, ty, text))
+
def print_grid():
# XXX currently hard-coding grid size
print(r'\draw[step=1,gray,very thin] (0, 0) grid (30, 30);')
diff --git a/part1.tex b/part1.tex
index 04ccb40..2c3bce1 100644
--- a/part1.tex
+++ b/part1.tex
@@ -71,17 +71,29 @@ their centres should differ at least 17 in either the x direction or the y direc
\draw[red,thick] (-.5, -.5) rectangle (30.5, 30.5);
\draw[draw=red,fill=red] (27.01, 20.01) rectangle (29.99, 23.99);
+\node[align=center] at (28.510000,22.010000) {0\\(3 x 4)};
\draw[draw=green,fill=red] (7.01, 11.01) rectangle (9.99, 14.99);
+\node[align=center] at (8.510000,13.010000) {1\\(3 x 4)};
\draw[draw=blue] (10.01, 11.01) rectangle (14.99, 14.99);
+\node[align=center] at (12.510000,13.010000) {2\\(5 x 4)};
\draw[draw=cyan] (21.01, 21.01) rectangle (26.99, 24.99);
+\node[align=center] at (24.010000,23.010000) {3\\(6 x 4)};
\draw[draw=magenta] (10.01, 25.01) rectangle (29.99, 29.99);
+\node[align=center] at (20.010000,27.510000) {4\\(20 x 5)};
\draw[draw=gray] (7.01, 15.01) rectangle (12.99, 23.99);
+\node[align=center] at (10.010000,19.510000) {5\\(6 x 9)};
\draw[draw=darkgray] (0.01, 24.01) rectangle (9.99, 29.99);
+\node[align=center] at (5.010000,27.010000) {6\\(10 x 6)};
\draw[draw=lightgray] (12.01, 0.01) rectangle (17.99, 10.99);
+\node[align=center] at (15.010000,5.510000) {7\\(6 x 11)};
\draw[draw=brown] (13.01, 15.01) rectangle (19.99, 22.99);
+\node[align=center] at (16.510000,19.010000) {8\\(7 x 8)};
\draw[draw=olive] (0.01, 11.01) rectangle (6.99, 22.99);
+\node[align=center] at (3.510000,17.010000) {9\\(7 x 12)};
\draw[draw=orange] (2.01, 1.01) rectangle (11.99, 10.99);
+\node[align=center] at (7.010000,6.010000) {10\\(10 x 10)};
\draw[draw=pink] (20.01, 0.01) rectangle (29.99, 19.99);
+\node[align=center] at (25.010000,10.010000) {11\\(10 x 20)};
\end{tikzpicture}
\section*{Problem: Job scheduling}