Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8007
| From | Chris Young <cy56@comcast.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Slow plotting of reflected parametric "butterflies" |
| Date | 2012-01-19 10:18 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jf8ql4$3pl$1@smc.vnet.net> (permalink) |
I'm wondering if there's anyway I can speed this up. It's basically
just some sections of a parabolic hyperboloid, with the outer edges
curves. I'm porting it from another program, where it ran much faster.
I had to chop it up into parts for that program, but maybe this isn't
the best way to do it in Mathematica.
http://home.comcast.net/~cy56/Mma/ReflectedButterflies.nb
http://home.comcast.net/~cy56/Mma/ReflectedButterfliesPic.png
Chris Young
cy56@comcast.net
\[HorizontalLine]CurvedButterfly[A_, B_, C_, D_, u_,
v_, \[ScriptC]_] :=
Table[
(A + B + C + D)/4 +
j Sqrt[1 - \[ScriptC] v] u/2 ((A + C)/2 - (B + D)/2) +
k u/2 v (((C + D)/2 + j u (C - D)/2) - ((A + B)/2 +
j u (A - B)/2)),
{j, {-1, 1}}, {k, {-1, 1}}
] // FullSimplify // Flatten[#, 1] &
Putting Butterfly into a Manipulate module:
Manipulate[
With[
{
A = {Ax, Ay, Az},
B = {Bx, By, Bz},
C = {Cx, Cy, Cz},
D = {Dx, Dy, Dz}
},
Show[
ParametricPlot3D[
Table[
( {
{\[ScriptI], 0, 0},
{0, \[ScriptJ], 0},
{0, 0, \[ScriptK]}
} ). # & /@ \[HorizontalLine]CurvedButterfly[A, B, C, D, u,
v, wingCurve],
{\[ScriptI], {-1, 1}}, {\[ScriptJ], {-1, 1}}, {\[ScriptK], {-1,
1}}],
{u, 0, 1}, {v, 0, 1},
PlotRange -> 2.5,
Lighting -> "Neutral",
ColorFunctionScaling -> False,
ColorFunction -> ({x, y, z, u, v} \[Function]
Hue[\[LeftFloor]5 v\[RightFloor]/10]),
Mesh -> None,
PlotPoints -> plotPts,
AxesLabel -> {"x", "y", "z"}
],
Graphics3D[
{
With[{pts = {A, B, C, D}},
Table[{Hue[(k - 1)/4], Sphere[pts[[k]], ptRad]}, {k, 1, 4}]
]
}
]
]
],
{{Ax, 1.25}, -2.5, 2.5, 0.03125},
{{Ay, 2}, -2.5, 2.5, 0.03125},
{{Az, 0.75}, -2.5, 2.5, 0.03125},
{{Bx, 1.75}, -2.5, 2.5, 0.03125},
{{By, 0.5}, -2.5, 2.5, 0.03125},
{{Bz, 0.125}, -2.5, 2.5, 0.03125},
{{Cx, 0.5}, -2.5, 2.5, 0.03125},
{{Cy, 0.375}, -2.5, 2.5, 0.03125},
{{Cz, 0.25}, -2.5, 2.5, 0.03125},
{{Dx, 0.375}, -2.5, 2.5, 0.03125},
{{Dy, 0.125}, -2.5, 2.5, 0.03125},
{{Dz, 1.25}, -2.5, 2.5, 0.03125},
{{plotPts, 4}, 2, 30, 1},
{{ptRad, 0.1}, 0, 0.3},
{{wingCurve, 0}, 0, 1}
]
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Slow plotting of reflected parametric "butterflies" Chris Young <cy56@comcast.net> - 2012-01-19 10:18 +0000
csiph-web