\pgfmathparse{1}\let\L\pgfmathresult

\coordinate (A) at (-\L,-\L);
\coordinate (B) at ( \L, \L);
\coordinate (C) at (-\L, \L);
\coordinate (D) at ( \L,-\L);

\fill (A) circle(2pt) node [left] {$A$};
\fill (B) circle(2pt) node [right] {$B$};
\draw ($(A)!-0.5!(B)$) -- ($(A)!1.5!(B)$);


\draw[dashed] (A) -- (C) -- (B) -- (D) -- cycle;

\tkzLabelSegment[below](A,D) {$|x_B-x_A|$};
\tkzLabelSegment[left](A,C) {$|y_B-y_A|$};
