### Circular arcs defined by an 'X' -- plain TeX (and TikZ)

Suresh Govindachar <sgovindachar <at> yahoo.com>

2014-03-16 22:52:45 GMT

%% Plain TeX file
\input tikz.tex
\usetikzlibrary{mindmap,intersections,arrows,angles}
\usetikzlibrary{quotes,calc,decorations.pathmorphing}
\usetikzlibrary{backgrounds,positioning,fit,petri}
\baselineskip=12pt
\hsize=6.5truein
\vsize=9.0truein
\parskip 6pt
% Here's the question on
% "Circular arcs defined by an 'X' -- plain TeX (and TikZ)":
Consider three points P, Q, and F, with F being below the line
joining P and Q. So the two lines PF and QF would form a distorted
`V', and extending these two lines would result in a distorted `X'.
Introduce 5 points into the shorter of the two segments PF and QF,
so that this shorter segment is divided into six equal sub-segments.
Need to use these 5 points to draw circular arcs in {\bf TikZ} and
{\bf plain \TeX} ({\bf not} latex).
I can illustrate what needs to be done for the special case of P, Q
and F being (-3, 0), (3, 0), and (0, -3*sqrt(3)).
Would like pointers to extending this to the general case.
\vskip 0.5in
\noindent
\tikzpicture
% Input: 3 noncollinear points P, Q, and F, with F below PQ
\coordinate [label=above:$\bf P$] (P) at (-3, 0);
\coordinate [label=above:$\bf Q$] (Q) at ( 3, 0);
\coordinate [label=right:$\bf F$] (F) at ( 0, -5.196);
% All of the following need to be derived
% P' is on PF extended so that F is the mid-point of PFP'
\coordinate (Pp) at ( 3, -10.392); % Pp is P-prime or P'
% Q' is on QF extended so that F is the mid-point of Q'FQ
\coordinate (Qp) at (-3, -10.392);
\draw [ultra thick] (P) -- (F);
\draw [ultra thick] (Q) -- (F);
\draw [dashed] (F) -- (Pp);
\draw [dashed] (F) -- (Qp);
% The various angles in the code below such as 30 and the
% various start-angles are for the specific values of
% the input P, Q, and F.
% foreach of 5 equi-spaced points on the smaller of PF or QF
\foreach \s in {1,2,...,5}
{
\coordinate (left) at ({-(6-\s)*sin(30)}, {-\s*cos(30)});
\coordinate (right) at ({ (6-\s)*sin(30)}, {-\s*cos(30)});
% the start and end angles below are chosen so that the
% arc is inside the `V` formed by PFQ
\draw [ultra thick]
let \p1 = ($ (F) - (left) $),
\n1 = {veclen(\x1, \y1)}
in
(left)
arc [start angle=120, end angle=60, radius=\n1];
% For general P, Q, and F, the delta-angles below could be
% anything that makes the picture look OK.
\draw [dashed]
(left)
arc [start angle=-60, delta angle=-60, radius=\s];
\draw [dashed]
(right)
arc [start angle=-120, delta angle=60, radius=\s];
}
\draw [dashed]
let \p1 = ($ (P) - (F) $),
\n1 = {veclen(\x1, \y1)}
in
(F)
arc [start angle=-60, delta angle=-60, radius=\n1];
\draw [dashed]
let \p1 = ($ (Q) - (F) $),
\n1 = {veclen(\x1, \y1)}
in
(F)
arc [start angle=-120, delta angle=60, radius=\n1];
\def\sa{ atan( ((-~~6~~-\s)*1.732/2)/(3-\s/2) ) }
\def\ea{ 120 }
% foreach of 5 equi-spaced points on the smaller of FP' or FQ'
\foreach \s in {1,2,...,5}
{
\coordinate (left) at ({-(\s)*sin(30)}, {-(6+\s)*cos(30)});
\coordinate (right) at ({ (\s)*sin(30)}, {-(6+\s)*cos(30)});
\draw [very thick]
let \p1 = ($ (F) - (left) $),
\n1 = {veclen(\x1, \y1)}
in
(left)
arc [start angle=-120, end angle=-60, radius=\n1];
\draw [dashed]
let \p1 = ($ (P) - (left) $),
\n1 = {veclen(\x1, \y1)}
in
(left)
arc [start angle={\sa}, delta angle={-\ea - \sa},
radius=\n1];
\draw [dashed]
let \p1 = ($ (Q) - (left) $),
\n1 = {veclen(\x1, \y1)}
in
(right)
arc [start angle={-~~180~~-\sa}, delta angle={\ea + \sa},
radius=\n1];
}
\endtikzpicture
\bye

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech

_______________________________________________
pgf-users mailing list
pgf-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgf-users