I agree with you that you should not have a command in which the x coordinate (or y coordinate) is useless in the relative positioning of the points.
However, it is not that easy to have such a command you requested. Nevertheless, TikZ already gives you a more brillant solution: -|
and |-
, which can handle named coordinates like (a)
, (b)
, etc. (and you will know that named coordinates are much prefered when drawing figures).
Some example:
\draw (x1,y1) -- (x1,y2) -- (x2,y2);
can be changed to
\draw (x1,y1) -| (x2,y2);
Or with five coordinates:
\draw (x1,y1) -- (x1,y2) -- (x2,y2) -- (x2,y3) -- (x3,y3) -- (x3,y4);
can be changed to
\draw (x1,y1) |- (x2,y2) -| (x3,y3) -- (x3,y4);
As I said, a combination of --
, -|
and |-
can do anything related to this. At worst there can be a couple of replicated x (or y) coordinates, but that is not a great deal, especially when you mostly have to deal with named coordinates in the future.
Furthermore, you can specify relative coordinates by prepending +
or ++
to the coordinates. Your example would be translated to
\draw (x1,y1) -- ++(0, dy1) -- ++(dx1, 0);
A single +
leaves the reference point in place, while a ++
moves the reference point to the current location. This makes it very easy to move parts of a sketch around. You only have to edit the first coordinate.
-|
and|-
for that purpose, instead of--
. For example, in this case, I would use\draw (1,0) -| (0,1);
.--
,-|
, and|-
will solve it all.