I'm trying to extract the data points from a general 3D surface and saving the data points, in the form of the coordinate triples $\mathbf{ \{ x,y,z\} }$, in a table/array in the format: $\mathbf{\{ \{ x_1,y_1,z_1\} , \{ x_2,y_2,z_2\} , ..., \{ x_n,y_n,z_n\} \} }$.
With a cylinder this is quite easy since we know that for a cylinder:
$\mathbf{x^2+y^2=r^2}$
$\mathbf{ x=t_1}$
$\mathbf{ y=n \cdot \sqrt{r^2-t_1^2}}$
$\mathbf{ z=t_2}$
where $n$ is either +1 or -1. So for a cylinder with radius 1 and length 10 we can generate the table as:
step=0.1
data = Table[{x = t1, y = n*(1 - t1^2)^(1/2), z = t2},
{t1, -1, 1,step}, {t2, 0, 10, step}, {n,{-1,1}}];
I would like to know if there exist an easier way to do this? I have tried executing Table[plot]
but that doesn't seem to save any data points it just saves the plot itself in the table as an element.
I just started learning Mathematica yesterday so I am a complete beginner, so be easy on me please.
plot
in yourTable[plot]
? $\endgroup$plot = RegionPlot3D[ x^2 + y^2 <= n + 0.1 && x^2 + y^2 >= n, {x, -2, 2}, {y, -2, 2}, {z, -20, 20}, PlotPoints -> 120, ImageSize -> Large], {n, 1, 1.1, 0.1}
$\endgroup$