MathGroup Archive 2010

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

Search the Archive

How is it possible to Manipulate depending on what changed?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113467] How is it possible to Manipulate depending on what changed?
  • From: Dims <dims12 at hotmail.com>
  • Date: Sat, 30 Oct 2010 04:36:19 -0400 (EDT)

I want to draw arc between two locators. When moving "first" locator,
the arc should be moved with constant center and length. When moving
"second" locator, the arc should change it's length only.

It is obvious that these requirements imply detecting of what locator
was moved. It looks impossible to write algorith without this
knowledge.

I wrote the following:

Manipulate[
 \[Phi]1 = VectorAngle[{1, 0}, beg];
 \[Phi]2 = VectorAngle[{1, 0}, end];
 r = Norm[beg];
 l = (\[Phi]2 - \[Phi]1) r;
 end = {r Cos[\[Phi]2], r Sin[\[Phi]2]};
 Graphics[Circle[{0, 0}, r, {\[Phi]1, \[Phi]2}],
  PlotRange -> {{-3, 3}, {-3, 3}}],
 {{beg, {1, 0}}, Locator}, {{end, {Cos[1], Sin[1]}}, Locator}]

This has 2 bugs:

1) wrong angle calculation
2) and wrong behavior: when first locator is moved, the arc does not
conserve it's length

So, how to fix?

Thanks.


  • Prev by Date: Re: How to isolate the constant in a two variable equation?
  • Next by Date: How to convert Inset graphics to absolute coords?
  • Previous by thread: Re: How to isolate the constant in a two variable
  • Next by thread: How to convert Inset graphics to absolute coords?