%%%% tngnts_1.ldf %%%% Created by Laurence D. Finston (LDF) Tue Feb 6 20:26:09 CET 2007 %% * (0) Copyright and License. %%%% This file is part of GNU 3DLDF, a package for three-dimensional drawing. %%%% Copyright (C) 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 %% *** (3) Tangents to a circle. %% Find the tangents to a circle from a given point, %% coplanar to the circle. %% LDF 2007.02.06. %% verbatim_metapost "verbatimtex \magnification=\magstep3 etex"; %% **** (4) focus f; set f with_position (-3, 15, -30) with_direction (-3, 15, 100) with_distance 15; picture save_picture; pickup pencircle scaled (.6mm, .6mm); %% **** (4) pen_width := .75mm; w := 60cm; h := 80cm; frame_w := w - .5pen_width; frame_h := h - .5pen_width; path frame; frame := origin -- (frame_w, 0) -- (frame_w, frame_h) -- (0, frame_h) -- cycle; shift frame (-.5frame_w, -.5frame_h); circle c; point C; point P; point S[]; point T[]; point Q[]; bool_point_vector bpv; point D[]; r := 5; D0 := (-1.5r, 0, 0); D1 := (1.5r, 0, 0); c := unit_circle scaled (r, 0, r) rotated (90, 0); C := get_center c; %% **** (4) beginfig(0); draw c; label.rt("$r$", (0, .5r)); P := C; d := r + i; shift P (0, d, 0); draw D0 -- D1 dashed evenly; dotlabel.top("$P = T$", P); dotlabel.bot("$C$", C); draw P -- C; draw (-5, r, 0) -- (5, r, 0); draw frame; endfig with_projection parallel_x_y with_factor .25; %% **** (4) for i = 1 step 1 until 30: beginfig(i); draw c; P := C; d := r + i; shift P (0, d, 0); draw D0 -- D1 dashed evenly; dotlabel.top("$P$", P); dotlabel.bot("$C$", C); draw P -- C; label.rt("$d$", (0, .5d)); beta := arcsind (r / d ); % % message "beta:"; % % show beta; S0 := C; point normal; normal := P shifted (0, 0, -1); rotate_around S0 (P, normal) beta; S1 := C; rotate_around S1 (P, normal) -beta; Q0 := 5 * unit_vector(S0 - P) shifted S0; Q1 := 5 * unit_vector(S1 - P) shifted S1; draw P -- Q0; draw P -- Q1; a := sqrt((d * d) - (r * r)); T0 := (a * unit_vector(Q0 - P)) shifted P; T1 := (a * unit_vector (Q1 - P)) shifted P; drawdot T0 withpen pencircle scaled (1mm, 1mm); label.lft("$T_0$", T0 shifted (-.25, 0)); draw C -- T0; label.llft("$r$", mediate(C, T0)); label.lrt("$r$", mediate(C, T1)); drawdot T1 withpen pencircle scaled (1mm, 1mm); label.rt("$T_1$", T1 shifted (.25, 0)); draw C -- T1; label.lft("$a$", mediate(T0, P)); label.rt("$a$", mediate(T1, P)); draw frame; endfig with_projection parallel_x_y with_factor .25; endfor; %% **** (4) beginfig(31); draw c; dotlabel.bot("$C$", C); P := C; d := r + 31; draw D0 -- D1 dashed evenly; drawarrow (-r, 0, 0) -- (-r, d, 0); drawarrow (r, 0, 0) -- (r, d, 0); label.lft("$d = \infty$", (-r, .5d, 0)); label.rt("$d = \infty$", (r, .5d, 0)); draw (-r, 0, 0) -- (r, 0, 0); label.bot("$r$", (-.5r, 0, 0)); label.bot("$r$", (.5r, 0, 0)); draw frame; endfig with_projection parallel_x_y with_factor .25; %% **** (4) verbatim_metapost "end"; end;