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


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

Re: Automatically colred and indexed custom locators

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx02.iad01.newshosting.com!newshosting.com!newspump.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail
From Christopher Young <cy56@comcast.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Automatically colred and indexed custom locators
Date Wed, 25 Jan 2012 12:12:56 +0000 (UTC)
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <jfork8$6bt$1@smc.vnet.net> (permalink)
References <201201241005.FAA20228@smc.vnet.net> <7E8A3482-EB83-4C75-9D82-05A776C87976@gmail.com>
Lines 43
NNTP-Posting-Date 25 Jan 2012 12:13:27 GMT
NNTP-Posting-Host 3d34f8e6.news.twtelecom.net
X-Trace DXC=33[7gI1h<AmnJ]SQJ40F_gC_A=>8kQj6mhHXa^^g6TZdIGSP3JQofamEFiONJ7[Gof[7J5iO@\=mc
X-Complaints-To abuse@twtelecom.net
Xref x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:8160

Show key headers only | View raw


Thanks, that fixed the problem with the snapping not working when the 
point is created. The only problem is, the points can now only be 
dragged one grid unit at a time.

I'm working on something that will work completely, but it looks like I 
may have to give up using Manipulate. I really don't want to have to 
click and drag only 1 unit at a time.


On Jan 24, 2012, at 7:54 AM, Heike Gramberg wrote:

> Looks nice. To make the locators snap to the grid on creation you can 
do something like this:
>
> locGraphics[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[{n},
>  P = Round[P, .25];
>  LocatorPane[Dynamic[P],
>   Show[Graphics[{Thick, Line[P]}], Axes -> True, PlotRange -> 2,
>    GridLines -> {Range[-2, 2, 0.25], Range[-2, 2, 0.25]},
>    GridLinesStyle -> LightGray], {{-2, -2}, {2, 2}, {.25, .25}},
>   LocatorAutoCreate -> True, Appearance -> (n = Length[P];
>     Table[locGraphics[k, n, locSize, opac, offset], {k, 1, n}])]],
> {{P, {{0, 0}, {1, 1}}}, None},
> {{locSize, 15}, 5, 80, 1}, {{opac, 0.75}, 0,
>  1}, {{offset, {0, 0}}, {-2, -2}, {2, 2}, {0.25, 0.25}}]
>
> Basically, all I've done her is changing P from being a local variable 
of the DynamicModule to a
> controller of the enclosing Manipulate and adding the line P = 
Round[P, .25];
>
> Heike
>
> By the way, changing P to a controller should also solve the problem 
in your other
> post about morphing Bezier curves.

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


Thread

Re: Automatically colred and indexed custom locators Christopher Young <cy56@comcast.net> - 2012-01-25 12:12 +0000

csiph-web