Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #5011
| From | "Christopher O. Young" <cy56@comcast.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Interactive settings for ParamPlot3D. Mesh not quite working. |
| Date | 2011-09-16 10:00 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j4v6nl$cbd$1@smc.vnet.net> (permalink) |
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@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}}
]
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Interactive settings for ParamPlot3D. Mesh not quite working. "Christopher O. Young" <cy56@comcast.net> - 2011-09-16 10:00 +0000
csiph-web