2
$\begingroup$

enter image description here

I was working on some geometric manipulation and hoping to further process this graphic's isolines however I was stumped as how best to do that when I looked at the object's GraphicsComplex. I was expecting to see something similar to a question I asked last year about Mesh lines.

c = RevolutionPlot3D[{ x-0.2,-2 x},{x,0.7,1},
  Boxed->False,
  Axes->False,
  Mesh->{8,4}
]
c[[1,1,1,2]]

enter image description here

I'm using Mathematica 12.1 and tired the older function in the other thread too and it returns a similarly confusing GraphicComplex. 5 Dimensional polygons? Lines with one list for it's coordinates? I don't remember how I extracted the isolines.

Can someone describe to me how to extract the Mesh lines from a GraphicsComplex?

$\endgroup$
1

3 Answers 3

6
$\begingroup$

If you just need lines, you can take Normal and extract lines from it:

lines = Cases[Normal[c], _Line, Infinity];

Graphics3D[lines]

mesh lines

$\endgroup$
5
$\begingroup$

To add to halmir's answer: if you don't need the surface, just use PlotStyle -> None:

RevolutionPlot3D[{x - 0.2, -2 x}, {x, 0.7, 1}, Axes -> None, Boxed -> False,
                 Mesh -> {8, 4}, PlotStyle -> None]

which should give the same picture.

Note that this also includes the setting of BoundaryStyle; if you set it to None, you get this instead:

mesh without boundary

$\endgroup$
3
$\begingroup$

Another way:

plot /. GraphicsComplex[p_, g_, o___] :> 
  GraphicsComplex[p, Cases[g, _Line, Infinity]]

enter image description here

$\endgroup$
1
  • 2
    $\begingroup$ ...and one can of course take the complementary approach: DeleteCases[plot, _Polygon, ∞] $\endgroup$ Commented Apr 23, 2020 at 0:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.