%%%% fctcn01.ldf %%%% Created by Laurence D. Finston (LDF) Tue Oct 27 17:14:40 CET 2009 %%%% $Id: fctcn01.ldf,v 1.5 2010/12/17 14:47:41 lfinsto1 Exp $ %% * (1) Copyright and License. %%%% This file is part of GNU 3DLDF, a package for three-dimensional drawing. %%%% Copyright (C) 2009, 2010, 2011 The Free Software Foundation %%%% 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 %% Last updated: October 20, 2009 %% Run like this: %% 3dldf fctcn01.ldf %% mpost fctcn01.mp %% tex fctcn01.txt %% dvips -o fctcn01.ps fctcn01.dvi %% ps2pdf fctcn01.ps %% All on one line: if false: 3dldf fctcn01.ldf && mpost fctcn01.mp && tex fctcn01.txt && \ dvips -o fctcn01.ps fctcn01.dvi \ && ps2pdf fctcn01.ps fi; %% View the PostScript file using Ghostview like this: %% gv fctcn01.ps & %% or with GNU Ghostview like this: %% ggv fctcn01.ps & %% View the PDF file with Acrobat Reader like this: %% acroread fctcn01.pdf & %% * (1) Beginning of 3DLDF code. %% ** (2) Plans for a paper model of a facetted cone (Facetted Cone 1) %% *** (3) Declarations and initializations picture v[]; focus f[]; set f0 with_position (0, 30, -100) with_direction (0, 30, 10) with_distance 50; circle c[]; point p[]; path q[]; bool b; bool_point_vector bpv; h := 10; % 30 point n[]; %% Normals pen dot_pen; dot_pen := pencircle scaled (.75mm, .75mm, .75mm); transform t[]; string s; %% *** (3) Figure 0 beginfig(0); %% **** (4) outer_diam := 10; %% 20 inner_diam := 8; %% 15; c0 := unit_circle scaled (outer_diam, 0, outer_diam); c1 := unit_circle scaled (inner_diam, 0, inner_diam); draw c0; draw c1; %% **** (4) j := 2; for i := 0 step 4 until 28: p[j] := get_point (i) c0; drawdot p[j] with_pen pencircle scaled (1.5mm, 1.5mm, 1.5mm); j += 1; endfor; %dotlabel.lft(7, p7); %dotlabel.lft(8, p8); p0 := get_center c0; p1 := p0 shifted (0, h); %dotlabel.bot(0, p0); %dotlabel.top(1, p1); p10 := mediate(p7, p8); %dotlabel.top(10, p10); bpv := (p0 -- p10) intersection_points c0; %show bpv; p11 := bpv[0]; %dotlabel.lft(11, p11); bpv := (p0 -- p10) intersection_points c1; p12 := bpv[0]; %dotlabel.rt(12, p12); draw p0 -- p1 -- p7 -- p12 -- p1 -- p8 -- p12; %% **** (4) Paths. q0 := p12 -- p7 -- p1 -- cycle; triangle w[]; set w0 with_points (p12, p7, p1); p13 := get_center w0; n0 := (get_normal w0) shifted p13; %dotlabel.rt(13, p13); %message "n0:"; %show n0; label.top("$n_0$", n0); drawarrow p13 -- n0; v0 := current_picture; %% **** (4) End of figure 0 endfig with_focus f0; %% *** (3) Figure 1 --- Base circles beginfig(1); draw c0; draw c1 dashed evenly; c3 := unit_circle scaled (.25, 0, .25); draw c3 with_color red; drawdot origin with_pen dot_pen; j := 2; for i = 0 step 4 until 28: a := 40 + j; p[a] := p[j] rotated (0, 22.5); draw origin -- p[40 + j] dashed evenly; draw origin -- p[j] dashed evenly; s := "$p_{" & decimal j & "}$"; %dotlabel.top(s, p[j]); s := "$p_{" & decimal a & "}$"; %dotlabel.top(s, p[a]); j += 1; % message "a:"; % show a; % message "j:"; % show j; endfor; unfilldraw c3; draw (-.25, 0) -- (.25, 0); draw (0, 0, -.25) -- (0, 0, .25); p60 := get_point 0 c1; %dotlabel.top("$p_{60}$", p60); for i = 1 upto 15: a := 60 + i; p[a] := p60 rotated (0, i * 22.5); s := "$p_{" & decimal a & "}$"; %dotlabel.top(s, p[a]); endfor; %% **** (4) q3 := p2 -- p61 -- p3 -- p63 -- p4 -- p65 -- p5 -- p67 -- p6 -- p69 -- p7 -- p71 -- p8 -- p73 -- p9 -- p75 -- p2; draw q3; %% **** (4) Tabs %% ***** (5) First tab p80 := mediate(p5, p65, .2); p81 := mediate(p65, p5, .2); %dotlabel.top("$p_{80}$", p80); %dotlabel.top("$p_{81}$", p81); p82 := p80 shifted (0, 1); p83 := (unit_vector(p81 - p80) scaled .5 shifted p80) rotated_around (p80, p82) -60; %dotlabel.top("$p_{83}$", p83); p84 := p81 shifted (0, 1); p85 := (unit_vector(p80 - p81) scaled .5 shifted p81) rotated_around (p81, p84) 60; %dotlabel.top("$p_{85}$", p85); q4 := p80 -- p83 -- p85 -- p81; draw q4; p86 := mediate(p80, p83); p87 := mediate(p81, p85); %dotlabel.lft("$p_{86}$", p86); %dotlabel.rt("$p_{87}$", p87); draw p86 -- p87 dashed evenly; for i = 1 upto 4: drawdot mediate(p86, p87, i/5) with_pen dot_pen; endfor; %% ***** (5) t2 := identity rotated_around (origin, p5) 180; q5 := q4; p88 := p86; p89 := p87; q5 *= p88 *= p89 *= t2; draw q5; for i = 1 upto 4: drawdot mediate(p88, p89, i/5) with_pen dot_pen; endfor; t3 := identity rotated (0, 45); for i := 1 upto 7: q4 *= q5 *= p86 *= p87 *= p88 *= p89 *= t3; draw q4; draw q5; draw p86 -- p87 dashed evenly; draw p88 -- p89 dashed evenly; for j = 1 upto 4: drawdot mediate(p86, p87, j/5) with_pen dot_pen; drawdot mediate(p88, p89, j/5) with_pen dot_pen; endfor; endfor; %% **** (4) End of figure 1 endfig with_projection parallel_x_z with_factor .5 no_sort; %% *** (3) %% *** (3) Figure 2 beginfig(2); p14 := p13; n1 := n0; t0 := align (p13 -- n0) with_axis y_axis; rotate t0 (180, 0); w1 := w0; w1 *= p14 *= n1 *= t0; %draw w1 dashed evenly; %dotlabel.lft($p_{14}$, p14); %dotlabel.rt("$n_1$", n1); %message "n1:"; %show n1; %message "p14:"; %show p14; for i = 0 upto 2: p[15 + i] := get_point (i) w1; a := 15 + i; s := "$p_{" & decimal a & "}$"; endfor; %dotlabel.rt("$p_{15}$", p15); %dotlabel.lft("$p_{16}$", p16); %label.rt("$p_{17}$", p17); % message "magnitude (p1 - p7):"; % show magnitude (p1 - p7); % message "magnitude (p1 - p12):"; % show magnitude (p1 - p12); % message "magnitude (p7 - p12):"; % show magnitude (p7 - p12); % message "magnitude (p17 - p15):"; % show magnitude (p17 - p15); % message "magnitude (p17 - p16):"; % show magnitude (p17 - p16); % message "magnitude (p15 - p16):"; % show magnitude (p15 - p16); % magnitude (p1 - p7): % >> 36.0555 % magnitude (p17 - p16): % >> 36.0555 % magnitude (p17 - p15): % >> 33.541 % magnitude (p1 - p12): % >> 33.541 % magnitude (p7 - p12): % >> 8.40668 % magnitude (p15 - p16): % >> 8.40668 %% **** (4) Second triangle p20 := p16; t1 := identity rotated_around (p15, p17) 180; %show t1; w1 *= p20 *= t1; %draw w1 dashed evenly; %dotlabel.top("$p_{20}$", p20); %% **** (4) Third triangle p21 := p15; t1 := identity rotated_around (p20, p17) 180; w1 *= p21 *= t1; %draw w1 dashed evenly; %dotlabel.top("$p_{21}$", p21); %% **** (4) The remaining 13 triangles for i = 22 upto 34: s := "$p_{" & decimal i & "}$"; p[i] := p[i-2]; t1 := identity rotated_around (p[i-1], p17) 180; w1 *= p[i] *= t1; % draw w1 dashed evenly; %dotlabel.top(s, p[i]); endfor; %% **** (4) Clear out the the lines surrounding p17 c2 := unit_circle scaled (.375, 0, .375) shifted p17; draw c2 dashed evenly; a := 35; for_suffixes i := 16, 15: bpv := (p[i] -- p17) intersection_points c2; b := bpv0; if b: p[a] := bpv0; else: p[a] := bpv1; fi; %s := "$p_{" & decimal a & "}$"; %dotlabel.top(s, p[a]); %drawdot p[a] with_pen dot_pen; a += 1; endfor; draw p36 -- p15 dashed evenly; for i := 20 upto 34: bpv := (p[i] -- p17) intersection_points c2; b := bpv0; if b: p[a] := bpv0; else: p[a] := bpv1; fi; %s := "$p_{" & decimal a & "}$"; %dotlabel.top(s, p35); %drawdot p[a] with_pen dot_pen; draw p[a] -- p[i] dashed evenly; % message "i:"; % show i; % message "a:"; % show a; a += 1; endfor; draw p17 -- p38; draw p17 -- p40; draw p17 -- p43; draw p17 -- p48; q1 += --; q1 += p17; q1 += p16; q1 += p15; for i := 20 upto 34: q1 += p[i]; endfor; q1 += p17; draw q1; %% **** (4) Tabs on short sides %% ***** (5) First tab on short side p90 := mediate(p15, p16, .2); p91 := mediate(p16, p15, .2); %dotlabel.top("$p_{90}$", p90); %dotlabel.top("$p_{91}$", p91); p92 := p90 shifted (0, 1); p93 := (unit_vector(p91 - p90) scaled .5 shifted p90) rotated_around (p90, p92) 60; %dotlabel.lrt("$p_{93}$", p93); p94 := p91 shifted (0, 1); p95 := (unit_vector(p90 - p91) scaled .5 shifted p91) rotated_around (p91, p94) -60; %dotlabel.llft("$p_{95}$", p95); q6 := p90 -- p93 -- p95 -- p91; draw q6; p96 := mediate(p90, p93); p97 := mediate(p91, p95); %dotlabel.rt("$p_{96}$", p96); %dotlabel.lft("$p_{97}$", p97); draw p96 -- p97 dashed evenly; for i = 1 upto 4: drawdot mediate(p96, p97, i/5) with_pen dot_pen; endfor; %% ***** (5) Second tab on short side t4 := identity rotated_around (p15, p17) 180; p90 *= p91 *= p93 *= p95 *= p96 *= p97 *= q6 *= t4; draw q6; draw p96 -- p97 dashed evenly; for i = 1 upto 4: drawdot mediate(p96, p97, i/5) with_pen dot_pen; endfor; %% ***** (5) Remaining tabs on short sides for j := 20 upto 33: t4 := identity rotated_around (p[j], p17) 180; p90 *= p91 *= p93 *= p95 *= p96 *= p97 *= q6 *= t4; draw q6; draw p96 -- p97 dashed evenly; for i = 1 upto 4: drawdot mediate(p96, p97, i/5) with_pen dot_pen; endfor; endfor; %% **** (4) Tabs on long sides %% ***** (5) Inner tab on p16 -- p17 p100 := unit_vector (p17 - p16) shifted p16; p101 := (unit_vector (p16 - p17) scaled 2.5) shifted p17; % dotlabel.lft("$p_{100}$", p100); % dotlabel.lft("$p_{101}$", p101); p102 := p101 shifted (0, 1); p103 := ((unit_vector (p16 - p17) scaled .5) shifted p101) rotated_around (p101, p102) 60; %dotlabel.rt("$p_{103}$", p103); p104 := p100 shifted (0, 1); p105 := ((unit_vector (p17 - p16) scaled .5) shifted p100) rotated_around (p100, p104) -60; %dotlabel.rt("$p_{105}$", p105); draw p100 -- p105 -- p103 -- p101; p106 := mediate(p100, p105); %dotlabel.bot("$p_{106}$", p106); p107 := mediate(p101, p103); %dotlabel.urt("$p_{107}$", p107); draw p106 -- p107 dashed evenly; for i := 1 upto 15: drawdot mediate(p106, p107, i/16) with_pen dot_pen; endfor; %% ***** (5) Outer tab on p34 -- p17 a := (p34 - p17) angle (p16 - p17); p108 := p17 shifted (0, 1); t5 := identity rotated_around (p17, p108) -a; p100 *= p101 *= p103 *= p105 *= p106 *= p107 *= t5; draw p100 -- p105 -- p103 -- p101; draw p106 -- p107 dashed evenly; for i := 1 upto 15: drawdot mediate(p106, p107, i/16) with_pen dot_pen; endfor; %% **** (4) End of figure 2 rotate current_picture (0, -90); endfig with_projection parallel_x_z with_factor .5 no_sort; %% *** (3) End of 3DLDF code verbatim_metapost "end;"; end; %% ** (2) %% * (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 (metafont-mode) (outline-minor-mode t) (setq fill-column 80) (ignore '( %% )) (setq outline-regexp "%% [*\f]+")) %% * (1) Local variables for Emacs. %% Local Variables: %% mode:Metafont %% eval:(outline-minor-mode t) %% eval:(read-abbrev-file abbrev-file-name) %% outline-regexp:"%% [*\f]+" %% End: