Message Boards Message Boards

Combine an Image with a ParametricPlot under DynamicModule?

I am trying to place an image imported from a cloud service to the background of a function. Here I try two alternative methods. The first one return an error and not sure. The second is getting to where I want but the image is rendering too small and want it to the resize to cover the full area of the Plot or at least the size of the image itself.

fromCartesian[a_, {x_, y_}] := 
 Module[{rA = Norm[{x + a, y}], 
   rB = Norm[{x - a, y}]}, {ArcCosh[(rA + rB)/(2 a)], (2 UnitStep[y] - 
      1) ArcCos[(rA - rB)/(2 a)]}]


(* BEGINGS EXAMPLE  ----This is a example to verify function---- *)



res = fromCartesian[3, {2, 5}] // 
  Simplify(* This converst from cartesian to Elliptical*)

N[%, 20]


toCartesian[a_, {\[Xi]_, \[Eta]_}] := {a Cosh[\[Xi]] Cos[\[Eta]], 
  a Sinh[\[Xi]] Sin[\[Eta]]}

Simplify[toCartesian[3, res]]

(*END EXAMPLE*)

tmax = 20;
\[Eta]Func[t_] := \[Pi] t/tmax
\[Xi]Func[t_] := t + tmax

pointLabel[{\[Xi]_, \[Eta]_}] := 
 Row[{"\[Xi] = ", ToString[\[Xi]], ", \[Eta] = ", ToString[\[Eta]]}]


skin = ServiceExecute["Flickr", 
  "AlbumImages", {"AlbumID" -> "72157679595085384", "Elements" -> "Images", 
   "ImageSize" -> "Large", MaxItems -> 5}]

(*  THIS IS THE ORIGINAL CODE obtained from WOrlfram Mathematica  *)

(*
Manipulate[
DynamicModule[{a,\[Xi],\[Eta]},
a=R/2;
{\[Xi],\[Eta]}=fromCartesian[a,pt];
ParametricPlot[Evaluate[{Tooltip[toCartesian[a,{\[Xi],\[Eta]Func[t]}],"\[Xi] \
constant"],Tooltip[toCartesian[a,{\[Xi]Func[t],\[Eta]}],"\[Eta] constant \
assyntote"]}],{t,-tmax,tmax},
PlotRange\[Rule]{{-15,15},{-10,10}},
Ticks\[Rule]True,
AxesLabel\[Rule](Style[#,Italic]&/@{"x","y"}),
PerformanceGoal\[Rule]"Quality",
Prolog\[Rule]{PointSize[0.02],Point[{a,0}],Point[{-a,0}]},
Epilog\[Rule]{Transparent,PointSize[0.1],Tooltip[Point[pt],pointLabel[{\[Xi],\
\[Eta]}]]},
PlotStyle\[Rule]Thick,
ImageSize\[Rule]500,
PlotLabel\[Rule]"elliptic coordinates (\[Xi], \[Eta])"]],
{{pt,{1.88,-4.11}},{-20,-20},{20,20},Locator},
{{R,10.,"interfocal separation"},0.001,20.},
SaveDefinitions\[Rule]True]
*)

Manipulate[
 DynamicModule[{a, \[Xi], \[Eta]},
  a = R/2;
  {\[Xi], \[Eta]} = fromCartesian[a, pt];

  Show[skin[[1]],
   ParametricPlot[
    Evaluate[{Flatten[
       Table[toCartesian[a, {z*\[Xi], \[Eta]Func[t]}], {z, 1/2, 2, 1/8}]], 
      Tooltip[toCartesian[a, {\[Xi], \[Eta]Func[t]}], "\[Xi] constant"], 
      Tooltip[toCartesian[a, {\[Xi]Func[t], \[Eta]}], 
       "\[Eta] constant assyntote"]}], {t, -tmax, tmax},
    PlotRange -> {{-15, 15}, {-10, 10}},
    Ticks -> True,
    AxesLabel -> (Style[#, Italic] & /@ {"x", "y"}),
    PerformanceGoal -> "Quality",
    Prolog -> {PointSize[0.02], Point[{a, 0}], Point[{-a, 0}]},
    Epilog -> {Transparent, PointSize[0.1], 
      Tooltip[Point[pt], pointLabel[{\[Xi], \[Eta]}]]},
    PlotStyle -> Thick,
    ImageSize -> 1000,
    PlotLabel -> "elliptic coordinates (\[Xi], \[Eta])"
    ]
   ]],
 {{pt, {1.88, -4.11}}, {-20, -20}, {20, 20}, Locator},
 {{R, 10., "interfocal separation"}, Exp[-10], 20.},
 SaveDefinitions -> True]


Manipulate[
 DynamicModule[{a, \[Xi], \[Eta]},
  a = R/2;
  {\[Xi], \[Eta]} = fromCartesian[a, pt];


  ParametricPlot[
   Evaluate[{Flatten[
      Table[toCartesian[a, {z*\[Xi], \[Eta]Func[t]}], {z, 1/2, 2, 1/8}]], 
     Tooltip[toCartesian[a, {\[Xi], \[Eta]Func[t]}], "\[Xi] constant"], 
     Tooltip[toCartesian[a, {\[Xi]Func[t], \[Eta]}], 
      "\[Eta] constant assyntote"]}], {t, -tmax, tmax},
   PlotRange -> {{-15, 15}, {-10, 10}},
   Ticks -> True,
   AxesLabel -> (Style[#, Italic] & /@ {"x", "y"}),
   PerformanceGoal -> "Quality",
   Prolog -> {Inset[skin[[1]]], PointSize[0.02], Point[{a, 0}], 
     Point[{-a, 0}]},
   Epilog -> {Transparent, PointSize[0.1], 
     Tooltip[Point[pt], pointLabel[{\[Xi], \[Eta]}]]},
   PlotStyle -> Thick,
   ImageSize -> 1000,
   PlotLabel -> "elliptic coordinates (\[Xi], \[Eta])"

   ]],
 {{pt, {1.88, -4.11}}, {-20, -20}, {20, 20}, Locator},
 {{R, 10., "interfocal separation"}, Exp[-10], 20.},
 SaveDefinitions -> True]
POSTED BY: Jose Calderon
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract