2
$\begingroup$

I am using Mandelbrot Set function in Mathematica to get the Mandelbrot plot. I want to 3d print this model, so want to specify thickness for each contour and then convert into .STL file. Is this possible?

$\endgroup$
2
  • $\begingroup$ What Mathematica function are you using to create a Mandelbrot Set contour plot? ManderbrotPlot produces a raster plot, according to its documentation. $\endgroup$
    – bbgodfrey
    Oct 31, 2018 at 22:27
  • $\begingroup$ Can you provide some type of example of what you wish the output to be? In my experience the neat features of a M-Set are far too fine to be rendered with current 3D printers. $\endgroup$ Nov 1, 2018 at 15:28

2 Answers 2

2
$\begingroup$

Here's an approach based on converting the image to LAB and using the L channel

baseData = ImageData[
   ColorConvert[
    MandelbrotSetPlot[Frame -> None, PlotRangePadding -> None],
    "LAB"
    ]
   ];

ListPlot3D[baseData[[;; , ;; , 1]], PlotRange -> All, Boxed -> False, 
 Axes -> False]

enter image description here

This won't print well at all because of the tiny spikes. You can also smooth some of that out if you want a somewhat more printable version

ListPlot3D[
 BlockMap[
  Mean@*Flatten,
  Clip[baseData[[;; , ;; , 1]], {0.001, 1}, {1, 1}],
  {3, 2}
  ], PlotRange -> All, Boxed -> False, Axes -> False]

enter image description here

Finally, if you are willing to figure out what L value each contour corresponds to, you can use Map to set things to that heigh

$\endgroup$
1
$\begingroup$

enter image description here

pts = ImageData[ColorNegate@Binarize@bild];
g = RegionPlot3D[
    pts[[Sequence @@ Round@{i, j}]] == 1, {i, 1, #1}, {j, 1, #2}, {z, 
     0, 1}, PlotPoints -> 100, Mesh -> False, Axes -> False, 
    Boxed -> False] & @@ Dimensions[pts]
pts = Cases[g, x_GraphicsComplex :> First@x, Infinity]

extruded Mandelbrot plot

This can be exported to STL via the built-in.

Modern alternatives are:

With[{h = 50},(*height*)
 RegionProduct[ImageMesh[bild], MeshRegion[{{0}, {h}}, Line[{1, 2}]]]]

and

ImageMesh[Image3D[ConstantArray[bild, 50]]]

h is here pixel.

Export["Test.stl", pts, {"STL", "BinaryFormat" -> False}]

This example might not be complete on Import.

$\endgroup$
1
  • $\begingroup$ OP wants to be able to specify a different thickness for each contour. This only provides a uniform thickness. $\endgroup$
    – b3m2a1
    Mar 11, 2021 at 17:46

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.