%%%% prbla_01.ldf %%%% Created by Laurence D. Finston (LDF) Thu Nov 10 15:27:39 CET 2005 %% * (1) Copyright and License. %%%% This file is part of GNU 3DLDF, a package for three-dimensional drawing. %%%% Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 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 the maintainer of %%%% GNU 3DLDF to send 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 The Free Software Foundation, Inc. %%%% 51 Franklin St, Fifth Floor %%%% Boston, MA 02110-1301 %%%% USA %%%% Laurence.Finston@gmx.de %% Run these commands: %% 3dldf prbla_01.ldf %% mpost prbla_01 %% tex prbla_01.txt %% dvips -o prbla_01.ps prbla_01.dvi %% gv prbla_01.ps & verbatim_metapost "ahlength := .25cm;"; verbatim_metapost "verbatimtex \magnification=\magstep5 \font\large=cmr12 etex"; verbatim_metapost "verbatimtex \font\Large=cmr17 etex"; focus f; set f with_position (0, 10, -20) with_direction (0, 10, 100) with_distance 15; picture axis_picture; picture save_picture; %% **** (4) axis_picture. beginfig(0); pickup blue; pickup pencircle scaled (1mm, 1mm); axis_x_lft := 10; axis_x_rt := 10; axis_y_bot := 10; axis_y_top := 10; axis_z_front := 10; axis_z_back := 10; %drawarrow origin -- (-axis_x_lft, 0) with_color blue; drawarrow origin -- (axis_x_rt, 0) with_color blue; label.bot("x", (axis_x_rt, 0, -.1)); %drawarrow origin -- (0, -axis_y_bot) with_color blue; drawarrow origin -- (0, axis_y_top) with_color blue; label.lft("y", (0, axis_y_top)); %drawarrow origin -- (0, 0, -axis_z_front) with_color blue; %drawarrow origin -- (0, 0, axis_z_back) with_color blue; %label.lft("z", (0, 0, axis_z_back)); axis_picture := current_picture; clear current_picture; endfig; color_vector cv; cv += red; cv += green; cv += blue; cv += cyan; cv += yellow; cv += magenta; beginfig(1); parabola p; path q[]; set p with_parameter 3 % with_vertex vertex % with_focus p_focus with_extent 7cm; draw p; % with_color cv0; p_last := size p - 1; for j = 0 upto 6: q[j] += get_point (j * 3) p; q[10 + j] += get_point (p_last - (j * 3)) p; endfor; %dotlabel.top(0, p); for i = 1 upto 23: rotate p by 7.5; for j = 0 upto 6: q[j] += get_point (j * 3) p; q[10 + j] += get_point (p_last - (j * 3)) p; endfor; if is_even i: draw p ;% with_color cv[i]; fi; endfor; for j = 0 upto 6: q[20 + j] := q[j] .. q[10 + j]; clear_connectors q[20 + j]; q[20 + j] += ..; q[20 + j] += cycle; draw q[20 + j]; endfor; %dotlabel.lft(0, p); save_picture := current_picture; %output axis_picture with_focus f; output current_picture with_focus f; clear current_picture; if false: verbatim_metapost "verbatimtex \setbox0=\hbox{parabola:\space} etex"; verbatim_metapost "verbatimtex \setbox1=\hbox{focus:\space} etex"; y_value := -11; shift_value := -1; label.rt("{\large Perspective Projection}", (0, y_value)); y_value -= .5; y_value += shift_value; label.rt("\copy0", (0, y_value)); y_value += shift_value; label.rt("\hskip\wd0 vertex at origin", (0, y_value)); y_value += shift_value; label.rt("\hskip\wd0 parameter $=$ 3cm", (0, y_value)); y_value += shift_value; label.rt("\hskip\wd0 axis $=$ positive x-axis", (0, y_value)); y_value -= .5; y_value += shift_value; label.rt("\copy1", (0, y_value)); y_value += shift_value; label.rt("\hskip\wd1 position: (0, 10, -20)", (0, y_value)); y_value += shift_value; label.rt("\hskip\wd1 direction: (0, 10, 100)", (0, y_value)); y_value += shift_value; label.rt("\hskip\wd1 distance: 10", (0, y_value)); y_value += shift_value; fi; endfig with_projection parallel_x_y; beginfig(2); output save_picture with_projection parallel_x_y; if false: label.rt("{\large Parallel Projection, X-Y Plane}", (0, -8)); fi; endfig with_projection parallel_x_y; beginfig(3); output save_picture with_projection parallel_x_z; if false: label.rt("{\large Parallel Projection, X-Z Plane}", (0, -8)); fi; endfig with_projection parallel_x_y; beginfig(4); output save_picture with_projection parallel_z_y; if false: label("{\large Parallel Projection, Z-Y Plane}", (0, -8)); fi; endfig with_projection parallel_x_y; verbatim_metapost "end"; end;