Message Boards Message Boards

0
|
2338 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Manipulate multiple dependent variables in a graphic

Posted 11 years ago
So I am trying to create a set of two vectors that I can click and drag the head or tail of either one and have it move and cause the other to move as well. I can get both to move, or both to be dependent, but I can't get them to both move and be dependent.
Below is my code, I also attached the file. Any help or pointers would be appreciated.

------------------------------------------------------------------------------------------------------------
DynamicModule[ {a1, b1, a2, b2}, Manipulate[  a1 = {pt[[1, 1]], pt[[1, 2]]};  b1 = {pt[[2, 1]], pt[[2, 2]]};  a2 = {-pt[[1, 1]], -pt[[1, 2]]};  b2 = {-pt[[2, 1]], -pt[[2, 2]]};  Deploy@Graphics[    {     Arrowheads,     {AbsoluteThickness[3], pink[0.5], Arrow[{a1, b1}]},     {AbsoluteThickness[3], pink[0.5], Arrow[{a2, b2}]},     {Line[3 {{0, -1}, {0, 1}}], Line[3 {{-1, 0}, {1, 0}}]},     },    PlotRange -> 4    ],  {{pt, {{0.2, 0.3}, {0.8, 2.2}}}, Locator, Appearance -> None},  AppearanceElements -> "ResetButton",  SaveDefinitions -> True  ] ]
Attachments:
POSTED BY: Jonathon D
I'm not sure I fully understand. If I move the head of one arrow, the other other arrow's head moves symmertrically. If I move the tail of another arrow, the other arrow's tail moves symmetrically. Are you not seeing this behavior on your computer? Is there something else you wanted the arrows to do? What version of Mathematica are you using?

The only issue I see is the existence of "pink[0.5]" in the code, which either has to be defined or should be removed.
POSTED BY: Sean Clarke
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