Drawing relativistic causal structure diagrams with Tikz

I'm interested in drawing relativistic diagrams of causal structure in Tikz. In these diagrams, one is often interested in drawing the causal future and past of some region. These causal future and pasts usually such that they are tangent to the region at a 45º angle, then follow the region's border and then get away from the region at another tangent. Here's an example illustration by Christian Bär that I took from Research Gate:

How can one make such a drawing in Tikz? For the simplest case in which the blob A is an ellipse I managed to do the correct drawing by computing by hand where the lines should touch the blob, but I'm wondering whether there is a more general approach that allows for other shapes of blobs.

Here's an MWE for the ellipse blob:

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}
\begin{document}
\pgfmathsetmacro\a{3}
\pgfmathsetmacro\b{2}
\pgfmathsetmacro\l{1.6*sqrt(\a^2+\b^2)}
\pgfmathsetmacro\THETA{acos(\a/sqrt(\a^2+\b^2))}
\begin{tikzpicture}
\draw[red, ultra thick] ($\a*cos(\THETA)*(1,0)+\b*sin(\THETA)*(0,1) + (315:\l)$) -- ($\a*cos(\THETA)*(1,0)+\b*sin(\THETA)*(0,1)$) arc [start angle=\THETA, end angle=180-\THETA, x radius=\a, y radius=\b] -- +(225:\l);
\draw[blue, ultra thick] ($\a*cos(\THETA)*(1,0)-\b*sin(\THETA)*(0,1) + (45:\l)$) -- ($\a*cos(\THETA)*(1,0)-\b*sin(\THETA)*(0,1)$) arc [start angle=-\THETA, end angle=-180+\THETA, x radius=\a, y radius=\b] -- +(135:\l);
\end{tikzpicture}
\end{document}


Here's its output:

• @Teepeemm I added an MWE. It doesn't need to be a super general blob. For example, it can be convex, and perhaps even share the straight bits with the ellipse. A blob similar to the one used by Bär would already be nice. Commented Mar 26, 2023 at 21:53
• So, you are essentially asking: How can I get the coordinate on some path where the slope of a tangential line through this coordinate is 1 (or -1), right? I have the feeling that this is not really possible without a lot of computing (especially for complicated paths). Commented Mar 27, 2023 at 7:12
• As @JasperHabicht said, TikZ can't give you a tangent through a specific coordinate to an arbitrary path but you can travel along the path and find the tangents and then define a coordinate on these. Though that would mean you have a bit guess work to do. Commented Mar 27, 2023 at 8:05

As mentioned in comments, the general approach requires a very sophisticated techniques. However, you can draw similar diagram with a simple approach. Let points A,B,C,D be fixed. By adjusting other points you may change the shape of the blob. This could be easy done using TikzEdt.

\documentclass[tikz,border=10]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[thick,bullet/.style={circle,fill,inner sep=1.5pt}]
\coordinate (A) at (0.2,-0.1);
\coordinate (B) at (0.2,1);
\coordinate (C) at (5,1.7);
\coordinate (D) at (5,0);
\path[save path=\blob] plot[smooth cycle,tension=0.5]
coordinates{(A)  (0,0.4)  (B) (1.2,1.4) (2.6,1.4) (3.9,2.2) (C) (5.3,0.9) (D) (3.5,-0.6) (0.8,-0.4) };
\draw[use path=\blob];
\draw[blue] (A) -- +(135:5);
\draw[blue] (D) -- +(45:5);
\draw[red] (B) -- +(-135:5);
\draw[red] (C) -- +(-45:5);
\begin{scope}
\clip ($(B)+(0,-1)$) rectangle ($(C)+(0,1)$);
\draw[red,use path=\blob];
\end{scope}
\begin{scope}
\clip ($(A)+(0,-1)$) rectangle ($(D)+(0,1)$);
\draw[blue,use path=\blob];
\end{scope}
\foreach \p in {A,B,C,D}
\node[bullet,label=above:$\p$] at (\p) {};
\end{tikzpicture}
\end{document}


• Using a hobby curve you could go one better and specify the tangent directions explicitly at those points. Commented Mar 27, 2023 at 18:03