7

Based on the answer given here, ($(A)!1cm!(B)$) in TikZ is equivalent to ([nodesep=1]{B}A) in PSTricks. It is just about the "radial" distance specified by two points. How about the "transverse" distance specified by two points?

More precisely, in PSTricks, the syntax ([offset=2]{A}B) represents a new point (namely C) which is 2 unit apart from the line joining A and B such that BC is perpendicular to AB.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}(6,6)
    \pstGeonode(1,1){A}(4,5){B}
    \pcline[nodesep=-1](A)(B)
    \pstGeonode([offset=2]{A}B){C}
    \psline[linecolor=blue](B)(C)
\end{pspicture}
\end{document}

enter image description here

What is the TikZ equivalent for such a syntax?

Miscellaneous

([offset=2]{A}B) can also be written as ([nodesep=2,angle=90]{A}B). Other approaches are also possible with, for example, transformations provided by pst-eucl.

10

The equivalent syntax is ($(B)!2cm!90:(A)$), which is the point 2cm away from B on the line from B to A after that line has been rotated by 90 degrees.

\documentclass[tikz]{standalone}

\usetikzlibrary{calc}
\begin{document}

\begin{tikzpicture}
\coordinate (A) at (1,1);
\coordinate (B) at (4,4);

\coordinate (C) at ($(B)!2cm!90:(A)$);
\node at (A) [above] {A};
\node at (B) [above] {B};
\node at (C) [above] {C};

\fill (A) circle [radius=2pt] (B) circle [radius=2pt] (C) circle [radius=2pt];
\end{tikzpicture}
\end{document}
3

With tkz-euclide package, using syntax \tkzDefPointWith[orthogonal normed, K=2](B,A) \tkzGetPoint {C} define a point C from B perpendicular to AB with 2cm length.

\documentclass{standalone} 

\usepackage{tikz,tkz-euclide}
\usetkzobj{all}
\begin{document}

\begin{tikzpicture}
  \tkzInit
 \tkzDefPoints{0/0/O, 5/5/K}
  \tkzDefPoints{1/1/A, 4/4/B}  
  \tkzDrawPoint[color=red](A)
  \tkzDrawPoint[color=red](B) 
  \tkzLabelPoints[above](A,B)
  \tkzDefPointWith[orthogonal normed, K=2](B,A) \tkzGetPoint {C}   
  \tkzDrawLine[color=blue,add=0 and 0](B,tkzPointResult)
 \tkzDrawSegment(O,K)
 \tkzMarkRightAngle(A,B,C)
   \tkzDrawPoint[color=red](C)
   \tkzLabelPoints[above](C)
\end{tikzpicture} 

\end{document}

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.