Re: Ragged region boundary
- To: mathgroup at smc.vnet.net
- Subject: [mg123439] Re: Ragged region boundary
- From: Christopher Young <cy56 at comcast.net>
- Date: Wed, 7 Dec 2011 06:15:40 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201111281054.FAA19792@smc.vnet.net> <1322557751.1684.47.camel@warp>
Thanks very much, that sped things up quite a bit. On Nov 29, 2011, at 4:09 AM, Patrick Scheibe wrote: > Hi, > > first you could compile your torus-function and compare the runtimes > > torus[c_, a_, u_, v_] := {(c + a Cos[v]) Cos[u], (c + a Cos[v]) Sin[u], > a Sin[v]}; > torusCompiled = > Compile[{{c, _Real}, {a, _Real}, {u, _Real}, {v, _Real}}, > {(c + a Cos[v]) Cos[u], (c + a Cos[v]) Sin[u], a Sin[v]}, > CompilationTarget -> "C"]; > > In[38]:= First[ > AbsoluteTiming[Do[#[1.3, 0.3, 2.3, 4.5], {1000000}]]] & /@ {torus, > torusCompiled} > > Out[38]= {5.190318, 0.863473} > > and then you could set MaxRecursion to a higher value. Since then the > runtime drops further, you could use ControlActive to use a very fast > version, when you use the sliders. See the code at the end. > > Your "equator" is not the only unwanted boundary, but you don't see the > other one. These are the lines where your PlotRange ends. The doc to > BoundaryStyle says > > "For 3D graphics, it is also used at the boundary of regions defined by > PlotRange." > > So these lines are at 0 and 2Pi for both of your variables. I have no > idea how to turn them off. > > Cheers > Patrick > > Manipulate[ > ParametricPlot3D[ > torusCompiled[c, a, u, v], {u, 0, 2 \[Pi]}, {v, 0, 2 \[Pi]}, > MeshFunctions -> {{x, y, z, \[Theta], \[Phi]} \[Function] > z + Tan[tilt] x}, > RegionFunction -> ({x, y, z, \[Theta], \[Phi]} \[Function] > z <= -Tan[tilt] x), > Mesh -> mesh, > MaxRecursion -> ControlActive[0, 5], > MeshStyle -> {Lighter[Yellow], Tube[tubeR]}, > BoundaryStyle -> {Lighter[Red], Tube[tubeR]}, > PlotStyle -> {Orange, Opacity[opac]}, > PlotPoints -> ControlActive[10, plotPts], > Axes -> True, > AxesLabel -> {"x", "y", "z"}, > PlotRange -> {{-4, 4}, {-4, 4}, {-3, 3}}, > BoxRatios -> {8, 8, 6}, > ViewPoint -> > { > viewR Cos[view\[Theta]] Sin[view\[Phi]], > viewR Sin[view\[Theta]] Sin[view\[Phi]], > viewR Cos[view\[Phi]] > }, > PerformanceGoal -> "Quality" > ], > > {{c, 3}, 0, 4}, > {{a, 1}, 0, 3}, > {{sphereR, 0.1}, 0, 0.5}, > {{tubeR, 0.05}, 0, 0.5}, > {{opac, 0.5}, 0, 1}, > {{mesh, 0}, 0, 16, 1}, > {{tilt, N[ArcSin[a/c]]}, 0, \[Pi]/2, \[Pi]/36}, > {{plotPts, 50}, 0, 200, 5}, > {{viewR, 100}, 0, 100, 5}, > {{view\[Theta], \[Pi]/2}, 0, 2 \[Pi], \[Pi]/36}, > {{view\[Phi], \[Pi]/2}, 0, \[Pi], \[Pi]/36} > ] > > On Mon, 2011-11-28 at 05:54 -0500, Chris Young wrote: >> Would anyone have any tips on how to get a better region boundary here? >> Maybe via CountourPlot3D? >> >> Actually, if I use PlotPoints -> 200, it's OK, but it's extremely slow >> to plot then, of course. >> >> Also, I don't want the horizontal "boundary" line at the equator. Can't >> see why this is considered a boundary line anyway. >> >> http://home.comcast.net/~cy56/RegionBoundary.nb >> >> http://home.comcast.net/~cy56/RegionBoundary.png >> >> >> Manipulate[ >> ParametricPlot3D[ >> torus[c, a, u, v], {u, 0, 2 \[Pi]}, {v, 0, 2 \[Pi]}, >> MeshFunctions -> {{x, y, z, \[Theta], \[Phi]} \[Function] >> z + Tan[tilt] x}, >> RegionFunction -> ({x, y, z, \[Theta], \[Phi]} \[Function] >> z <= -Tan[tilt] x), >> Mesh -> mesh, >> MeshStyle -> {Lighter[Yellow], Tube[tubeR]}, >> BoundaryStyle -> {Lighter[Red], Tube[tubeR]}, >> PlotStyle -> {Orange, Opacity[opac]}, >> PlotPoints -> plotPts, >> Axes -> True, >> AxesLabel -> {"x", "y", "z"}, >> PlotRange -> {{-4, 4}, {-4, 4}, {-3, 3}}, >> BoxRatios -> {8, 8, 6}, >> ViewPoint -> >> { >> viewR Cos[view\[Theta]] Sin[view\[Phi]], >> viewR Sin[view\[Theta]] Sin[view\[Phi]], >> viewR Cos[view\[Phi]] >> }, >> PerformanceGoal -> "Quality" >> ], >> >> {{c, 3}, 0, 4}, >> {{a, 1}, 0, 3}, >> {{sphereR, 0.1}, 0, 0.5}, >> {{tubeR, 0.05}, 0, 0.5}, >> {{opac, 0.5}, 0, 1}, >> {{mesh, 1}, 0, 16, 1}, >> {{tilt, N[ArcSin[a/c]]}, 0, \[Pi]/2, \[Pi]/36}, >> {{plotPts, 50}, 0, 100, 5}, >> {{viewR, 100}, 0, 100, 5}, >> {{view\[Theta], \[Pi]/2}, 0, 2 \[Pi], \[Pi]/36}, >> {{view\[Phi], \[Pi]/2}, 0, \[Pi], \[Pi]/36} >> ] >> >> > > Chris Young cy56 at comcast.net