使用 TikZ 我如何绘制这个图形?
抱歉,这次我甚至没有尝试写代码,真的很抱歉:(,我知道这违反了网站的规则,但我真的觉得画起来很难。
提前致谢。
编辑 : 这是我的尝试,我发现很难画出穿过 I 和 I' 的线,它们是三角形边缘的中点。
我尝试修复它\begin{scope}
但没有帮助:
代码如下:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, shapes, positioning, calc, decorations.text, angles, quotes}
\begin{document}
\begin{tikzpicture}
\draw[smooth, dashed] (4,2.5)--(8,5.2);
\draw[smooth, dashed] (6.1,2.3)--(4.4,4);
\draw[smooth, black] (3,0)--(5,5)--(7,0)--(3,0);
\coordinate(O) at (5,5);
\coordinate(A) at (3,0);
\coordinate(B) at (7,0);
\pic[ draw,inner sep=1pt, circle, draw,angle eccentricity=1.1, angle radius = 10mm] {angle = A--O--B};
\node[below] at (5,4.68) {$A$};
\draw[thick, gray] (1,0.45)--(4,2.5)--(6.1,2.3)--(8,0.1);
\end{tikzpicture}
\end{document}
答案1
这是根据我的旧画改编的。只需稍加修改,您就可以得到自己的作品。
除了使用我的角度宏之外,您还可以使用角度+引号 tikz 库(请参阅此帖子:TikZ:在线之间用标签绘制角度)。
我的代码:
\documentclass [border=2mm]{standalone}
\usepackage {tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings}
\newcommand{\cangle}[6] % A,B,C,radius,style,label (circle angle at point B)
{%
\pgfmathsetmacro\p{0.2+#4} % label position
\begin{scope}
\clip #1 -- #2 -- #3 -- cycle;
\coordinate (AUX1) at ($#2!\p cm!#1$);
\coordinate (AUX2) at ($#2!\p cm!#3$);
\node[#5] at ($(AUX1)!0.5!(AUX2)$) {#6};
\draw[#5] #2 circle (#4);
\end{scope}
}
\newcommand{\sangle}[5] % A,B,C,distance,style (square angle at point B)
{%
\coordinate (AUX1) at ($#2!#4 cm!#1$);
\coordinate (AUX3) at ($#2!#4 cm!#3$);
\coordinate (AUX2) at ($(AUX1)+(AUX3)-#2$);
\draw[#5] (AUX1) -- (AUX2) -- (AUX3);
}
\begin{document}
\begin{tikzpicture}[scale=2,line cap=round,line join=round]
% styles
\tikzstyle{ray} =[red,thick,
decoration={markings,
mark=at position 0.5 with {\arrow[>=stealth]{>}}},
postaction={decorate}]
\tikzstyle{normal}=[blue,thin]
% coordinates
\coordinate (A) at (0,0);
\coordinate (B) at (4,0);
\coordinate (C) at (60:4);
\coordinate (I1) at (-1,1);
\coordinate (I4) at (5,3);
\coordinate (I2) at (intersection of A--C and I1--I4);
\coordinate (I3) at (intersection of B--C and I1--I4);
\coordinate (R1) at (2,2.5);
\coordinate (R3) at (5,0);
\coordinate (R2) at (intersection of B--C and R1--R3);
\coordinate (N1) at ($(I2)+(150:1)$);
\coordinate (N2) at ($(I2)+(330:2)$);
\coordinate (N3) at ($(R2)+(30:1)$);
\coordinate (N4) at ($(R2)+(210:2)$);
\coordinate (N5) at (intersection of N1--N2 and N3--N4);
\coordinate (IR) at (intersection of I1--I4 and R1--R3);
% prism
\draw[thick, fill=blue!5] (A) -- (B) -- (C) -- cycle;
% rays
\draw[ray] (I1) -- (I2);
\draw[ray] (I2) -- (R2);
\draw[ray] (R2) -- (R3);
\draw[dashed] (I2) -- (I4);
\draw[dashed] (R1) -- (R2);
% normal lines
\draw[normal] (N2) -- (N1) node [left] {$N_1$};
\draw[normal] (N4) -- (N3) node [right] {$N_2$};
% angles
\sangle{(N1)}{(I2)}{(C)} {0.1}{normal};
\sangle{(N3)}{(R2)}{(C)} {0.1}{normal};
\cangle{(A)} {(C)} {(B)} {0.3}{} {$\hat\alpha$};
\cangle{(N1)}{(N5)}{(N4)}{0.3}{blue}{$\hat\alpha$};
\cangle{(N1)}{(I2)}{(I1)}{0.3}{red} {$\hat i_1$};
\cangle{(N2)}{(I2)}{(R2)}{0.3}{red} {$\hat r_1$};
\cangle{(I2)}{(R2)}{(N4)}{0.3}{red} {$\hat i_2$};
\cangle{(R3)}{(R2)}{(N3)}{0.3}{red} {$\hat r_2$};
\cangle{(I4)}{(I2)}{(R2)}{0.4}{} {$\hat\beta$};
\cangle{(R1)}{(R2)}{(I2)}{0.4}{} {$\hat\gamma$};
\cangle{(I1)}{(IR)}{(R1)}{0.3}{} {$\hat\delta$};
\end{tikzpicture}
\end{document}