5

I used \psbezier to draw a triangle with pushed-in edges:

\begin{pspicture}(0,-1)(3,1)
    \psdot(0,0) \uput[180](0,0){$a$}
    \psdot(3,1) \uput[45](3,1){$c$}
    \psdot(3,-1) \uput[-45](3,-1){$b$}
    \psbezier(3,1)(2,0.4)(1,0.1)(0,0)
    \psbezier[ArrowInside=-*,ArrowInsidePos=0.66](0,0)(1,-0.1)(2,-0.4)(3,-1)
    \psbezier[ArrowInside=-*,ArrowInsidePos=0.33](3,-1)(2.6,-0.5)(2.6,0.5)(3,1)
\end{pspicture}

geodesic-triangle

Now, I can't find a smart way (not using trial-and-error guessing coordinates) to connect the (unnamed) bullets on the bezier curves specified through ArrowInside and ArrowInsidePos through a straight line.

Alternatively, it would be sufficient for me to connect the intersections of a straight line with those two bezier curves. But again: I can't think of a smart way doing this using PStricks even after browsing through the comprehensive User's Guide by Timothy Van Zandt.

Any suggestions how to solve that problem?

6
+150

A Bézier curve is specified as a polynomial of third order in its x and y coordinates. Here is how you can use \psparnode (from pst-node) to place nodes at any distance on the curve:

I used the formulas from the PostScript redbook, p. 565 (http://www.adobe.com/products/postscript/pdfs/PLRM.pdf‎:

\documentclass[margin=12pt, pstricks]{standalone}
\usepackage{pst-node}
\makeatletter
\def\psbeziernode(#1)(#2)(#3)(#4)#5#6{%
  \begingroup
    \pst@getcoor{#1}\pst@tempa
    \pst@getcoor{#2}\pst@tempb
    \pst@getcoor{#3}\pst@tempc
    \pst@getcoor{#4}\pst@tempd
    \psparnode{#5}{%
      \pst@tempa /y0 ED /x0 ED
      \pst@tempb /y1 ED /x1 ED
      \pst@tempc /y2 ED /x2 ED
      \pst@tempd /y3 ED /x3 ED
      /cx { x1 x0 sub 3 mul } def
      /bx { x2 x1 sub 3 mul cx sub } def
      /ax { x3 x0 sub bx sub cx sub } def
      /cy { y1 y0 sub 3 mul } def
      /by { y2 y1 sub 3 mul cy sub } def
      /ay { y3 y0 sub by sub cy sub } def
      ax t mul bx add t mul cx add t mul x0 add
      ay t mul by add t mul cy add t mul y0 add \tx@UserCoor}{#6}%      
  \endgroup
}%
\makeatother
\begin{document}
\begin{pspicture}(0,-1)(3,1)
    \psdot(0,0) \uput[180](0,0){$a$}
    \psdot(3,1) \uput[45](3,1){$c$}
    \psdot(3,-1) \uput[-45](3,-1){$b$}
    \psbezier(3,1)(2,0.4)(1,0.1)(0,0)
    \psbezier(0,0)(1,-0.1)(2,-0.4)(3,-1)
    \psbeziernode(0,0)(1,-0.1)(2,-0.4)(3,-1){0.66}{N1}
    \psbezier(3,-1)(2.6,-0.5)(2.6,0.5)(3,1)
    \psbeziernode(3,-1)(2.6,-0.5)(2.6,0.5)(3,1){0.33}{N2}
    \psline[linecolor=red](N1)(N2)\psdot(N1)\psdot(N2)
\end{pspicture}
\end{document}

The result is:

enter image description here

Note, that the positions of \psbeziernode and ArrowInsidePos do not fully coincide for the same values.

The ArrowInside arrows are shifted a bit, which can be seen, when comparing the original nodes to ArrowInsidePos=0 and ArrowInsidePos=1.

5

A TikZ-based version:

\documentclass[tikz,border=10pt]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[marker/.style={circle,fill,draw,inner sep=1pt,pos=#1}]
\foreach \place/\angle/\name in {{(0,0)}/180/a,{(3,1)}/45/c,{(3,-1)}/-45/b}
{
\filldraw[black] \place circle (1.5pt) 
node[label={\angle:$\name$},inner sep=0pt](\name){};
}
\draw (a) edge[bend left=15] 
  node[marker=0.75](a-b){}% marking the path a-b: select the position [0,1]
  (b) ;
\draw (c) edge[bend right=15] 
  node[marker=0.7](c-b){}% marking the path c-b: select the position [0,1]
  (b) ;
\draw (c) edge[bend left=15](a);

\draw[red](a-b)--(c-b); % interconnecting the two markers
\end{tikzpicture}
\end{document}

The result:

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.