%%%% sphrint_0.ldf
%%%% Created by Laurence D. Finston (LDF) Sun Oct 30 17:47:32 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 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 2 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
%%%% Kreuzbergring 41
%%%% D-37075 Goettingen
%%%% Germany
%%%% lfinsto1@gwdg.de
%%%% s246794@stud.uni-goettingen.de
verbatim_metapost "verbatimtex \magnification=\magstep5 etex";
focus f;
set f with_position (-1, 5, -20) with_direction (-1, 5, 10)
with_distance 20;
picture frame_picture;
picture axis_picture;
beginfig(0);
pickup pencircle scaled (1mm, 1mm);
axis_x_lft := 9;
axis_x_rt := 9.5;
axis_y_bot := 9;
axis_y_top := 7;
axis_z_front := 13;
axis_z_back := 500;
drawdblarrow (-axis_x_lft, 0) -- (axis_x_rt, 0);
label.bot("x", (axis_x_rt, -.1));
drawdblarrow (0, -axis_y_bot) -- (0, axis_y_top);
label.lft("y", (0, axis_y_top));
drawdblarrow (0, 0, -axis_z_front) -- (0, 0, axis_z_back);
label.lft("z", (0, 0, axis_z_back));
axis_picture := current_picture;
clear current_picture;
endfig;
beginfig(0);
h := 14;
v := 11;
draw ((-h, -v) -- (h, -v) -- (h, v) -- (-h, v) -- cycle)
shifted (1, -7);
%; % with_color white;
frame_picture := current_picture;
clear current_picture;
endfig;
sphere s;
set s with_center (0, -2.75, 0) with_radius 5 with_point_count 64 with_divisions 6;
rotate s (5, 5);
circle c;
rectangle r;
r := unit_rectangle scaled 15;
rotate r (5, 0, 5);
shift r by -.75;
for i = 1 upto 5:
beginfig(i);
output frame_picture with_projection parallel_x_y;
rotate r (5, 0, 5);
shift s (0, 1);
c := s intersection (plane) r;
filldraw c with_fill_color gray with_draw_color blue;
draw s;
draw r with_color red;
output current_picture with_focus f no_sort;
clear current_picture;
output axis_picture with_focus f;
endfig;
endfor;
%% *** (3) Added parser rule and function for finding the intersection
%% points of a `sphere' and a linear `path'.
pickup pencircle scaled (1mm, 1mm);
focus f;
set f with_position (-1, 5, -20) with_direction (-1, 5, 10)
with_distance 20;
beginfig(5);
drawdot origin;
path p;
p := (-6, -6) -- (10, 10);
rotate p (0, 75);
draw p with_color blue;
sphere s;
set s with_radius 6 with_divisions 10;
rotate s (15, 0, 15);
draw s;
bool_point_vector bpv;
bpv := s intersection_points p;
pickup pencircle scaled (.375cm, .375cm);
drawdot bpv0 with_color red;
drawdot bpv1 with_color red;
point i[];
i0 := bpv0;
i1 := bpv0;
shift i1 (1, 3);;
pickup pencircle scaled (.75mm, .75mm);
drawarrow i1 -- i0;
i2 := bpv1;
i3 := bpv1;
shift i3 (-1, -1);
drawarrow i3 -- i2;
label.rt("$i_0$", i1);
label.lft("$i_1$", i3);
endfig with_focus f no_sort;
verbatim_metapost "end";
end;