Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8045

Specifying Locator appearance in Manipulate

From Chris Young <cy56@comcast.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Specifying Locator appearance in Manipulate
Date 2012-01-21 10:10 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jfe2va$9nv$1@smc.vnet.net> (permalink)

Show all headers | View raw


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}
 ]

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Specifying Locator appearance in Manipulate Chris Young <cy56@comcast.net> - 2012-01-21 10:10 +0000

csiph-web