考虑以下 tikz 图片。我需要放置线段 re-D,以便其尺寸为线段 ut-C 尺寸的 8/9。现在我将其放置在 ut 和 ut' 之间 8/9 的随机距离处。我应该使用什么函数(相交?正弦,余弦?)以及如何为 tikz 写下它?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=2]
\coordinate (o) at (0,0);
\coordinate [label=below:ut] (ut) at (2,0);
\coordinate [label=below:ut'] (ut') at (4,0);
\coordinate [label=above:C] (C) at (2, 2.4);
\coordinate [label=above:c] (c) at (4, 1.2);
\coordinate (O) at ($ (c)!2!(C) $);
\draw (ut) -- (ut');
\draw (ut) -- (C);
\draw (C) -- (c);
\draw (ut') -- (c);
\coordinate [label=below:re] (re) at ($ (ut)!8.0/9!(ut') $);
\coordinate [label=above:D] (D) at ($ (C)!8.0/9!(c) $);
\draw (re) --(D);
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!1.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!2.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!3.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!4.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!5.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut')!1.0/3!(c) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut')!2.0/3!(c) $) {};
\draw (ut') -- (c);
\end{tikzpicture}
\end{document}
谢谢你,
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,decorations,decorations.text}
\begin{document}
\begin{tikzpicture}[scale=5]
\coordinate (o) at (0,0);
\coordinate [] (ut) at (2,0);
\node [xshift=-0.8ex, yshift=1.5ex] at (ut) {u};
\node [xshift=0.65ex, yshift=1.6ex] at (ut) {t};
\coordinate (fa') at (4,0);
\node [xshift=1.2ex, yshift=1.5ex] at (fa') {fa};
\coordinate [label=above:C] (C) at (2, 2.4);
\coordinate [label=above:c] (c) at (4, 1.2);
\coordinate (O) at ($ (c)!2!(C) $);
\draw (ut) -- (fa');
\draw (ut) -- (C);
\draw (C) -- (c);
\draw (fa') -- (c);
\path let \p1=($(C)-(ut)$), \p2=($(c)-(ut)$) in
(fa') ++({-(8/9*\y1 / (\y1-\y2) - 1) * \x2},0)
coordinate (re)
++(0, {8/9*\y1}) coordinate (D);
\draw (re) -- (D);
\node [xshift=-0.7ex, yshift=1.5ex] at (re) {r};
\node [xshift=0.7ex, yshift=1.5ex] at (re) {e};
\path let \p1=($(C)-(ut)$), \p2=($(c)-(ut)$) in
(fa') ++({-(64/81*\y1 / (\y1-\y2) - 1) * \x2},0)
coordinate (mi)
++(0, {64/81*\y1}) coordinate (E);
\draw (mi) --(E);
\node [xshift=-1.2ex, yshift=1.5ex] at (mi) {m};
\node [xshift=0.45ex, yshift=1.75ex] at (mi) {i};
\path let \p1=($(C)-(ut)$), \p2=($(c)-(ut)$) in
(fa') ++({-(3/4*\y1 / (\y1-\y2) - 1) * \x2},0)
coordinate (fa)
++(0, {3/4*\y1}) coordinate (F);
\draw (fa) -- (F);
\node [xshift=-0.7ex, yshift=1.9ex] at (fa) {f};
\node [xshift=0.7ex, yshift=1.5ex] at (fa) {a};
\path let \p1=($(C)-(ut)$), \p2=($(c)-(ut)$) in
(fa') ++({-(2/3*\y1 / (\y1-\y2) - 1) * \x2},0)
coordinate (sol)
++(0, {2/3*\y1}) coordinate [label=above:G] (G);
\draw (sol) -- (G);
\node [xshift=-0.5ex, yshift=1.5ex] at (sol) {s};
\node [xshift=1.2ex, yshift=1.9ex] at (sol) {ol};
\path let \p1=($(C)-(ut)$), \p2=($(c)-(ut)$) in
(fa') ++({-(16/27*\y1 / (\y1-\y2) - 1) * \x2},0)
coordinate (la)
++(0, {16/27*\y1}) coordinate (A);
\draw (la) -- (A);
\path let \p1=($(C)-(ut)$), \p2=($(c)-(ut)$) in
(fa') ++({-(128/243*\y1 / (\y1-\y2) - 1) * \x2},0)
coordinate (si)
++(0, {128/243*\y1}) coordinate (B);
\draw (si) -- (B);
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!1.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!2.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!3.0/6!(C) $) {};
\node [xshift=-0.5em, yshift=-2em] (c') at ($ (ut)!3.0/6!(C) $) {6};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!4.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!5.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (fa')!1.0/3!(c) $) {};
\node [xshift=0.5em, yshift=-2em] (c') at ($ (fa')!1!(c) $) {3};
\node [fill=black, inner sep=1pt] (c') at ($ (fa')!2.0/3!(c) $) {};
\draw (fa') -- (c);
\node [fill=black, inner sep=1pt] (c') at ($ (sol)!1.0/4!(G) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (sol)!2.0/4!(G) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (sol)!3.0/4!(G) $) {};
\node [xshift=-0.5em, yshift=-2em] (c') at ($ (sol)!3.0/4!(G) $) {4};
\draw[postaction={decorate,decoration={text along path,text align=center,text={Diapason},raise=5pt}}](ut)to[bend right=800] (fa'){};
\draw[postaction={decorate,decoration={text along path,text align=center,text={Diapente},raise=5pt}}](ut)to[bend right=800] (sol){};
\draw[postaction={decorate,decoration={text along path,text align=center,text={Diatessaron},raise=5pt}}](sol)to[bend right=800] (fa'){};
\end{tikzpicture}
\end{document}
答案1
您可以使用该库来计算该路径与另一条路径在高度上intersection
的交点(第一张图片中的红色路径)。(C)-(c)
8/9C
\path[draw,red, name path=target] ($ (ut)!8.0/9!(C) $)
node [label=left:8/9] {} -- ++(1,0);
\path[name intersections={of=target and C-c}]
(intersection-1) coordinate[label=above:D](D)
(intersection-1 |- ut) coordinate[label=below:re](re);
或者你可以自己使用语法let
和截距定理,你可能在学校学过(第二张图片)。
\path let \p1=($(C)-(ut)$), \p2=($(c)-(ut)$) in
(ut') ++({-(8/9*\y1 / (\y1-\y2) - 1) * \x2},0)
coordinate [label=below:re] (re)
++(0, {8/9*\y1}) coordinate [label=above:D] (D);
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc, intersections}
\begin{document}
\begin{tikzpicture}[scale=2]
\coordinate (o) at (0,0);
\coordinate [label=below:ut] (ut) at (2,0);
\coordinate [label=below:ut'] (ut') at (4,0);
\coordinate [label=above:C] (C) at (2, 2.4);
\coordinate [label=above:c] (c) at (4, 1.2);
\coordinate (O) at ($ (c)!2!(C) $);
% Help path. Style draw,red is only for illustration.
\path[draw,red, name path=target] ($ (ut)!8.0/9!(C) $)
node [fill=black, inner sep=1pt, label=left:8/9] {}
-- ++(1,0);
\draw (ut) -- (ut');
\draw (ut) -- (C);
\draw[name path=C-c] (C) -- (c);
\draw (ut') -- (c);
\path[name intersections={of=target and C-c}]
(intersection-1) coordinate[label=above:D](D)
(intersection-1 |- ut) coordinate[label=below:re](re);
\draw (re) --(D);
\draw (ut') -- (c);
\end{tikzpicture}
\begin{tikzpicture}[scale=2]
\coordinate (o) at (0,0);
\coordinate [label=below:ut] (ut) at (2,0);
\coordinate [label=below:ut'] (ut') at (4,0);
\coordinate [label=above:C] (C) at (2, 2.4);
\coordinate [label=above:c] (c) at (4, 1.2);
\coordinate (O) at ($ (c)!2!(C) $);
\draw (ut) -- (ut');
\draw (ut) -- (C);
\draw (C) -- (c);
\draw (ut') -- (c);
% Use basic school geometry to calculate intersection.
\node [fill=black, inner sep=1pt, label=left:8/9] at ($ (ut)!8.0/9!(C) $) {};
\path let \p1=($(C)-(ut)$), \p2=($(c)-(ut)$) in
(ut') ++({-(8/9*\y1 / (\y1-\y2) - 1) * \x2},0)
coordinate [label=below:re] (re)
++(0, {8/9*\y1}) coordinate [label=above:D] (D);
\draw (re) --(D);
\draw (ut') -- (c);
\end{tikzpicture}
\end{document}
答案2
这是用于intersection of
计算交点 D 的另一种解决方案,而不是使用交点库。
代码如下:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=2]
\coordinate (o) at (0,0);
\coordinate [label=below:ut] (ut) at (2,0);
\coordinate [label=below:ut'] (ut') at (4,0);
\coordinate [label=above:C] (C) at (2, 2.4);
\coordinate [label=above:c] (c) at (4, 1.2);
\coordinate (O) at ($ (c)!2!(C) $);
\draw (ut) -- (ut');
\draw (ut) -- (C);
\draw (C) -- (c);
\draw (ut') -- (c);
\coordinate (leftD) at ($ (C)!1.0/9!(ut) $);
\coordinate (rightD) at (leftD-|c);
\coordinate (D) at (intersection of leftD--rightD and C--c);
\draw[red](D)node[above]{D}--(D|-ut)node[below]{re};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!1.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!2.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!3.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!4.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut)!5.0/6!(C) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut')!1.0/3!(c) $) {};
\node [fill=black, inner sep=1pt] (c') at ($ (ut')!2.0/3!(c) $) {};
\draw (ut') -- (c);
\end{tikzpicture}
\end{document}