我希望能够绘制这个图形:
我尝试使用 psteucl 包,但遇到了一些困难。第一个是绘制三角形第一面的垂直线。
我使用函数 \pstMediatorAB 进行了测试,但看起来不太好看,因为中介者是通过三角形点的镜像绘制的):
\documentclass{standalone}
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}(-5,-3)(6,5)
\pstTriangle[PointSymbol=none, PointName=none](0,0){A}(5,0){B}(2.5,4){C}
\psset{linecolor=red, CodeFigColor=red, nodesep=-1}
\pstMediatorAB[PointSymbolA=none]{A}{C}{I}{M_I}
\end{pspicture}
\end{document}
我也测试了使用正交投影,但垂直线相对于三角形的边缘不对称:
\documentclass{standalone}
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}(-5,-3)(6,5)
\pstTriangle(0,0){A}(5,0){B}(2.5,4){C}
\pstGeonode[PointSymbol=none, PointName=none](1,3){F}
%\pstMiddleAB{A}{C}{I}
\pstProjection[PointSymbol=none, PointName=none]{A}{C}{F}
\pstLineAB[linecolor=blue, linestyle=dashed, nodesep=-1]{F}{F'}
\end{pspicture}
\end{document}
我怎样才能画出这个图形?
答案1
在您等待帮助时,pst-eucl
这里有一个版本元帖子纯粹为了比较。
这是您需要用来编译的源代码lualatex
。
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
vardef asind(expr a) = angle (1 +-+ a, a) enddef;
beginfig(1);
path t; t = for i=0 upto 2: 120 up rotated 120i -- endfor cycle;
path ray, pin, pout;
numeric a, b, n, r;
a = 42; % angle of incidence
n = 1.52; % refractive index
r = asind(sind(a) / n); % angle of refraction
b = asind(sind(60 - r) * n); % exit angle
numeric p, q;
p = 1/2;
(q, whatever) = t intersectiontimes ((up -- 200 up)
rotated (r + angle direction p of t)
shifted point p of t);
ray = 42 down rotated (a + angle direction p of t) shifted point p of t
-- point p of t -- point q of t --
(42 down rotated (angle direction q of t - b) shifted point q of t);
pin = (down -- up) scaled 36
rotated angle direction p of t
shifted point p of t;
pout = (down -- up) scaled 36
rotated angle direction q of t
shifted point q of t;
fill t withcolor 1/256(246, 255, 256);
drawoptions(withpen pencircle scaled 1/4);
draw pin dashed evenly scaled 1/2;
draw pout dashed evenly scaled 1/2;
draw unitsquare scaled 3 rotated (180 + angle direction p of t) shifted point p of t;
draw unitsquare scaled 3 rotated (270 + angle direction q of t) shifted point q of t;
drawoptions(withcolor 2/3 blue);
interim ahangle := 30;
drawarrow subpath ( 0, 1/2) of ray;
drawarrow subpath (1/2, 5/2) of ray;
draw subpath (5/2, 3) of ray;
label("$\scriptstyle" & decimal a & "^\circ$",
16 dir (1/2 a - 90 + angle direction p of t) shifted point p of t);
drawoptions();
draw t;
endfig;
\end{mplibcode}
\end{document}
答案2
我按照 pst-eucl 的要求画了如下图:
\documentclass{article}
\usepackage{pst-eucl}
\usepackage[pspdf={-dDELAYSAFER -dALLOWPSTRANSPARENCY}]{auto-pst-pdf}
\begin{document}
\begin{pspicture}[showgrid=false](0,0)(4,4)
\psset{unit=0.80cm}\footnotesize\psset{PointSymbol=none,PointNameSep=0.22cm}
\pstGeonode[PosAngle=90](0,2){A}
\pstGeonode[PosAngle=-120](-3,-4){B}
\pstGeonode[PosAngle=-60](3,-4){C}
\pstLineAB{A}{B}
\pstLineAB{A}{C}
\pstMediatorAB[linestyle=none,PointName=none]{A}{B}{I}{I'}
\pstMediatorAB[linestyle=none,PointName=none]{A}{C}{J}{J'}
\pstSymO[PointName=none]{I}{I'}[I'']
\pstSymO[PointName=none]{J}{J'}[J'']
\pstLineAB[linestyle=dashed,dash=0.06,nodesep=2.5]{I'}{I''}
\pstLineAB[linestyle=dashed,dash=0.06,nodesep=2.5]{J'}{J''}
\pstRightAngle[RightAngleSize=0.15]{A}{I}{I''}
\pstRightAngle[RightAngleSize=0.15]{J'}{J}{A}
\pstRotation[PointName=none,RotAngle=60]{I}{I''}[D]
\pstMarkAngle[LabelSep=.65,MarkAngleRadius=.15,MarkAngleType=default]{I''}{I}{D}{$60^\circ$}
\pstRotation[PointName=none,RotAngle=-60]{J}{J'}[E]
\pstMarkAngle[LabelSep=.65,MarkAngleRadius=.15,MarkAngleType=default]{E}{J}{J'}{$60^\circ$}
\pstSegmentMark[SegmentSymbol=MarkArrow]{D}{I}
\pstSegmentMark[SegmentSymbol=MarkArrow]{I}{J}
\pstSegmentMark[SegmentSymbol=MarkArrow]{J}{E}
\end{pspicture}
\end{document}
将代码保存在文件 fig.tex 中,然后就可以使用引擎 pdflatex 进行编译,如下所示:
pdflatex -enable-write18 -src-specials fig.tex