Interactive settings for ParamPlot3D. Mesh not quite working.
- To: mathgroup at smc.vnet.net
- Subject: [mg121483] Interactive settings for ParamPlot3D. Mesh not quite working.
- From: "Christopher O. Young" <cy56 at comcast.net>
- Date: Fri, 16 Sep 2011 05:50:41 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
I'm trying to make a template for interactive graphing with the settings I like, and controls to change the bounding box, etc. Everything is working except that I'm not able to set the mesh correctly. Checking or unchecking one of the boxes causes _all_ the mesh to be toggled off, not just one of the mesh specifications. I think I'm constructing the list of specifications according to the Help documentation. I put in and empty list for the mesh function I don't want any mesh for. Do I need to make this a Dynamic module? I don't see why, since I'm passing in the value via the drawXMesh, drawYMesh, and drawZMesh arguments to saddleParamPlot3. Thanks for any help. Chris Young cy56 at comcast.net saddleParamPlot3[ opacity_, xBnds_, yBnds_, zBnds_, drawXMesh_, drawYMesh_, drawZMesh_ ] := Module[ { meshSpecs = { If[drawXMesh, Range[-xBnds, xBnds], {}], If[drawYMesh, Range[-yBnds, yBnds], {}], If[drawZMesh, Range[-zBnds, zBnds], {}] } },(* Specifications for the mesh; i.e., in which directions. *) Print["Mesh specs are: ", meshSpecs]; ParametricPlot3D[ Flatten[ { {u}, {v}, {u v} } ], {u, -xBnds, xBnds}, {v, -xBnds, xBnds}, PlotRange -> {{-xBnds, xBnds}, {-yBnds, yBnds}, {-zBnds, zBnds}}, BoxRatios -> {xBnds, yBnds, zBnds}, SphericalRegion -> True, FaceGrids -> { { {1, 0, 0}, {Range[-xBnds, xBnds], Range[-zBnds, zBnds]} }, { {0, 1, 0}, {Range[-yBnds, yBnds], Range[-zBnds, zBnds]} }, { {0, 0, 1}, {Range[-xBnds, xBnds], Range[-yBnds, yBnds]} } }, MeshFunctions -> {#1 &, #2 &, #3 &}, Mesh -> meshSpecs, BoundaryStyle -> Gray, AxesLabel -> {"x", "y", "z"}, PlotStyle -> Opacity[opacity], ColorFunctionScaling -> False, ColorFunction -> (Hue[0.35 (#3 + 4)/8 ] &) ] /. Line[pts_, opts___] :> {Gray, Tube[pts, 0.03, opts]} ] Manipulate[ saddleParamPlot3[opac, xBnds, yBnds, zBnds, drawXMesh, drawYMesh, drawZMesh], {{opac, 0.5, "Opacity"}, 0, 1} , {{xBnds, 4, "x bounds"}, 0, 4, 1} , {{yBnds, 4, "y bounds"}, 0, 4, 1} , {{zBnds, 4, "z bounds"}, 0, 4, 1} , {{drawXMesh, True, "x mesh"}, {True, False}}, {{drawYMesh, True, "y mesh"}, {True, False}}, {{drawZMesh, True, "z mesh"}, {True, False}} ]
- Follow-Ups:
- Re: Interactive settings for ParamPlot3D. Mesh not quite working.
- From: Heike Gramberg <heike.gramberg@gmail.com>
- Re: Interactive settings for ParamPlot3D. Mesh not quite working.