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.


enter image description here

What is the TikZ equivalent for such a syntax?


([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.


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.



\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];

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.



 \tkzDefPoints{0/0/O, 5/5/K}
  \tkzDefPoints{1/1/A, 4/4/B}  
  \tkzDefPointWith[orthogonal normed, K=2](B,A) \tkzGetPoint {C}   
  \tkzDrawLine[color=blue,add=0 and 0](B,tkzPointResult)


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.