Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6823
| From | Chris Young <cy56@comcast.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Ragged region boundary |
| Date | 2011-11-29 13:06 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jb2ld2$6q5$1@smc.vnet.net> (permalink) |
| 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}
> ]
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Ragged region boundary Patrick Scheibe <pscheibe@trm.uni-leipzig.de> - 2011-11-29 12:10 +0000 Re: Ragged region boundary Chris Young <cy56@comcast.net> - 2011-11-29 13:06 +0000 Re: Ragged region boundary Patrick Scheibe <pscheibe@trm.uni-leipzig.de> - 2011-11-30 08:31 +0000
csiph-web