-1

I have a plot of an implicit function. I would like to extract all the data points from the graph. The plot is done using contourplot and cannot be plot with plot command.

yode
  • 26,686
  • 4
  • 62
  • 167
  • Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Oct 10 '17 at 11:42

1 Answers1

4

Here a random example plot:

plot = ContourPlot3D[x^2 + y^2 - z^2 == 1, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]

enter image description here

Surfaces in such plots are usually represented by GraphicsComplexes in compressed notation. The first entry in such a GraphicsComplex is always the list of vertex coordinates (followed by specifications of Polygons via a list of integer tuples, wrapped in Polygon).

We can extract a list of all GraphicsComplexes from a plot with

gclist = Cases[plot, _GraphicsComplex, \[Infinity]];

In this case, there is only one GraphicsComplex, so gclist has length 1. The vertex positions can thus be obtained with gclist[[1, 1]] as in the following example

Graphics3D[Point[gclist[[1, 1]]]]

enter image description here

Henrik Schumacher
  • 106,770
  • 7
  • 179
  • 309