1

I would like to be able to draw this figure:

figure

I tried with psteucl package but I'm facing some difficulties. The first is the plot of the perpendicular to the 1st face of the triangle.

I tested with the function \pstMediatorAB but it doesn't look very nice because the mediator is drawn by the mirror image of a point of the triangle) :

    \documentclass{standalone}
\usepackage{pst-eucl}

\begin{document}

\begin{pspicture}(-5,-3)(6,5) \pstTrianglePointSymbol=none, PointName=none{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}

I also tested using the orthogonal projection but the perpendicular is then not symmetrical with respect to the edge of the triangle :

\documentclass{standalone}

\usepackage{pst-eucl}

\begin{document}

\begin{pspicture}(-5,-3)(6,5) \pstTriangle(0,0){A}(5,0){B}(2.5,4){C} \pstGeonodePointSymbol=none, PointName=none{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}

How can I draw the figure?

Nicolas
  • 1,023
  • If you consider using TikZ, here is a similar picture: https://tex.stackexchange.com/questions/582132/how-to-draw-this-figure-dispersive-prism – Juan Castaño Dec 28 '22 at 07:09
  • tikz is way better at drawing this kind of figures. You are warned that it may be a bit difficult to learn it at first. – anis Dec 28 '22 at 09:34
  • @JuanCastaño thanks for the link. I have the impression that the placement of certain points comes from calculations (for example for I4), no ? – Nicolas Dec 28 '22 at 13:26
  • Not I4. There are some points calculated as intersection of two lines but I placed I4 there 'by hand'. It could be at some other place, of course – Juan Castaño Dec 28 '22 at 14:13
  • I understand ; thanks – Nicolas Dec 28 '22 at 21:41

2 Answers2

2

While you are waiting for help with pst-eucl here is a version in Metapost purely for comparison.

enter image description here

Here is the source, which you need to compile with 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}

Thruston
  • 42,268
1

I draw the figure as you required by pst-eucl:

\documentclass{article}

\usepackage{pst-eucl} \usepackage[pspdf={-dDELAYSAFER -dALLOWPSTRANSPARENCY}]{auto-pst-pdf}

\begin{document}

\begin{pspicture}showgrid=false(4,4) \psset{unit=0.80cm}\footnotesize\psset{PointSymbol=none,PointNameSep=0.22cm} \pstGeonodePosAngle=90{A} \pstGeonodePosAngle=-120{B} \pstGeonodePosAngle=-60{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}

save the code in file fig.tex and you can compile it with the engine pdflatex like this:

pdflatex -enable-write18 -src-specials fig.tex

the figure generated in this code

felix.liao
  • 11
  • 2
  • 1
    Welcome to TeX StackExchange! Ideally, answers should be self-sufficient, so it should be possible to compile your code without adding more lines—could you please edit your code so that it starts with a preamble, and ends with \end{document}? A picture would also be helpful. – gz839918 Oct 09 '23 at 03:53