%% sphere.ldf
%% * (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, 2012, 2013, 2014 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
%% Sphere.
beginfig(1);
circle c[];
division_value := 64;
one_quarter_division_value := 1/4division_value;
three_quarters_division_value := 3/4division_value;
set c0 with_point_count division_value;
scale c0 (8, 0, 8);
rotate c0 by 90;
point p;
path q[];
q[division_value] += get_point 0 c0;
pen thick_pen;
thick_pen := pencircle scaled (2.5, 2.5, 2.5);
pickup thick_pen;
step_value := 360 / division_value;
j := 1;
for i = 0 step step_value until 360 - step_value:
rotate c0 (0, step_value);
if (is_even j):
draw c0;
fi;
for k = 2 step 2 until one_quarter_division_value - 2:
q[k] += get_point (k) c0;
q[three_quarters_division_value + k]
+= get_point (three_quarters_division_value + k) c0;
endfor;
q[division_value] += get_point 0 c0;
j += 1;
endfor;
q[division_value] += cycle;
q[division_value] += ..;
draw q[division_value];
for i = 2 step 2 until one_quarter_division_value - 2:
q[i] += ..;
q[i] += cycle;
q[three_quarters_division_value + i] += ..;
q[three_quarters_division_value + i] += cycle;
draw q[i];
draw q[three_quarters_division_value + i];
endfor;
rotate current_picture (-45, -15);
endfig;
end;