Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8161 > unrolled thread
| Started by | Chris Young <cy56@comcast.net> |
|---|---|
| First post | 2012-01-25 12:13 +0000 |
| Last post | 2012-01-25 12:13 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Colored, indexed, resizable locators Chris Young <cy56@comcast.net> - 2012-01-25 12:13 +0000
| From | Chris Young <cy56@comcast.net> |
|---|---|
| Date | 2012-01-25 12:13 +0000 |
| Subject | Colored, indexed, resizable locators |
| Message-ID | <jforl6$6c7$1@smc.vnet.net> |
The only problems remaining is that the locators don't initially snap
to the grid, when they're first created, and that increasing the offset
of the indices too much tends to nudge the locators away from their
correct positions slightly.
To use this, just add whatever graphics you want in the Graphics[ ]
expresssion. I've just connected the points with lines.
http://home.comcast.net/~cy56/Mma/ColoredResizableLocators.nb
http://home.comcast.net/~cy56/Mma/ColoredResizableLocatorsPic.png
Chris Young
cy56@comcast.net
loc[k_, n_, locSize_, opac_, offset_] :=
Graphics[
{
Opacity[opac],
Hue[0.85 ((k - 1)/(n - 1))], Disk[{0, 0}],
Opacity[1], Black, Circle[{0, 0}],
Line[{{-1.5, 0}, {1.5, 0}}], Line[{{0, -1.5}, {0, 1.5}}],
Text[k, {0, 0}, offset]
},
ImageSize -> locSize]
Manipulate[
DynamicModule[
{P = {{0, 0}, {1, 1}}},
Dynamic @ LocatorPane[
Dynamic @ P,
Show[
Graphics[{Thick, Line[Dynamic @ P]}],
Axes -> True,
PlotRange -> 2,
GridLines -> {Range[-2, 2, 0.25], Range[-2, 2, 0.25]},
GridLinesStyle -> LightGray
],
{{-2, -2}, {2, 2}, {0.25, 0.25}},
LocatorAutoCreate -> True,
Appearance -> With[{n = Length[P]},
Table[loc[k, n, locSize, opac, offset], {k, 1, n}]
]
]
],
{{locSize, 30}, 5, 80, 1},
{{opac, 0.3}, 0, 1},
{{offset, {1, -1}}, {-2, -2}, {2, 2}, {0.25, 0.25}}
]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web