3

Can you tell me about the difference between two the following codes?

My code:

\documentclass{article}
\usepackage{pst-node,pst-func,pst-plot,pst-eucl}
\usepackage{pst-intersect}
\usepackage{auto-pst-pdf} 
\begin{document}
\begin{pspicture}(4,5)
\pssavebezier[plotpoints=1000,linecolor=DOrange, arrows=->]{A}%
                    (0,0)(0,5)(5,5)(5,1)(1,1.5)
\pssavebezier[arrows=->,plotpoints=1000]{B}(0,5)(0,0)(5,0)(5,5)(0,2)
\psintersect[name=C, showpoints]{A}{B}
\color{DOrange}

the first code ( I will choose it):

\uput[150](C1){1}
\uput[85](C2){2}
\uput[-20](C4){3}
\uput[90](C3){4}

the second code (I won't choose it):

\uput[150](!\psGetIsectCenter{C}{A}{1} I-C1.x I-C1.y){1}
\uput[85](!\psGetIsectCenter{C}{A}{2} I-C2.x I-C2.y){2}
\uput[-20](!\psGetIsectCenter{C}{A}{3} I-C3.x I-C3.y){3}
\uput[90](!\psGetIsectCenter{C}{A}{4} I-C4.x I-C4.y){4}

The result of two above codes as the same.

3
  • \uput[150](C1){1} is like going to US from Europe through the North pole.

  • \uput[150](!\psGetIsectCenter{C}{A}{1} I-C1.x I-C1.y){1} is like going to US from Europe through the South pole.

Both are correct but the former is more compact and the latter is unnecessarily complicated. You need the latter if you want to do some calculation with, for example, the abscissa of an intersection point.

For example, adding 1 to I-C1.x as follows.

\uput[150](!\psGetIsectCenter{C}{A}{1} I-C1.x 1 add I-C1.y){1}
  • "Upvoting" and "accepting" are independent events that are not mutually exclusive. – Money Oriented Programmer Nov 24 '18 at 7:51
  • 1
    Wry smile :-))) – user173875 Nov 24 '18 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy