%% rectangle_templates.ldf
%% Created by Laurence D. Finston (LDF) Sun 14 Aug 2022 09:59:46 AM CEST
%% * (1) Copyright and License.
%%%% This file is part of GNU 3DLDF, a package for three-dimensional drawing.
%%%% Copyright (C) 2022, 2023 The Free Software Foundation, Inc.
%%%% GNU 3DLDF is free software; you can redistribute it and/or modify
%%%% it under the terms of the GNU General Public License as published by
%%%% the Free Software Foundation; either version 3 of the License, or
%%%% (at your option) any later version.
%%%% GNU 3DLDF is distributed in the hope that it will be useful,
%%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
%%%% GNU General Public License for more details.
%%%% You should have received a copy of the GNU General Public License
%%%% along with GNU 3DLDF; if not, write to the Free Software
%%%% Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
%%%% GNU 3DLDF is a GNU package.
%%%% It is part of the GNU Project of the
%%%% Free Software Foundation
%%%% and is published under the GNU General Public License.
%%%% See the website http://www.gnu.org
%%%% for more information.
%%%% GNU 3DLDF is available for downloading from
%%%% http://www.gnu.org/software/3dldf/LDF.html.
%%%% Please send bug reports to Laurence.Finston@gmx.de
%%%% The mailing list help-3dldf@gnu.org is available for people to
%%%% ask other users for help.
%%%% The mailing list info-3dldf@gnu.org is for sending
%%%% announcements to users. To subscribe to these mailing lists, send an
%%%% email with ``subscribe '' as the subject.
%%%% The author can be contacted at:
%%%% Laurence D. Finston
%%%% c/o Free Software Foundation, Inc.
%%%% 51 Franklin St, Fifth Floor
%%%% Boston, MA 02110-1301
%%%% USA
%%%% Laurence.Finston@gmx.de
%% * (1) Top
verbatim_metapost "prologues := 3;\noutputtemplate := \"%j%3c.eps\";";
input "plainldf.lmc";
%% * (1)
%% From sphrmd00.lmc
macro crosshair;
def crosshair {point aa, numeric offset, point bb, point cc} =
pen thin_pen;
thin_pen := pencircle scaled (.25mm, .25mm, .25mm);
transform tt;
point A[];
A0 := aa shifted (0, 0, 1);
A1 := (offset * unit_vector(cc - bb)) shifted by aa;
A2 := A1 rotated_around (aa, A0) 90;
A3 := A1 rotated_around (aa, A0) 180;
A4 := A1 rotated_around (aa, A0) 270;
draw A1 -- A3 with_pen pencircle scaled (.25mm, .25mm, .25mm) with_pen thin_pen;
draw A2 -- A4 with_pen pencircle scaled (.25mm, .25mm, .25mm) with_pen thin_pen;
enddef;
%% Example:
%% crosshair {mediate(P10, P11, i/(crosshair_ctr + 1)), .1cm, P10, P11};
%% * (1) Figures
pickup pencircle scaled (.333mm, .333mm, .333mm);
%% ** (2) Fig. 0. Dummy figure. Must exist for make rules. LDF 2022.08.14.
beginfig(0);
drawdot origin;
endfig with_projection parallel_x_y;
%% ** (2)
j := 1;
for k = 8 step .25 until 12:
for i = 8 step .25 until 10.25:
beginfig(j);
rectangle r[];
point p[];
string s;
r0 := unit_rectangle scaled (i, 0, k) rotated (90, 0);
shift r0 (-7cm, 0);
draw r0;
for i = 0 upto 3:
p[i] := get_point (i) r0;
endfor;
% dotlabel.urt("$p_0$", p0);
% dotlabel.ulft("$p_1$", p1);
% dotlabel.llft("$p_2$", p2);
% dotlabel.lrt("$p_3$", p3);
p4 := mediate(p0, p1);
s := "{\bf " & decimal i & "\Thinspace cm by " & decimal k & "\Thinspace cm}";
label.bot(s, p4 shifted (0, -2.25cm));
p5 := p3 shifted (-1cm, 1cm);
crosshair {p5, .75cm, p3, p0};
draw ((unit_rectangle scaled (.75, 0, .75))rotated (90, 0)) shifted by p5;
p6 := p2 shifted (1cm, 1cm);
crosshair {p6, .75cm, p2, p1};
draw ((unit_rectangle scaled (.75, 0, .75))rotated (90, 0)) shifted by p6;
p7 := p0 shifted (-1cm, -1cm);
crosshair {p7, .75cm, p0, p3};
draw ((unit_rectangle scaled (.75, 0, .75))rotated (90, 0)) shifted by p7;
p8 := p1 shifted (1cm, -1cm);
crosshair {p8, .75cm, p1, p2};
draw ((unit_rectangle scaled (.75, 0, .75))rotated (90, 0)) shifted by p8;
p9 := mediate(p0, p1);
p10 := mediate(p2, p3);
p11 := mediate(p1, p2);
p12 := mediate(p3, p0);
% dotlabel.top("$p_{9}$", p9);
% dotlabel.bot("$p_{10}$", p10);
% dotlabel.lft("$p_{11}$", p11);
% dotlabel.rt("$p_{12}$", p12);
p13 := p9 shifted (0, -1cm);
crosshair {p13, .75cm, p9, p10};
draw ((unit_rectangle scaled (.75, 0, .75))rotated (90, 0)) shifted by p13;
p14 := p10 shifted (0, 1cm);
crosshair {p14, .75cm, p10, p9};
draw ((unit_rectangle scaled (.75, 0, .75))rotated (90, 0)) shifted by p14;
p17 := p11 shifted (1cm, 0);
crosshair {p17, .75cm, p11, p12};
draw ((unit_rectangle scaled (.75, 0, .75))rotated (90, 0)) shifted by p17;
p18 := p12 shifted (-1cm, 0);
crosshair {p18, .75cm, p11, p12};
draw ((unit_rectangle scaled (.75, 0, .75))rotated (90, 0)) shifted by p18;
p15 := get_center r0;
r1 := unit_rectangle scaled (i+4.5, 0, k+6) rotated (90, 0);
p16 := get_center r1;
shift r1 by (p15 - p16);
draw r1;
j += 1;
endfig with_projection parallel_x_y;
endfor;
endfor;
end_mp;
end;
%% * (1)
%% * (1) End of 3DLDF code.
%% * (1) Emacs-Lisp code for use in indirect buffers when using the
%% GNU Emacs editor. The local variable list is not evaluated when an
%% indirect buffer is visited, so it's necessary to evaluate the
%% following s-expression in order to use the facilities normally
%% accessed via the local variables list.
%% \initials{LDF 2004.02.12}.
%% (progn (metapost-mode) (outline-minor-mode t) (setq fill-column 80))
%% * (1) Local variables for Emacs.
%% Local Variables:
%% mode:metapost
%% eval:(outline-minor-mode t)
%% eval:(read-abbrev-file abbrev-file-name)
%% outline-regexp:"%% [*\f]+"
%% End: