Re Bezier curves mapped from 2D to 3D surface
- To: mathgroup at smc.vnet.net
- Subject: [mg124650] Re Bezier curves mapped from 2D to 3D surface
- From: Chris Young <cy56 at comcast.net>
- Date: Sat, 28 Jan 2012 06:36:52 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
I fixed it so the curves are mapped correctly to the saddle surface. I forgot that my butterfly function was a set of 2D vectors. Changing the "@" to a "/@" fixed everything. However, now it's impossibly slow. http://home.comcast.net/~cy56/Mma/BezCurveToSurface2.nb http://home.comcast.net/~cy56/Mma/BezCurveToSurface2Pic.png DynamicModule[ { \[ScriptCapitalP], (* the points for each Bézier curve *) \[ScriptCapitalC], \ (* the parametric functions for the Bézier curves *) PM, (* the points for the morphing Bézier curves *) CM, (* the parametric functions for the morphing Bézier curves *) curveStyle, wing, butterfly, butterflyPlot }, (* s is the number of curves *) curveStyle[a_, b_, c_, s_, th_] := Table[ {Directive[AbsoluteThickness[th], Hue[vFnc[a, b, c, k]]]}, {k, 0, 1, 1/s}]; wing[n_, t_, s_] := Table[CM[n][k, t], {k, 0, 1, 1/s}]; butterfly[t_, s_] := Join[wing[1, t, s], wing[2, t, s]]; butterflyPlot[a_, b_, c_, s_, th_] := ParametricPlot[ Evaluate @ butterfly[t, s - 1], {t, 0, 1}, PlotStyle -> curveStyle[a, b, c, 2 s - 1, th] ]; Dynamic @ Manipulate[ \[ScriptCapitalP][1] = Take[P, {1, 5}]; \[ScriptCapitalP][2] = Take[P, {6, 10}]; \[ScriptCapitalP][3] = Take[P, {11, 15}]; \[ScriptCapitalC][1][ t_] := \[HorizontalLine]Bez[\[ScriptCapitalP][1], t]; \[ScriptCapitalC][2][ t_] := \[HorizontalLine]Bez[\[ScriptCapitalP][2], t]; \[ScriptCapitalC][3][ t_] := \[HorizontalLine]Bez[\[ScriptCapitalP][3], t]; PM[1][n_] := (1 - n) \[ScriptCapitalP][1] + n \[ScriptCapitalP][2]; PM[2][n_] := (1 - n) \[ScriptCapitalP][2] + n \[ScriptCapitalP][3]; CM[1][n_, t_] := \[HorizontalLine]Bez[PM[1][n], t]; CM[2][n_, t_] := \[HorizontalLine]Bez[PM[2][n], t]; Grid[ { { LocatorPane[ Dynamic @ P, Dynamic @ Show[ butterflyPlot[a, b, c, nCurves, thick], Graphics @ {Gray, Dashed, Line[\[ScriptCapitalP][1]], Line[\[ScriptCapitalP][2]], Line[\[ScriptCapitalP][3]]}, PlotRange -> 2, Axes -> True, ImageSize -> 4* 72 ], {{-2, -2}, {2, 2}, {.25, .25}} ], Dynamic @ Show[ ParametricPlot3D[ \[HorizontalLine]Saddle @ {u, v}, {u, -2, 2}, {v, -2, 2}, PlotStyle -> Opacity[opac], Mesh -> False ], ParametricPlot3D[ \[HorizontalLine]Saddle /@ butterfly[t, nCurves], {t, 0, 1} ] /. Line[pts_, rest___] :> Tube[pts, 0.05, rest], PlotRange -> 2, ImageSize -> 4* 72 ] } } ], {{P, { {-1, -2}, {-1, -1}, {-1, 0}, {-1, 1}, {-1, 2}, { 0, -2}, { 0, -1}, { 0, 0}, { 0, 1}, { 0, 2}, { 1, -2}, { 1, -1}, { 1, 0}, { 1, 1}, { 1, 2} } }, None}, {{nCurves, 5}, 1, 20, 1}, (* one less than the number of "morphing" curves *) {{thick, 12}, 1, 30, 1}, (* start, end, and middle hues *) {{a, 0.1}, 0, 1}, {{b, 0.5}, 0, 1}, {{c, 0.1}, 0, 1}, {{opac, 0.75}, 0, 1} ] ]