MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Dynamic Text in Manipulate.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112045] Re: Dynamic Text in Manipulate.
  • From: Christoph Lhotka <christoph.lhotka at univie.ac.at>
  • Date: Fri, 27 Aug 2010 04:06:13 -0400 (EDT)

Hello,

is it what you want?

Triangle[{A_, B_, C_}] := {Line[{A, B, C, A}],
   Text[StringReplace["A" <> ToString[A], "," -> ";"], A],
   Text[StringReplace["B" <> ToString[B], "," -> ";"], B],
   Text[StringReplace["C" <> ToString[C], "," -> ";"], C]}

Manipulate[
  Graphics[Triangle[{A, B, C}]],
  {{A, {0, 0}}, {0, 0}, {1, 1}},
  {{B, {1, 0}}, {0, 0}, {1, 1}},
  {{C, {0, 1}}, {0, 0}, {1, 1}},
  ControlType -> Slider2D, ControlPlacement -> Right]

best regards,
christoph

On 25/08/2010 12:04, Matthias Bode wrote:
> Hola:
>
> The code below shifts a triangle with Manipulate[]. I want the coordinates
> of the corners A{x;y}, B{x;y}, C{x;y} inside the {;} to change
> with the shift.
>
> Rather than my pedestrian dissecting method
>
>   Text["A {", {2 - u, 7/5 - u*(4/5)}],
> Text[Dynamic[2 - u, u], {2.2 - u, 7/5 - u*(4/5)}],
> Text[";", {2.32 - u, 7/5 - u*(4/5)}],
> Text[Dynamic[8/5 - u*(4/5), u], {2.45 - u, 7/5 - u*(4/5)}],
> Text["}", {2.6 - u, 7/5 - u*(4/5)}],
>
> in five steps I would like to represent "A{x;y}" in ONE command Text[].
>
> How can this be done?
>
> Best regards,
>
> MATTHIAS BODE
> S 17.35775=B0, W 066.14577=B0
>
> gra01 = Plot[x, {x, 0, 5}, AspectRatio ->  1,
>     PlotRange ->  {{-0.5, 5.1}, {-0.5, 5}},
>            AxesLabel ->  {x, y},
>     GridLines ->  {{1, 2, 13/5, 4, 23/5}, {4/5, 8/5, 11/5, 16/5, 23/5}},
>            PlotStyle ->  Directive[White]];
> Manipulate[Show[{gra01, Graphics[{Directive[PointSize[0.02]],
>
>       Point[{{2 - u, 8/5 - u*(4/5)}, {4 - u,
>          11/5 - u*(7/10)}, {23/5 - u, 23/5 - u*(7/10)}}],
>                  Directive[Thick],
>       Line[{{2 - u, 8/5 - u*(4/5)}, {4 - u, 11/5 - u*(7/10)},
>                        {23/5 - u, 23/5 - u*(7/10)}, {2 - u,
>          8/5 - u*(4/5)}}], Directive[Dashed, Thin, Red],
>
>       Line[{{2, 8/5}, {23/5, 8/5}, {23/5, 23/5}, {2, 23/5}, {2, 8/5}}],
>                  Line[{{4, 8/5}, {4, 11/5}}],
>       Line[{{23/5, 11/5}, {4, 11/5}}],
>                  Directive[FontWeight ->  Bold, FontSize ->  13, Black],
>       Text["A {", {2 - u, 7/5 - u*(4/5)}],
>                  Text[Dynamic[2 - u, u], {2.2 - u, 7/5 - u*(4/5)}],
>       Text[";", {2.32 - u, 7/5 - u*(4/5)}],
>
>       Text[Dynamic[8/5 - u*(4/5), u], {2.45 - u, 7/5 - u*(4/5)}],
>                  Text["}", {2.6 - u, 7/5 - u*(4/5)}],
>       Text["B {4; 11/5}", {4, 9/5}],
>                  Text["C {23/5; 23/5}", {22/5, 24/5}]}]}], {u, 0, 2,
>    1/10}]
>
>
>
>    



  • Prev by Date: Re: FindMaximum doesn't converge
  • Next by Date: How to expert a matrix in matrix market format
  • Previous by thread: Re: Dynamic Text in Manipulate.
  • Next by thread: NotebookAutoSave?