Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Re: How show Locator point and its image under a function?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79931] Re: [mg79905] Re: How show Locator point and its image under a function?
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Thu, 9 Aug 2007 05:15:49 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <f990t4$c2d$1@smc.vnet.net> <200708080856.EAA05959@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

Oops, I missed the Point wrapper for the image points.  Thanks.

And now LocatorAutoCreate -> All in the LocatorPane also satisfies the 
additional requirement I stated in a follow-up to my original post: 
allow multiple locator points to be created on the fly and their images 
automatically to be shown.

   f[{x_, y_}] := {2 x + 1, y + 2}

   DynamicModule[{pts = {{0, 0}}},
     Row[{
       LocatorPane[Dynamic[pts], Graphics[{}, PlotRange -> 5],
         LocatorAutoCreate -> All],
       Graphics[Dynamic[Point /@ f /@ pts], PlotRange -> 5]
     }]
   ]

David Bailey wrote:
> Murray Eisenberg wrote:
>> The following code displays a fixed point and its image under a 
>> specified function f:
>>
>>    f[{x_,y_}]:={2x+1,y+2}
>>    Module[{pt = {-1, 0.5}},
>>       Row[{
>>         Framed@Graphics[Point[pt], PlotRange -> 5],
>>         Framed@Graphics[Point[f[pt]], PlotRange -> 5]
>>       }]
>>     ]
>>
>> Now I want to have the point in the left-hand graphic to be dynamic, 
>> controlled by a Locator, and to have its changed image under the 
>> function to be shown in the right-hand graphic.
>>
>> The idea is something like the following (WRONG!) code:
>>
>>    DynamicModule[{pts={{0,0}}},
>>      Row[{
>>        LocatorPane[Dynamic[pts],Graphics[{},PlotRange->5]],
>>        Graphics[Dynamic[f/@pts],PlotRange->5]
>>      }]
>>    ]
>>
>> That code produces error messages, "1 is not a Graphics primitive or 
>> directive", "2 is not a Graphics primitive or directive".
>>
>> How can it actually be done?
>>
> Murray,
> 
> You forgot to make Point objects in your Graphics!
> 
> DynamicModule[{pts = {{0, 0}}},
>   Row[{LocatorPane[Dynamic[pts], Graphics[{}, PlotRange -> 5]],
>     Graphics[Dynamic[Point /@ f /@ pts], PlotRange -> 5]}]]
> 
> David Bailey
> http://www.dbaileyconsultancy.co.uk
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: show residuals of circle fit
  • Next by Date: Re: forming continuous "trail" with Locator
  • Previous by thread: Re: How show Locator point and its image under a function?
  • Next by thread: Re: How show Locator point and its image under a function?