0
$\begingroup$

How can I make a "normal size" (not stretched) Graphics3D object from the following Plot3D?

im = Plot3D[-HurwitzZeta[-n, 1 + x] + Zeta[-n], {x, -4, 8},
{n, -8,8}, PlotPoints -> 60, MeshFunctions -> {#3 &}, 
ColorFunction -> Hue, ImageSize -> 800, ClippingStyle -> Blue, 
Lighting -> "Neutral", Background -> Black, Boxed -> False, 
Axes -> False, MaxRecursion -> 5, AspectRatio -> 1/GoldenRatio]

enter image description here

Graphics3D[{im[[1]]}]

enter image description here

$\endgroup$
4
  • 1
    $\begingroup$ It's not clear what you are after - im is a Graphics3D object. im[[1]] is a GraphicsComplex, and im[[2]] is a list of options. To avoid the stretching you are seeing, you could use Graphics3D[First@im, BoxRatios -> {1, 1, 1}], but really you are better off just deleting what options you don't want from im directly. $\endgroup$
    – Jason B.
    Commented Oct 10, 2017 at 19:11
  • $\begingroup$ @JasonB. I want to export it to the STL format, I tried Export["stl.stl", Graphics3D[First@im, BoxRatios -> {1, 1, 1}], "STL"] but the result is also stretched... $\endgroup$
    – vito
    Commented Oct 10, 2017 at 19:20
  • 2
    $\begingroup$ Try plotting (-HurwitzZeta[-n, 1 + x] + Zeta[-n])/1200 or use whatever scale works for you instead of 1200. It sounds like the STL exporter is using the actual coordinates and ignoring BoxRatios. The BoxRatios are used by the Front End to rescale the image. They don't actually affect the internal geometry of the graphics. $\endgroup$
    – Michael E2
    Commented Oct 10, 2017 at 19:23
  • 1
    $\begingroup$ Now that is a decent question, most likely you need to rescale the coordinates $\endgroup$
    – Jason B.
    Commented Oct 10, 2017 at 19:23

2 Answers 2

1
$\begingroup$

A quick and dirty method, which rescales the $x$, $y$, and $z$ directions of the plot to go from $0$ to $1$,

im2 = ReplacePart[im, {1, 1} -> Thread[Rescale /@ Thread[im[[1, 1]]]]];

Import@Export["test.stl", im2]

Mathematica graphics

$\endgroup$
1
$\begingroup$

Start with the plot:

p1 = Plot3D[Zeta[-n] - HurwitzZeta[-n, x + 1], {x, -4, 8}, {n, -8, 8},
            Axes -> None, Background -> Black, Boxed -> False, ClippingStyle -> Blue,
            ColorFunction -> Hue, Exclusions -> {{Sin[π x] == 0, x <= -1}},
            Lighting -> "Neutral", MeshFunctions -> {#3 &}, PlotPoints -> 30];

(Note the use of Exclusions to properly handle the singularities in HurwitzZeta[].)

For purposes of rescaling, let's look at the PlotRange:

PlotRange[p1]
   {{-4., 8.}, {-8., 8.}, {-524.866, 876.366}}

From this, I make a rough estimate of what to put in ScalingTransform[]:

Graphics3D[Cases[p1, GraphicsComplex[pts_, rest__] :> 
                 GraphicsComplex[ScalingTransform[{1, 1, 1/150}][pts], rest], ∞],
           Background -> Black, Boxed -> False, BoxRatios -> Automatic,
           Lighting -> "Neutral", ViewPoint -> {-2.4, -1.3, 2.}]

rescaled Hurwitz zeta function

$\endgroup$

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.