%%%% cones01.ldf %%%% Created by Laurence D. Finston (LDF) Thu Nov 9 21:35:51 CET 2006 %%%% Modified LDF 2006.11.11. %% * (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 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. %%%% It is also available from %%%% http://www.dante.de/software/ctan/, the Dante www-server %%%% and from http://wwwuser.gwdg.de/~lfinsto1, %%%% the author's website. %%%% Please send bug reports to lfinsto1@gwdg.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 %%%% lfinsto1@gwdg.de %%%% s246794@stud.uni-goettingen.de %% *** (3) Cones. %% The shadow of a double-napped cone. %% LDF 2006.11.09. verbatim_metapost "verbatimtex \magnification=\magstep3 etex"; focus f; set f with_position (-3, 15, -30) with_direction (-3, 15, 100) with_distance 15; picture save_picture; pickup pencircle scaled (.75mm, .75mm); %% **** (4) beginfig(1); %% ***** (5) cone c; y_value := 12; set c with_type circular with_type double_napped with_radius 10 with_axis_y y_value with_point_count 32 with_divisions 6; shift c(10, 0, 20); rectangle r; r := unit_rectangle scaled (100, 0, 100); shift r (0, 0, 20); %% ***** (5) point p; p := (1, 0, 0); rotate p(0, 0, 32); rotate p(0, 25); p *= -1; %% ***** (5) point q[]; path s[]; path proj[]; bool_point_vector bpv; point apex[]; apex0 := get_apex c; q0 := apex0; q0 += p * 10; s0 := apex0 -- q0; bpv := s0 intersection_points r; q2 := bpv0; q3 := bpv1; if not is_invalid q2: apex1 := q2; else: if not is_invalid q3: apex1 := q3; fi; fi; path cap; path base; cap := get_cap c; base := get_base c; for i = 0 upto 31: q0 := get_point (i) cap; q4 := get_point (i) base; q1 := q0 + (p * 10); s0 := q0 -- q1; bpv := s0 intersection_points r; q2 := bpv0; q3 := bpv1; if not is_invalid q2: proj0 += q2; draw q4 -- apex1 -- q2; fi; if not is_invalid q3: proj0 += q3; draw q4 -- apex1 -- q3; fi; endfor; proj0 += ..; proj0 += cycle; draw proj0; draw c; %draw r; %label("point light source: angle $25^\circ$, elevation $32^\circ$", (5, 0, 0)); save_picture := current_picture; endfig with_focus f no_sort; beginfig(2); output save_picture with_projection parallel_x_z; endfig; verbatim_metapost "end"; end;