Hi I want to draw some geodesics accelerating towards one another using TikZ. I've stolen some code from an online example to set up two planes one on top of the other (top one invisible - I'm just using it to start the geodesics there).

The problem I'm having is drawing the lines (or geodesics) in between the two planes. It works fine if I want curved lines but I need them to be curved - specifically, I want them to curve towards each other as they approach their respective endpoints on the lower plane.

So far my code is the following:

\begin{tikzpicture}[scale=.9,every node/.style={minimum size=1cm},on grid]       

    % Lower layer
    yshift=0,every node/.append style={
    \fill[black,fill opacity=0.9] (0,0) rectangle (5,5);

    \draw[black] (0,0) rectangle (5,5);
    \node[name=B,draw,scale=0.4,black,very thick,text width=0.95,text height=0.95,inner sep=0pt,] at (2.525,2.525) {};
\end{scope}![enter image description here][1]\end{pgfonlayer}

\begin{scope}[  % Upper layer
    yshift=105,every node/.append style={
    \fill[fill=none,fill opacity=0.5, opacity=0.5] (0,0) rectangle (5,5);

    \node[scale=.9,draw,fill=none,draw=none, fill opacity=0.9,opacity=0,very thick,name=A,text width=3cm,text height=3cm,inner sep=0pt] at (2.5,2.5) {};

  \foreach \i in {north east, north west, south east, south west}
      \draw[green,very thick] (A.\i) parabola (B.\i);



This produces the following:

As you can see the lines do not curve toward each other in a nice way - I want them to get closer and closer to one another as they reach the black surface and not to do it in this weird parabolic way. Obviously the problem is that I have used the parabola command. I've tried messing about with a variety of other curves available and I just cannot get this to work at all.

Does anybody know how to do this? Is it even possible?

It would also be nice to have arrows in the middle of the incoming lines if that's possible?

Thanks a lot.


Here's one idea. I basically started over with the code since the provided example wasn't compilable and contained several errors after adding the requisite code.

The view of the drawing is determined by the unit vector settings x={(<x-dim>,<y-dim>)} etc. as applied to the tikzpicture environment. Note the addition of the z-coordinate to all points throughout. I find this easier to use and visualize than adjusting xslant, yslant, and rotate.

The curvature of the green lines can be adjusted by changing the control points for the curved lines. I'm using the calc library to conveniently calculate these control points based on the start and end coordinates of the curves.


  \draw[fill,fill opacity=0.9] (0,0,0) -- ++(5,0,0) -- ++(0,5,0) -- ++(-5,0,0) -- cycle;
  \draw[very thick] ( 2.3,2.3,0) coordinate (B1)
               -- ++( 0.4,0.0,0) coordinate (B2)
               -- ++( 0.0,0.4,0) coordinate (B3)
               -- ++(-0.4,0.0,0) coordinate (B4) -- cycle;
  \fill[opacity=0.1] (0,0,2) -- ++(5,0,0) -- ++(0,5,0) -- ++(-5,0,0) -- cycle;
  \path ( 1.15,1.15,2) coordinate (A1)
   -- ++( 2.70,0.00,0) coordinate (A2)
   -- ++( 0.00,2.70,0) coordinate (A3)
   -- ++(-2.70,0.00,0) coordinate (A4) -- cycle;
  \foreach \i in {1,...,4}
    \draw[green,very thick] (A\i) .. 
      controls ($(A\i)!0.5!(2.5,2.5,1)$) and ($(B\i)+(0,0,0.4)$) .. (B\i);

enter image description here

I think I produced what you're after, but in case not, leave a comment and I'll try to get closer to the desired result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.