Case 1: Let's say I have a few coordinates (A), (B), (C), (W), (X), (Y), and (Z) (possibily obtained through intersection, rotation, and whatnots).
I draw two piecewise linear curves through (A), (B), (C) on one hand and (W), (X), (Y), and (Z) on the other hand.
Case 2: I have two curves defined by two functions, say f(x) = x + 3 and g(x) = - x + 2.
Case 3: One of the curves is defined by coordinates and the other by a function
In all these cases, is there a way to "add" both curves to obtain a third one (say h(x) = f(x) + g(x))?
For sake of simplicity, all curves I'm interested in at the moment have the nice property of being piecewise linear but feel free to relax this if there is an all encompassing solution.
Example for case 1:
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\begin{document}
\begin{tikzpicture}
\newcounter{i}
% Curve 'one' .. is there a way to give it a name?
% Coordinates saved for further labeling, and so on.
% How to do it smoothly?
\begin{scope}[red]
\setcounter{i}{0}%
\foreach \point in {(0,4),(4,1),(10,6)} {%
\node[coordinate] (one-\arabic{i}) at \point { };%
\fill (one-\arabic{i}) circle (0.1);%
\stepcounter{i}
}
\draw (one-0) -- (one-1) -- (one-2);
\end{scope}
% Curve 'two' ..
% If I don't need to save the coordinates for later use,
% there must be a better way to draw?
\begin{scope}[green]
\setcounter{i}{0}%
\foreach \point in {(0,1),(3,5),(6,5),(10,2)} {%
\node[coordinate] (two-\arabic{i}) at \point { };%
\fill (two-\arabic{i}) circle (0.1);%
\stepcounter{i}
}
\draw (two-0) -- (two-1) -- (two-2) -- (two-3);
\end{scope}
%%% What I want is the "sum" of curves one and two ...
\end{tikzpicture}
\end{document}
