If I understand the problem correctly, we just need to extract the path from StreamPlot
, don't we?
previousCell[] :=
Cells@EvaluationNotebook[] /. {___, prev_, EvaluationCell[], ___} :>
ToExpression@First@NotebookRead@prev
Import["http://halirutan.github.io/Mathematica-SE-Tools/decode.m"]["http://i.stack.imgur.\
com/eDzXT.png"]
The following part of code should be placed in a new cell under the previous code:
dat = Uncompress@previousCell[];
func = Interpolation@dat;
{vx, vy} = Function[{x, y}, #] & /@ Grad[func[x, y], {x, y}];
begin = {180.0, 179.99};
end = {124.5, 124.49};
plot = StreamPlot[{vx[x, y], vy[x, y]}, {x, #, #2}, {y, #3, #4}, StreamPoints -> {begin},
StreamStyle -> "Line", Epilog -> Point@{begin, end}] & @@ Flatten@func["Domain"]
path = Cases[Normal@plot, Line[a_] :> a, Infinity][[1]];
ListPlot3D@dat~Show~Graphics3D@Line[Flatten /@ ({path, func @@@ path}\[Transpose])]