Package: asymptote Version: 2.15-2 Severity: normal Dear Maintainer, *** Please consider answering these questions, where appropriate ***
* What led up to the situation? I was trying to lay out nested pictures (the Asymptote type) on another picture. * What exactly did you do (or not do) that was effective (or ineffective)? The pictures are laid out, as can be seen from the resulting PDF. * What was the outcome of this action? The pictures are laid out, but their spacing is scaled incorrectly. * What outcome did you expect instead? By drawing a scaled unitsquare on the source picture, and again on the destination picture, their sizes aren't the same - they should be. I've created a project in SourceForge called pi-leaf that contains pi-leaf.asy. Search for "BUG" to see the places where I inserted the test unit-squares. I'll attach a copy for convenience. This may well turn out to be a misunderstanding on my part, a documentation problem or a documentation <-> implementation mismatch. -- System Information: Debian Release: 7.0 APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores) Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages asymptote depends on: ii dpkg 1.16.9 ii freeglut3 2.6.0-4 ii ghostscript 9.05~dfsg-6.3 ii imagemagick 8:6.7.7.10-5 ii install-info 4.13a.dfsg.1-10 ii libc6 2.17-0experimental2 ii libfftw3-3 3.3.2-3.1 ii libgc1c2 1:7.1-9.1 ii libgcc1 1:4.8-20130217-1 ii libgl1-mesa-glx [libgl1] 8.0.5-3 ii libglu1-mesa [libglu1] 8.0.5-3 ii libgsl0ldbl 1.15+dfsg.2-2 ii libncurses5 5.9-10 ii libreadline6 6.2+dfsg-0.1 ii libsigsegv2 2.9-4 ii libstdc++6 4.8-20130217-1 ii libtinfo5 5.9-10 ii python 2.7.3-4 ii python-imaging-tk 1.1.7-4 ii python-tk 2.7.3-1 ii tex-common 3.15 ii texlive-binaries [texlive-base-bin] 2012.20120628-4 ii texlive-latex-base 2012.20120611-5 ii texlive-pstricks 2012.20120611-2 ii zlib1g 1:1.2.7.dfsg-13 Versions of packages asymptote recommends: ii asymptote-doc 2.15-2 Versions of packages asymptote suggests: pn gv <none> pn xpdf <none> -- no debconf information
//////////////////////////////////////////////////////////////////////////////// // To generate the PDF, do // // asy -f pdf pi-leaf.asy // // See my problem below by searching for "BUG". //////////////////////////////////////////////////////////////////////////////// //defaultpen(AvantGarde(series="b") + fontsize(2.5)); ///defaultpen(Bookman(series="b") + fontsize(2.5)); ///defaultpen(Courier(series="b") + fontsize(2.5)); defaultpen(Helvetica(series="b") + fontsize(2.5)); //defaultpen(NewCenturySchoolBook(series="b") + fontsize(3)); //defaultpen(Palatino(series="b") + fontsize(3)); //defaultpen(TimesRoman(series="b") + fontsize(3)); //defaultpen(ZapfChancery(series="b") + fontsize(3)); import plain; import graph; import roundedpath; unitsize(1mm); // Define the bounds of the page. draw(scale(210,297)*unitsquare, invisible); path unitcircle=E..N..W..S..cycle; path pad_circle_outer = scale(0.8)*unitcircle; path pad_circle_inner = scale(0.9)*unitcircle; path pad_circle_paths[] = pad_circle_outer^^pad_circle_inner; void pcb_pad(picture f) { path inner = pad_circle_inner; path outer = pad_circle_outer; filldraw(f, pad_circle_paths,evenodd,black + linewidth(0.3)); } real Yoffs = 14.0; void col_label(picture f, int pin, string text, pen p = black) { pin -= 1; // 1-based to 0-based. bool left = (pin % 2 == 0); real x = 2.54*(left ? -0.5 : 0.5); real y = Yoffs - ((int)(pin / 2)) * 2.54; pair loc = (x, y); picture g; unitsize(g, 1mm, 1mm); pcb_pad(g); add(f, g, loc); loc += (2x, 0); text = "$" + text + "$"; if(left) label(f, text, loc, W, p, filltype=NoFill); else label(f, text, loc, E, p, filltype=NoFill); //draw(f, shift(0, y) * scale(2.54,2.54) * shift(-0.5, -1) * unitsquare); } pen DarkOrange = rgb("EE330A"); pen DarkGreen = rgb("11AA11"); pen DarkBlue = rgb("1111AA"); real LeafStepX = 2.54 * 17.0; real LeafStepY = 2.54 * 13.0; //write(stdout, suffix=endl, "LeafStepX : ", LeafStepX); //write(stdout, suffix=endl, "LeafStepY : ", LeafStepY); picture v1_cols, v2_cols, page1, page2; unitsize(v1_cols, 1mm, 1mm); unitsize(v2_cols, 1mm, 1mm); unitsize(page1, 1mm, 1mm); unitsize(page2, 1mm, 1mm); int Nrows = 2, Ncols = 9; void draw_v1_leaf(picture f) { draw(f, roundedpath(scale(31, 40) * shift(-0.5, -0.5) * unitsquare, 5)); label(f, "v1", (0,Yoffs + 0.5), N, p=Palatino(series="b")+fontsize(3.5)); col_label(f, 1, "$3.3V$", DarkOrange); col_label(f, 3, "$0 SDA$"); col_label(f, 5, "$1 SCL$"); col_label(f, 7, "$4$"); col_label(f, 9, "$GND$", DarkBlue); col_label(f, 11, "$17$"); col_label(f, 13, "$21$"); col_label(f, 15, "$22$"); col_label(f, 17, "$3.3V$", DarkOrange); col_label(f, 19, "$10 MOSI$"); col_label(f, 21, "$9 MISO$"); col_label(f, 23, "$11 SCKL$"); col_label(f, 25, "$GND$", DarkBlue); col_label(f, 2, "$5V$", heavyred); col_label(f, 4, "$5V$", heavyred); col_label(f, 6, "$GND$", DarkBlue); col_label(f, 8, "$14 TXD$"); col_label(f, 10, "$15 RXD$", DarkGreen); col_label(f, 12, "$18$"); col_label(f, 14, "$GND$", DarkBlue); col_label(f, 16, "$23$"); col_label(f, 18, "$24$"); col_label(f, 20, "$GND$", DarkBlue); col_label(f, 22, "$25$"); col_label(f, 24, "$8$"); col_label(f, 26, "$7$"); } void draw_v2_leaf(picture f) { draw(f, roundedpath(shift(0, 5) * scale(31, 40) * shift(-0.5, -0.5) * unitsquare, 5)); label(f, "v2", (0,Yoffs + 0.5), N, p=Palatino(series="b")+fontsize(3.5)); col_label(f, 1, "$3.3v$", DarkOrange); col_label(f, 3, "$2 SDA$"); col_label(f, 5, "$3 SCL$"); col_label(f, 7, "$4$"); col_label(f, 9, "$GND$", DarkBlue); col_label(f, 11, "$17$"); col_label(f, 13, "$27$"); col_label(f, 15, "$22$"); col_label(f, 17, "$3.3v$", DarkOrange); col_label(f, 19, "$10 MOSI$"); col_label(f, 21, "$9 MISO$"); col_label(f, 23, "$11 SCKL$"); col_label(f, 25, "$GND$", DarkBlue); col_label(f, 2, "$5v$", heavyred); col_label(f, 4, "$5v$", heavyred); col_label(f, 6, "$GND$", DarkBlue); col_label(f, 8, "$14 TXD$", DarkGreen); col_label(f, 10, "$15 RXD$", DarkGreen); col_label(f, 12, "$18$"); col_label(f, 14, "$GND$", DarkBlue); col_label(f, 16, "$23$"); col_label(f, 18, "$24$"); col_label(f, 20, "$GND$", DarkBlue); col_label(f, 22, "$25$"); col_label(f, 24, "$8$"); col_label(f, 26, "$7$"); } path BoundingRect = scale(LeafStepX, LeafStepY) * shift(-0.5, -0.5) * unitsquare; void draw_v1_cols() { picture v1_leaf, f; unitsize(v1_leaf, 1mm, 1mm); unitsize(f, 1mm, 1mm); draw_v1_leaf(f); size(v1_leaf, LeafStepX, LeafStepY); add(v1_leaf, f); // BUG: the following rectangle neatly encloses the leaf (for debugging) //draw(v1_leaf, BoundingRect, DarkBlue); real x1, y1; for(x1 = 0; x1 < 2; ++x1) for(y1 = 0; y1 < 9; ++y1) { pair loc = (LeafStepX/2.0 + x1*LeafStepX, LeafStepY/2.0 + y1*LeafStepY); add(v1_cols, v1_leaf, loc); // BUG: but this should be the same size, but it's a lot bigger! //draw(v1_cols, shift(loc) * BoundingRect, DarkBlue); } draw(v1_cols, scale(2*LeafStepX, 9*LeafStepY) * unitsquare, red); } void draw_v2_cols() { picture v2_leaf, f; unitsize(v2_leaf, 1mm, 1mm); unitsize(f, 1mm, 1mm); draw_v2_leaf(f); add(v2_leaf, rotate(90)*f); draw(v2_leaf, scale(LeafStepX, LeafStepY) * shift(-0.5, -0.5) * unitsquare, DarkBlue); real x, y; for(x = 0; x < 2; ++x) for(y = 0; y < 9; ++y) add(v2_cols, v2_leaf, (x*LeafStepX, y*LeafStepY)); draw(v2_cols, scale(2*LeafStepX, 9*LeafStepY) * unitsquare, green); } void draw_page1() { add(page1, v1_cols); //add(page1, shift(LeafStepX*2, 0) * v2_cols); } void draw_page2() { add(page2, rotate(180) * v2_cols); add(page2, shift(LeafStepX*2, 0) * rotate(180) * v1_cols); } draw_v1_cols(); draw_v2_cols(); draw_page1(); draw_page2(); add(shift(10, 10) * page1); //add(shift(10 + LeafStepX, 4.5*LeafStepY + 10) * page2); draw(shift(10, 10) * scale(190, 277) * unitsquare);