[PD] gemmouse and pix_data
jack at rybn.org
Fri Apr 9 14:47:09 CEST 2010
Le vendredi 09 avril 2010 à 11:52 +0100, Andrew Faraday a écrit :
> > Date: Fri, 9 Apr 2010 11:03:28 +0200
> > From: zmoelnig at iem.at
> > To: jbturgid at hotmail.com
> > CC: cinetron at passport.ca; pd-list at iem.at
> > Subject: Re: [PD] gemmouse and pix_data
> > Andrew Faraday wrote:
> > > Quick and simple solution to a lot of similar problems, use
> > >
> > > It needs four arguments, the input range (in this case 0 to the
> size of your gemwin) as two arguments, and the output range (usually
> -4 to 4) and it will convert one into the other. Although to make this
> work on gem you need one for each of the x and y axes.
> > >
> > > You can do this by re-scaling yourself, although this does take
> more time and effort, but also can provide more control. In the end
> it's your own choice.
> > >
> > [gemmouse] will output coordinates in pixels by default.
> > however, you can specify the range manually, [gemmouse 1 1] will
> > x=0..1 and y=0..1
> > fgmsadr
> > IOhannes
> I'm not entirely sure, but this would probably still be centred on the
> top left corner of the gem window, so would still require some
> arithmetic to sync up objects to mouse position.
No, if you read the help about [pix-data], you only need the range
between 0 and 1 :
The coordinates within the image (x-pos, y-pos) range from (0.0f, 0.0f)
(left-bottom) to (1.0f, 1.0f) (right-top).
So [gemmouse 1 1] is enough (on Linux you have to invert the values on Y
Your example is good for a square GEM window and return the position in
its space (not in the pix 'space' of a picture). (I'm not sure to be
clear here ?)
Have a look at the attached patch.
> Something like
> [gemmouse 8 8]
> | |
> [- 4] [- 4]
> Get a free e-mail account with Hotmail. Sign-up now.
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1710 bytes
Desc: not available
More information about the Pd-list