I have a two-dimensional streamline plot from a fluid dynamics simulation. I am wondering: is it possible to somehow allow Mathematica to treat the streamline plot as a plane in three-dimensional plot so that I can apply a camera perspective transformation to the resulting three-dimensional plot?
To provide a bit more information, I have three-dimensional scenes (an example of which is shown below) for which I am running fluid dynamics simulations. As a result of these simulations, I obtain a series of two-dimensional windflow velocity fields, which are cross-sections of the true three-dimensional windflow velocity fields. These fields quantify the direction and speed of the wind through the environment subject to the geometry constraints of the scene and some user-defined parameters and boundary conditions.
For visualization purposes, I'm interested in transforming and overlaying one or more of the two-dimensional streamline plots of the velocity fields onto my three-dimensional scene such that the two-dimensional streamline plot takes the place of the red plane in the image below. Although I could simply rasterize the streamline plot, treat it as a texture for the plane, and render the scene in 3DS Max, I'm hoping to overlay the streamline plots as vector graphics.
Addendum: As per Yves' suggestion, I have supplied a subsampled version of the windflow velocity field that I am using for my plots. Using his wonderful script, I am able to take a two-dimensional streamline plot and rotate/scale it as if it was a three-dimensional plot.
data = {{{1, 1}, {1.0, 0.0}}, {{11, 1}, {0.971194, 0.0}}, {{21, 1}, {0.963011, 0.0}}, {{31, 1}, {0.993688, 0.0}}, {{41, 1}, {1.023889, 0.0}}, {{51, 1}, {1.024193, 0.0}}, {{61, 1}, {1.010802, 0.0}}, {{71, 1}, {1.032089, 0.0}}, {{81, 1}, {1.026697, 0.0}}, {{91, 1}, {0.987981, 0.0}}, {{101, 1}, {1.025693, 0.0}}, {{111, 1}, {1.105825, 0.0}}, {{121, 1}, {1.098795, 0.0}}, {{131, 1}, {1.065537, 0.0}}, {{141, 1}, {1.012451, 0.0}}, {{151, 1}, {1.0, 0.0}}, {{1, 11}, {1.0, -0.083697}}, {{11, 11}, {0.932164, -0.106793}}, {{21, 11}, {0.925340, -0.192984}}, {{31, 11}, {1.122307, -0.187170}}, {{41, 11}, {1.161864, 0.085156}}, {{51, 11}, {0.976324, 0.115229}}, {{61, 11}, {0.978851, 0.035055}}, {{71, 11}, {1.049432, -0.030869}}, {{81, 11}, {0.936428, 0.062604}}, {{91, 11}, {0.912342, -0.146168}}, {{101, 11}, {1.147333, -0.143745}}, {{111, 11}, {1.166712, 0.127165}}, {{121, 11}, {1.041843, 0.129961}}, {{131, 11}, {1.045287, 0.083479}}, {{141, 11}, {0.994206, 0.122328}}, {{151, 11}, {1.0, 0.132739}}, {{1, 21}, {1.0, -0.023829}}, {{11, 21}, {0.890156, -0.030084}}, {{21, 21}, {0.674394, -0.050241}}, {{31, 21}, {0.0, 0.0}}, {{41, 21}, {0.658960, -0.210046}}, {{51, 21}, {0.716182, 0.091213}}, {{61, 21}, {0.472093, -0.225292}}, {{71, 21}, {0.732020, 0.265153}}, {{81, 21}, {0.843532, 0.369957}}, {{91, 21}, {0.279971, -0.348445}}, {{101, 21}, {0.963035, -0.753370}}, {{111, 21}, {1.002857, 0.538380}}, {{121, 21}, {0.756004, 0.204065}}, {{131, 21}, {0.806599, -0.138649}}, {{141, 21}, {0.913204, 0.279003}}, {{151, 21}, {1.0, 0.159432}}, {{1, 31}, {1.0, 0.044899}}, {{11, 31}, {0.908289, 0.060171}}, {{21, 31}, {0.856098, 0.122421}}, {{31, 31}, {0.762294, 0.042601}}, {{41, 31}, {0.0, 0.0}}, {{51, 31}, {-0.438033, 0.780580}}, {{61, 31}, {0.382021, -0.726038}}, {{71, 31}, {0.550500, -0.113628}}, {{81, 31}, {0.860478, 0.363810}}, {{91, 31}, {1.373814, -0.269792}}, {{101, 31}, {0.153576, -0.482892}}, {{111, 31}, {0.113453, 0.274464}}, {{121, 31}, {0.286391, 0.307524}}, {{131, 31}, {0.275092, -0.174137}}, {{141, 31}, {0.651551, -0.053446}}, {{151, 31}, {1.0, 0.028982}}, {{1, 41}, {1.0, 0.091944}}, {{11, 41}, {0.942248, 0.107845}}, {{21, 41}, {0.914909, 0.147823}}, {{31, 41}, {0.914062, 0.226842}}, {{41, 41}, {1.090780, 0.280458}}, {{51, 41}, {1.423264, 0.011814}}, {{61, 41}, {1.084930, -0.364051}}, {{71, 41}, {0.899861, -0.177124}}, {{81, 41}, {0.992899, -0.106340}}, {{91, 41}, {1.136605, -0.039446}}, {{101, 41}, {0.830366, 0.086879}}, {{111, 41}, {0.653521, 0.119604}}, {{121, 41}, {0.862727, 0.513709}}, {{131, 41}, {1.041204, -0.599559}}, {{141, 41}, {0.911816, -0.171321}}, {{151, 41}, {1.0, -0.089802}}, {{1, 51}, {1.0, 0.0}}, {{11, 51}, {0.972851, 0.0}}, {{21, 51}, {0.958161, 0.0}}, {{31, 51}, {0.956957, 0.0}}, {{41, 51}, {1.008198, 0.0}}, {{51, 51}, {1.082196, 0.0}}, {{61, 51}, {1.119506, 0.0}}, {{71, 51}, {1.011644, 0.0}}, {{81, 51}, {0.905500, 0.0}}, {{91, 51}, {0.811638, 0.0}}, {{101, 51}, {0.953396, 0.0}}, {{111, 51}, {0.978083, 0.0}}, {{121, 51}, {1.166181, 0.0}}, {{131, 51}, {1.289609, 0.0}}, {{141, 51}, {1.066669, 0.0}}, {{151, 51}, {1.0, 0.0}}};
ListStreamPlot[data, StreamPoints -> Fine][[1]] /. Arrow[pts_] :> Arrow[{#[[1]], 0, #[[2]]} & /@ pts] // Graphics3D
The only remaining question that I have is: how can I change the camera perspective parameters of the plot? Specifically, I would like change the perspective of the three-dimensional streamline plot such that the bounding box around the plot takes the shape of a trapezoid and the streamline trajectories are modified accordingly. I am aware that Graphics3D has ViewAngle
, ViewPoint
, and ViewVector
options, but I am unsure as to how to use them in the context of Yves' script.
StreamPlot[{x, -y}, {x, -3, 3}, {y, -3, 3}][[1]] /. Arrow[pts_] :> Arrow[{#[[1]], 0, #[[2]]} & /@ pts] // Graphics3D
$\endgroup$Texture
if you putPolygon
with thisSteamPlot
in 3D space the transformation will be automatic, as shown in the second answer from the first link. $\endgroup$