Tikz: Cálculos con coordenadas

Tikz: Cálculos con coordenadas

Inspirado por la pregunta¿Cómo dibujar una recta que pase por un punto y sea paralela a otro?Estoy intentando hacer algo de aritmética con coordenadas. El siguiente código no funciona, pero espero que con un pequeño cambio lo haga. Básicamente

  • en %Q1, estoy intentando agregar un vector (1,1) a (x) para obtener (y)
  • en %Q2, estoy intentando agregar un vector definido por una distancia de 1,5 y un ángulo de 270° a (x) para obtener (y)
  • %Q3es el mismo que %Q2en otro contexto (probablemente también la misma sintaxis)

.

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{calc,patterns,angles,quotes}

\begin{document}
\begin{center}
\begin{tikzpicture}[dot/.style={circle,inner sep=1pt,fill,label={$#1$},name=#1},
  extended line/.style={shorten >=-#1,shorten <=-#1},
  extended line/.default=1cm]

\node [dot=x] at (0,0) {};
% --------
%\node [dot=y] at (x) +($(1,1)$) {};        %Q1
%\node [dot=y] at (x) +($(1.5;270)$) {};    %Q2
\node [dot=y] at (x) ++(1.5;270) {};        %Q2
% --------
\draw [extended line=0.5cm] (x) -- (y);
\end{tikzpicture}
\end{center}
\begin{center}
\begin{tikzpicture}[]

\ccordinate (a) at (0,0);
\ccordinate (b) at (a)+(2;45);              %Q3
\draw [extended line=0.5cm] (a) -- (b);
\end{tikzpicture}
\end{center}

\end{document}

Respuesta1

Gracias a los comentarios, aquí la respuesta:

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{calc,patterns,angles,quotes}

\begin{document}
\begin{center}
\begin{tikzpicture}[x=1cm,y=1cm,
  dot/.style={circle,inner sep=1pt,fill,label={$#1$},name=#1},
  dott/.style={circle,inner sep=1pt,fill},
  extended line/.style={shorten >=-#1,shorten <=-#1},
  extended line/.default=1cm]

\node [dot=x] at (0,0) {};
\node [dot=y] at ($(x)+(45:2)$) {};
\node [dot=z] at ($(x)+(1,0)$) {};
\draw [extended line=0.5cm] (x) -- (y);
\draw [extended line=0.5cm] (x) -- (z);

\coordinate (a) at (2,0);
\coordinate (b) at ($(a)+(-45:1)$);
\draw [extended line=0.5cm] (a) -- (b);
\node[dott] at (a) {};
\node at (a) [above right = 0.7mm of a] {$a$};
\node[dott] at (b) {};
\node at (b) [above] {$b$};

\end{tikzpicture}
\end{center}

\end{document}

ingrese la descripción de la imagen aquí

información relacionada