RE: surface dependent mesh or a smooth surface?
- To: mathgroup at smc.vnet.net
- Subject: [mg38282] RE: [mg38197] surface dependent mesh or a smooth surface?
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 10 Dec 2002 04:17:45 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Veniamin, Yes, you can make the "mesh" better fit the surface by doing a coordinate transformation for the plotting and then reverse transform all of the points. It may not always be easy to find suitable transformations. Here is an easy case. f[x_, y_] := Exp[-x] Plot3D[Evaluate[f[x, y]], {x, 0, 10}, {y, 0, 10}, PlotPoints -> {20, 10}, BoxRatios -> {1, 1, 1}, PlotRange -> All]; The above plot is not great because it has wide spacings in the steepest part of the surface and narrow spacings in the flat portion. What we do is make a plot versus Log[x]. plot1 = Plot3D[Evaluate[f[E^u, y]], {u, -3, Log[10]}, {y, 0, 10}, PlotPoints -> {20, 10}]; Of course, that isn't what you really want but it has better spacing. Now we convert the plot from SurfaceGraphics to Graphics3D and take the first part to obtain the primitive graphics. logplot = First[Graphics3D[plot1]]; Then we display the plot using a rule to transform all of the points in the plot to get back to the x scale. Show[Graphics3D[ logplot /. {u_?NumberQ, y_?NumberQ, z_?NumberQ} -> {Exp[u], y, z}], Axes -> True, AxesLabel -> {x, y, f}, BoxRatios -> {1, 1, 1}, ImageSize -> 450]; Now you have close spacing in the steep part of the surface and wide spacing in the flat portion. This can be done a little easier with the DrawGraphics package at my web site below. The plot routines automatically extract the primitive graphics, which can then be manipulated - here with the DrawingTransform3D routine. Needs["DrawGraphics`DrawingMaster`"] Draw3DItems[ {Draw3D[Evaluate[f[Exp[u], y]], {u, -3, Log[10]}, {y, 0, 10}, PlotPoints -> {20, 10}] /. DrawingTransform3D[Exp[#1] &, #2 &, #3 &]}, Axes -> True, AxesLabel -> {x, y, f}, BoxRatios -> {1, 1, 1}, ImageSize -> 450]; Mathematica automatically uses even spacing in a rectangular domain for all the plotting so this type of procedure is needed to change that. DrawGraphics also has routines for transforming plotting functions so that the plotting domain does not have to be rectangular or the second plotting domain can depend upon the first. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Veniamin Abalmassov [mailto:V.Abalmassov at unibas.ch] To: mathgroup at smc.vnet.net Hello, I use Plot3D to plot a function which is exponential in one region and almost a constant in the other. If I specify PlotPoints ->50 (say), costant region is well presented but there are too few points when the surface is very sharp. Is there any possibility to get a smooth surface everywhere? As far as I know MaxBend, which defines a maximum possible angle between succesive line segments, can help for ContourPlot3D but in the case of a Plot3D? Thank you in advance for useful comments, Veniamin