MathGroup Archive 2012

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

Search the Archive

Specifying Locator appearance in Manipulate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124468] Specifying Locator appearance in Manipulate
  • From: Chris Young <cy56 at comcast.net>
  • Date: Sat, 21 Jan 2012 05:11:04 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Took quite a while to figure this out, so I thought I'd pass it along. 
I wish that Locator color could be specified directly in the Appearance 
option for the Locator, but that just puts a colored oblong behind the 
Locator. Below, I add the points in in the Graphics[ ] section. This at 
least gives colored Locators. Could also add text, etc., there.

http://home.comcast.net/~cy56/Mma/LocatorColorAndSize.nb
http://home.comcast.net/~cy56/Mma/LocatorColorAndSizePic.png

Manipulate[
 Module[
  {A = P[[1]], B = P[[2]], M},
  M = (A + B)/2;
  Show[
   ParametricPlot[
    M + k (t - 1/2) (B - A),    {t, 0, 1},
    PlotRange -> 2,
    PlotStyle -> Directive[Purple, Thick]
    ],
   Graphics[{
     AbsolutePointSize[12],
     With[{color = {Green, Red}},
      {color[[k]], Point[P[[k]]]}~Table~{k, 2}
      ],
     Yellow, Point[M]
     }]
   ]
  ],
 {{k, 0.5}, 0, 1},

 { {P, {{0, 0}, {1, 1}}},
  Appearance -> Graphics[Locator[{0, 0}, ImageSize -> Medium]],
  Locator}
 ]




  • Prev by Date: Re: Is there any efficient easy way to compare two lists with the same length with Mathematica?
  • Next by Date: DynamicModule to set locations of 3D points from 2D LocatorPane?
  • Previous by thread: Re: Derivatives Output as TraditionalForm
  • Next by thread: DynamicModule to set locations of 3D points from 2D LocatorPane?