Re: Ragged region boundary
- To: mathgroup at smc.vnet.net
- Subject: [mg123269] Re: Ragged region boundary
- From: Chris Young <cy56 at comcast.net>
- Date: Tue, 29 Nov 2011 08:06:06 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <javpho$jct$1@smc.vnet.net> <jb2i3g$5hk$1@smc.vnet.net>
This looks like a great idea. Thanks very much. Unfortunately, I can't seem to find a C compiler on my Mac. Maybe Apple is charging for the development package now, I don't know. I'll look into it. In[80]:= Needs["CCompilerDriver`"] In[86]:= CCompilers[] Out[86]= {} On 2011-11-29 12:10:24 +0000, Patrick Scheibe said: > 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} > ]