# Extract data points from ContourPlot3D

I have a ContourPlot3d shown below. There are some posts (157477) (3015) (19859) that showed how to extract points using a combination of Cases and GraphicsComplex, however, I don't quite understand the structure of their code. To be specific, there are no explanations on how they configured the number of points and the range of how the points are going to be generated.

My goal is to generate data points of the surface, BUT I would like to generate the data points where I can set how many equally spaced points I like, in addition the points should start near the edge of the surface (it doesn't have to start exactly from the range that I set, e.g. tmin, tmax, umin, umax, zmin, zmax). Actually, I do not need so many points, I just need enough points that resembles the plot, that is why I need an option to adjust the number of points and the range. If possible, the data points should be arranged like {{t1,u1,z1},{t2,u2,z2},...} where t1<t2, u1<u2, i.e. from the left side of the plot going to the right side.

u0 = 10;
tmin = 1;
tmax = 20;
umin = 1;
umax = 10;
zmin = 1;
zmax = 10;
mu = (1/u - 1/u0);
int = Integrate[1/(1 - mu z^(d + 1)), z] /. {d -> 3};
plot = ContourPlot3D[u + int - t == 0, {t, tmin, tmax}, {u, umin, umax}, {z, zmin, zmax}, AxesLabel -> {time, u, z}, PlotLegends -> Automatic] The structure of your 3D plot is:

Graphics3D[List[GraphicsComplex[{points,..},...

"points" are the coordinates of the points used. In the rest, these points are referenced only by their index. Therefore, to get at the points, you write:

plot = ContourPlot3D[
u + int - t == 0, {t, tmin, tmax}, {u, umin, umax}, {z, zmin, zmax},
AxesLabel -> {time, u, z}, PlotLegends -> Automatic];
points= plot[[1,1,1]];


This gives a list of coordinates. To sort them so that x1<=x2..:

  points= points// Sort;


The first 10 points are:

points[[;;10]]

{{2.46025, 1.07031, 1.}, {2.4623, 1.14063, 1.}, {2.48438, 1.02123,
1.}, {2.48438, 1.07031, 1.0563}, {2.48438, 1.14063,
1.00504}, {2.48438, 1.20659, 1.}, {2.48631, 1.21094, 1.}, {2.50778,
1., 1.}, {2.52253, 1.28125, 1.}, {2.56644, 1.35156, 1.}}

• How do you add the option of point intervals? For example, 15 equally spaced points in the ‘t’ direction and for each ‘t’ value I would like 20 equally space points running in the u-z direction. Jan 12 at 2:21
• You can play with the options "PlotPoints" and "PlotRange" of "ContourPlot". You can not directly specify the points. Jan 12 at 9:17

Try

tuz = Values@FindInstance[{u + int - t == 0, tmin < t < tmax, umin < u < umax,zmin < z < zmax}, {t, u, z}, 20] // N
(*{{12.2783, 9.60909, 2.56815}, {11.3395, 9.35313, 1.94557},
{11.2569,9.50157, 1.73819}, {11.1687, 8.36482, 2.35313}, ...}*)

• In my V.13.0, it generates an error FindInstance::nsmet: The methods available to FindInstance are insufficient to find the requested instances or prove they do not exist. and Values::invrl: The argument FindInstance[{-t+u+(-2 ArcTan[<<1>>]+2 ArcTan[<<1>>]-Log[<<1>>]+Log[Plus[<<3>>]])/(4(2/5+Times[<<2>>])^(1/4))==0,3<t<20,3<u<10,1<z<10},{t,u,z},10] is not a valid Association or a list of rules. Also, why is the order in your result starts at {t1,u1,z1} = {12.2783, 9.60909, 2.56815}? For example, tmin = 1 so it should start near that value not 12.2783. Jan 11 at 18:24
• @mathemania MMA v12.2 evaluates without error. The points doesn't lie on a structrured grid. Jan 12 at 7:21