我想绘制欧几里得平行公理以及指示直线相交位置的角度标记。我的代码:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, positioning, shapes, through, intersections}
\begin{document}
\begin{tikzpicture}
%\clip (1,0) rectangle (5,4);
%\draw[help lines] (0,0) grid (7,3);
\coordinate (A) at (0,0);
\coordinate (B) at (4,3.5);
\coordinate (C) at (-0.3,-0.3);
\coordinate (D) at (6,2);
\draw[blue,thick,name path=azul] (A) -- (B);
\draw[green, thick,name path=verde] (C) -- (D);
\draw[red,name path=roja] (0.5,4.5) -- (7,-1);
\path [name intersections={of=roja and azul}];
\coordinate (F) at (intersection-1) {};
\path[name path=circ1,draw=gray,dashed] (F) circle (17pt);
\path [name intersections={of=azul and circ1}];
%% \node[fill=black,circle,inner sep=0pt,minimum size=3pt] (f1) at (intersection-1) {};
%% \node[fill=green,circle,inner sep=0pt,minimum size=3pt] (f2) at (intersection-2) {}; % These lines are just to visualize the intersection points and are not important
\coordinate (f1) at (intersection-2) {};
\path [name intersections={of=roja and circ1}];
\coordinate (f2) at (intersection-2) {};
\begin{scope}
\path[clip] (f2) -- (F) -- (f1) -- cycle;
\node (alpha) [circle,draw,minimum size=5pt,label=below:{\tiny $\alpha$}] at (F) {};
\end{scope}
\path [name intersections={of=roja and verde}];
\node (E) at (intersection-1) {};
\path[name path=circ2,draw=gray,dashed] (E) circle (17pt);
\path [name intersections={of=verde and circ2}];
\coordinate (e1) at (intersection-2) {};
\path [name intersections={of=roja and circ2}];
\coordinate (e2) at (intersection-2) {};
\begin{scope}
\path[clip] (e2) -- (E) -- (e1) -- cycle;
\node (beta) [circle,draw,minimum size=3pt,label=left:{\tiny $\beta$}] at (E) {}; % % This doesn't get drawn!!!!
\end{scope}
\end{tikzpicture}
\end{document}
为了便于视觉显示,我画了一些圆圈来标记角度(虚线,灰色)。但是,角度 $\beta$ 不会出现。这是我得到的图片:
关于如何获得第二个角度标记,您有什么想法吗?提前致谢!
答案1
我稍微简化了一下你的代码,现在速度更快了,因为不需要计算圆线交点。你用它们来修复裁剪区域,但你已经有了coordinates
可以定义类似区域的。
(f2) -- (F) -- (f1) -- cycle
你可以使用来代替(A) -- (F) -- (E) -- cycle
。当然,在使用它之前你需要知道E
。
现在代码是
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, positioning, shapes, through, intersections}
\begin{document}
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (4,3.5);
\coordinate (C) at (-0.3,-0.3);
\coordinate (D) at (6,2);
\draw[blue,thick,name path=azul] (A) -- (B);
\draw[green, thick,name path=verde] (C) -- (D);
\draw[red,name path=roja] (0.5,4.5) -- (7,-1);
\path [name intersections={of=roja and azul}];
\coordinate (F) at (intersection-1);
\path [name intersections={of=roja and verde}];
\coordinate (E) at (intersection-1);
\begin{scope}
\path[clip] (A) -- (F) -- (E) -- cycle;
\node (alpha) [circle,draw,minimum size=5pt,label=below:{\tiny $\alpha$}] at (F) {};
\end{scope}
\begin{scope}
\path[clip] (C) -- (E) -- (F) -- cycle;
\node (beta) [circle,draw,minimum size=3pt,label=left:{\tiny $\beta$}] at (E) {}; % % This doesn't get drawn!!!!
\end{scope}
\end{tikzpicture}
\end{document}
结果
更新:回答评论。
下图中的青色三角形显示了被路径裁剪的区域(C) -- (D) -- (F)--cycle
。该区域内绘制的所有内容都会保留,因此,半圆和beta
标签也是如此。
下图中的青色三角形显示了被裁剪的区域,(C)--(E)--(F)--cycle
仅保留了“左象限”和beta
。我以为你想要这个。